Skip to content
Please note that GitHub no longer supports your web browser.

We recommend upgrading to the latest Google Chrome or Firefox.

Learn more
Permalink
Browse files

Add engine_cart

  • Loading branch information...
ruebot committed Aug 3, 2017
1 parent 4bf0464 commit f12dcc49625fdccb27f2405f043288629169f313
Showing with 57 additions and 38 deletions.
  1. +33 −8 Gemfile
  2. +10 −30 Rakefile
  3. +14 −0 spec/test_app_templates/lib/generators/test_app_generator.rb
41 Gemfile
@@ -1,14 +1,39 @@
# frozen_string_literal: true
source 'https://rubygems.org'

# Declare your gem's dependencies in warclight.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
gemspec
# BEGIN ENGINE_CART BLOCK
# engine_cart: 1.1.0
# engine_cart stanza: 0.10.0
# the below comes from engine_cart, a gem used to test this Rails engine gem in the context of a Rails app.
file = File.expand_path('Gemfile', ENV['ENGINE_CART_DESTINATION'] || ENV['RAILS_ROOT'] || File.expand_path('.internal_test_app', File.dirname(__FILE__)))
if File.exist?(file)
begin
eval_gemfile file
rescue Bundler::GemfileError => e
Bundler.ui.warn '[EngineCart] Skipping Rails application dependencies:'
Bundler.ui.warn e.message
end
else
Bundler.ui.warn "[EngineCart] Unable to find test application dependencies in #{file}, using placeholder dependencies"

# Declare any dependencies that are still in development here instead of in
# your gemspec. These might include edge Rails or gems from your path or
# Git. Remember to move these dependencies to your gemspec before releasing
# your gem to rubygems.org.
if ENV['RAILS_VERSION']
if ENV['RAILS_VERSION'] == 'edge'
gem 'rails', github: 'rails/rails'
ENV['ENGINE_CART_RAILS_OPTIONS'] = '--edge --skip-turbolinks'
else
gem 'rails', ENV['RAILS_VERSION']
end
end

# To use a debugger
# gem 'byebug', group: [:development, :test]
case ENV['RAILS_VERSION']
when /^4.2/
gem 'responders', '~> 2.0'
gem 'sass-rails', '>= 5.0'
gem 'coffee-rails', '~> 4.1.0'
when /^4.[01]/
gem 'sass-rails', '< 5.0'
end
end
# END ENGINE_CART BLOCK
@@ -1,36 +1,16 @@
begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end

require 'rdoc/task'

RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'Warclight'
rdoc.options << '--line-numbers'
rdoc.rdoc_files.include('README.md')
rdoc.rdoc_files.include('lib/**/*.rb')
end

APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
load 'rails/tasks/engine.rake'


load 'rails/tasks/statistics.rake'


# frozen_string_literal: true

require 'bundler/gem_tasks'
require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new(:spec)

require 'rake/testtask'
require 'rubocop/rake_task'
RuboCop::RakeTask.new(:rubocop)

Rake::TestTask.new(:test) do |t|
t.libs << 'test'
t.pattern = 'test/**/*_test.rb'
t.verbose = false
end
Dir.glob('./tasks/*.rake').each { |f| load f }
Dir.glob('./lib/tasks/*.rake').each { |f| load f }

require 'engine_cart/rake_task'

task default: :test
task default: %i[rubocop eslint ci]
@@ -0,0 +1,14 @@
require 'rails/generators'

class TestAppGenerator < Rails::Generators::Base
source_root "./spec/test_app_templates"

# if you need to generate any additional configuration
# into the test app, this generator will be run immediately
# after setting up the application

def install_engine
generate 'warclight:install'
end
end

0 comments on commit f12dcc4

Please sign in to comment.
You can’t perform that action at this time.