forked from RailsApps/rails_apps_composer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
49 lines (35 loc) · 1006 Bytes
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
require 'bundler'
Bundler.setup :development
require 'mg'
MG.new "rails_apps_composer.gemspec"
require 'rspec/core/rake_task'
desc "run specs"
RSpec::Core::RakeTask.new
task :default => :spec
desc "Remove the test_run Rails app (if it's there)"
task :clean do
system 'rm -rf test_run'
end
desc "Execute a test run with the specified recipes."
task :run => :clean do
recipes = ENV['RECIPES'].split(',')
require 'tempfile'
require 'rails_wizard'
template = RailsWizard::Template.new(recipes)
begin
dir = Dir.mktmpdir "rails_template"
Dir.chdir(dir) do
file = File.open('template.rb', 'w')
file.write template.compile
file.close
system "rails new test_run -m template.rb #{template.args.join(' ')}"
puts "\n\n cd #{dir} # look at the app"
end
end
end
desc "Prints out a template from the provided recipes."
task :print do
require 'rails_wizard'
recipes = ENV['RECIPES'].split(',')
puts RailsWizard::Template.new(recipes).compile
end