Sha256: bc8511157c3c3bf3e0f31dccf79f648166d3b024a0597af158be9cc4a153c510

Contents?: true

Size: 1.89 KB

Versions: 2

Compression:

Stored size: 1.89 KB

Contents

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 'internal_test_gem'
        RSpec.configure do |config|

        end
      EOF
    end

    system "echo '\ngem \"rspec-rails\"\n' >> Gemfile"
    if Gem.loaded_specs["rails"].version.to_s < '4.2'
      system %Q{echo '\ngem "sass", "~> 3.2.15"\n' >> Gemfile}
      system %Q{echo '\ngem "sprockets", "~> 2.11.0"\n' >> Gemfile}
    end
    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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
engine_cart-0.10.0 Rakefile
engine_cart-0.9.1 Rakefile