3
0

More than 3 years have passed since last update.

Rake

Last updated at Posted at 2020-12-27

!Mac OS X-10.15.7 !ruby-2.7.1p83

Rake

rakeはmakeやantのruby版
rakeコマンドの内容はRakefileにtaskを作成する
Rakefileに

task :default do
  system 'rake -T'
  exit
end

desc 'hello NAME'
task :hello do
  name = ARGV[1]
  puts "Hello #{name}!"
  exit
end

実行結果

$ rake hello Cyoukou
hello Cyoukou

となるこれはつまりRakefileの中の「hello」というtaskを実行したことになる

System Call

system callでgitの操作を一発でできるように

desc 'git push'
task :push do
  p comm = "git pull origin main"
  system comm
  p comm = "git add -A"
  system comm
  p comm = "git commit -m \'commit\'"
  system comm
  p comm = "git push origin main"
  system comm
  exit
end

ような感じでpullからpushまでやってくれる便利!!


  • source ~/grad_members_20f/members/wjswnsrud12/memo8.org
3
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0