Sha256: 1b8bcf47ba11480af21175167f33acfbc8182b99c2490eeb5af991cdf850f1d4

Contents?: true

Size: 1.84 KB

Versions: 20

Compression:

Stored size: 1.84 KB

Contents

require 'rubygems'
require 'rake'
require 'rake/testtask'
require 'rake/packagetask'
require 'rake/gempackagetask'

gemfile = File.expand_path('../spec/test_app/Gemfile', __FILE__)
if File.exists?(gemfile) && (%w(spec cucumber).include?(ARGV.first.to_s) || ARGV.size == 0)
  require 'bundler'
  ENV['BUNDLE_GEMFILE'] = gemfile
  Bundler.setup

  require 'rspec'
  require 'rspec/core/rake_task'
  RSpec::Core::RakeTask.new

  require 'cucumber/rake/task'
  Cucumber::Rake::Task.new do |t|
    t.cucumber_opts = %w{--format progress}
  end
end

desc "Default Task"
task :default => [:spec, :cucumber ]

spec = eval(File.read('<%= file_name %>.gemspec'))

Rake::GemPackageTask.new(spec) do |p|
  p.gem_spec = spec
end

desc "Release to gemcutter"
task :release => :package do
  require 'rake/gemcutter'
  Rake::Gemcutter::Tasks.new(spec).define
  Rake::Task['gem:push'].invoke
end

desc "Default Task"
task :default => [ :spec ]

desc "Regenerates a rails 3 app for testing"
task :test_app do
  require '../spree/lib/generators/spree/test_app_generator'
  class <%= file_name.classify %>TestAppGenerator < Spree::Generators::TestAppGenerator

    def install_gems
      inside "test_app" do
        run 'bundle exec rake spree_core:install'
        run 'bundle exec rake <%= file_name %>:install'
      end
    end

    def migrate_db
      run_migrations
    end

    protected
    def full_path_for_local_gems
      <<-gems
gem 'spree_core', :path => \'#{File.join(File.dirname(__FILE__), "../spree/", "core")}\'
gem '<%= file_name %>', :path => \'#{File.dirname(__FILE__)}\'
      gems
    end

  end
  <%= file_name.classify %>TestAppGenerator.start
end

namespace :test_app do
  desc 'Rebuild test and cucumber databases'
  task :rebuild_dbs do
    system("cd spec/test_app && bundle exec rake db:drop db:migrate RAILS_ENV=test && rake db:drop db:migrate RAILS_ENV=cucumber")
  end
end

Version data entries

20 entries across 20 versions & 6 rubygems

Version Path
My-Commerce-1.1.0 lib/generators/templates/Rakefile.tt
MyCommerceapi-1.0.0 lib/generators/templates/Rakefile.tt
MyCommerce-0.0.3 lib/generators/templates/Rakefile.tt
rfcommerce-0.0.3 lib/generators/templates/Rakefile.tt
spree-0.60.6 lib/generators/templates/Rakefile.tt
spree-0.60.5 lib/generators/templates/Rakefile.tt
spree-0.60.4 lib/generators/templates/Rakefile.tt
spree-0.60.3 lib/generators/templates/Rakefile.tt
spree-0.60.2 lib/generators/templates/Rakefile.tt
spree_bushido-0.80.28 lib/generators/templates/Rakefile.tt
spree_bushido-0.80.27 lib/generators/templates/Rakefile.tt
spree_bushido-0.80.26 lib/generators/templates/Rakefile.tt
spree_bushido-0.80.25 lib/generators/templates/Rakefile.tt
spree_bushido-0.80.24 lib/generators/templates/Rakefile.tt
spree_bushido-0.80.23 lib/generators/templates/Rakefile.tt
spree_bushido-0.80.22 lib/generators/templates/Rakefile.tt
spree_bushido-0.80.21 lib/generators/templates/Rakefile.tt
spree_bushido-0.80.1 lib/generators/templates/Rakefile.tt
spree_bushido-0.60.1 lib/generators/templates/Rakefile.tt
spree-0.60.1 lib/generators/templates/Rakefile.tt