ymkNK / ymkNK.github.io

Personal Blog
https://lllovol.com
2 stars 0 forks source link

使用Rakefile实现文章生成器 - lllovol #2

Open ymkNK opened 5 years ago

ymkNK commented 5 years ago

http://blog.lllovol.com/rake/

ymkNK commented 5 years ago

基于gitalk的留言功能搞定啦

ymkNK commented 5 years ago
task :git do
  puts "请输入git内容 m"
  @msg = STDIN.gets.chomp

  @slug = "#{@msg}"
  @slug = @slug.downcase.strip.gsub(' ', '-')
  @date = Time.now.strftime("%F")
  @finalmsg = "#{@date}-#{@slug}"
  system "git add ."
  system "git commit -m \"#{@finalmsg}\""
  system "git push"
  puts "git push \"#{@finalmsg}\" successfully"
end

添加上述代码到rakefile当中,可以实现快速的上传文章(其实就是省去了git 的一些操作指令)