forked from cbeer/engine_cart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
59 lines (44 loc) · 1.85 KB
/
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
50
51
52
53
54
55
56
57
58
59
require "bundler/gem_tasks"
require 'engine_cart/rake_task'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
task :ci => ['generate_test_gem', 'spec'] do
end
task :generate_test_gem => ['engine_cart:setup'] do
system("rm -rf .internal_test_gem")
gem 'rails'
rails_path = Gem.bin_path('railties', 'rails')
Bundler.with_clean_env do
system("#{rails_path} plugin new internal_test_gem")
end
system("mv internal_test_gem .internal_test_gem")
IO.write(".internal_test_gem/internal_test_gem.gemspec", File.open(".internal_test_gem/internal_test_gem.gemspec") {|f| f.read.gsub(/FIXME/, "DONTCARE")})
IO.write(".internal_test_gem/internal_test_gem.gemspec", File.open(".internal_test_gem/internal_test_gem.gemspec") {|f| f.read.gsub(/TODO/, "DONTCARE")})
IO.write(".internal_test_gem/internal_test_gem.gemspec", File.open(".internal_test_gem/internal_test_gem.gemspec") {|f| f.read.gsub(/.*homepage.*/, "")})
EngineCart.destination = '.internal_test_gem'
Rake::Task['engine_cart:inject_gemfile_extras'].invoke
EngineCart.within_test_app do
system "git init"
FileUtils.touch('.gitignore')
Dir.mkdir('spec')
File.open('spec/spec_helper.rb', 'w') do |f|
f.puts <<-EOF
require 'engine_cart'
EngineCart.load_application!
require 'rspec/rails'
require 'rspec/autorun'
require 'internal_test_gem'
RSpec.configure do |config|
end
EOF
end
system "echo '\ngem \"rspec-rails\"\n' >> Gemfile"
system %Q{echo '\ngem "sass", "~> 3.2.15"\n' >> Gemfile}
system %Q{echo '\ngem "sprockets", "~> 2.11.0"\n' >> Gemfile}
Bundler.clean_system "bundle update --quiet"
system "echo 'require \"engine_cart/rake_task\"\n' >> Rakefile"
system("bundle exec rake engine_cart:prepare")
Bundler.clean_system "bundle install --quiet"
end
end
task :default => :ci