プロジェクト

全般

プロフィール

機能 #628 » Rakefile

Katsuyoshi MATSUMOTO, 2013-12-08 15:22

 
1
require 'rake/task'
2

    
3
desc 'Generate Gemfile from Gemfile.rb'
4
task :gemfile do
5
  confroot = ENV['confroot'] || File.expand_path('~/.mikutter')
6
  gemfile = File.open('./Gemfile.rb').read.sub('confroot',confroot)
7
  file = File.open('./Gemfile', 'w')
8
  file.write(gemfile)
9
  file.close
10
end
11

    
12
desc 'install gems'
13
task install: :gemfile do
14
  command = ["bundle", "install"]
15
  command = command + ['--path', ENV['gem_dir']] if ENV['gem_dir']
16
  system command.join(' ')
17
end
18

    
19
desc 'run mikutter'
20
task :run do
21
  log = system 'bundle exec ruby mikutter.rb'
22
  puts 'cannot run mikutter! please exec "rake gemfile and rake install"' unless log
23
end
24

    
25
task :default => :run
(2-2/2)