engine_cart 2.3.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +33 -0
- data/Gemfile +10 -0
- data/README.md +2 -2
- data/Rakefile +4 -5
- data/engine_cart.gemspec +1 -1
- data/lib/engine_cart/gemfile_stanza.rb +10 -9
- data/lib/engine_cart/tasks/engine_cart.rake +8 -20
- data/lib/engine_cart/version.rb +1 -1
- data/lib/engine_cart.rb +1 -1
- data/spec/integration/engine_cart_spec.rb +1 -1
- metadata +6 -6
- data/.travis.yml +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c910fecebf1668fff3496adb5ffbb775f8b26d6172c0bd852a42b2347ab37c5b
|
4
|
+
data.tar.gz: c9f3f648c782203de8dec936e58057432db338ead895ac7f142829b130692e00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a5b3d945948e1b95120b621085ca3b560ce1ae6e4f1b10b99edfa288e97a8d6a43e98db7b16ece7d736a8878d80384ff76baf3577ee00a509c1fe0d9c5e4473
|
7
|
+
data.tar.gz: 54d05bb765b09739ae6e53816b488efa619d2d5b3730c8b8b30db427c51b33a32a822282c5d4b94f7e5eb841b71d9baad8d9d7707e6d3ea8dd86c74bb50d0d8f
|
@@ -0,0 +1,33 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ master ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
strategy:
|
13
|
+
matrix:
|
14
|
+
ruby:
|
15
|
+
- 2.7
|
16
|
+
rails_version:
|
17
|
+
- 5.2.6
|
18
|
+
- 6.0.4.1
|
19
|
+
- 6.1.4.1
|
20
|
+
steps:
|
21
|
+
- uses: actions/checkout@v2
|
22
|
+
- name: Set up Ruby
|
23
|
+
uses: ruby/setup-ruby@v1
|
24
|
+
with:
|
25
|
+
ruby-version: ${{ matrix.ruby }}
|
26
|
+
- name: Install dependencies
|
27
|
+
run: bundle install
|
28
|
+
env:
|
29
|
+
RAILS_VERSION: ${{ matrix.rails_version }}
|
30
|
+
- name: Run tests
|
31
|
+
run: bundle exec rake
|
32
|
+
env:
|
33
|
+
RAILS_VERSION: ${{ matrix.rails_version }}
|
data/Gemfile
CHANGED
@@ -4,3 +4,13 @@ source 'https://rubygems.org'
|
|
4
4
|
gemspec
|
5
5
|
|
6
6
|
gem 'rails', ENV['RAILS_VERSION'] if ENV['RAILS_VERSION']
|
7
|
+
|
8
|
+
case ENV['RAILS_VERSION']
|
9
|
+
when /^6.0/
|
10
|
+
gem 'sass-rails', '>= 6'
|
11
|
+
gem 'webpacker', '~> 4.0'
|
12
|
+
when /^5.[12]/
|
13
|
+
gem 'sprockets', '< 4.0'
|
14
|
+
gem 'sass-rails', '~> 5.0'
|
15
|
+
gem 'thor', '~> 0.20'
|
16
|
+
end
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
[![
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/engine_cart.svg)](http://badge.fury.io/rb/engine_cart)
|
2
2
|
|
3
3
|
# EngineCart
|
4
4
|
|
@@ -7,7 +7,7 @@ Rake tasks to generate a test application for a Rails Engine gem.
|
|
7
7
|
If you have a Rails Engine and want to test it, the suggested approach is a small dummy application that loads up a Rails application with your engine loaded. This dummy application is usually checked into source control and maintained with the application. This works great, until you want to test:
|
8
8
|
|
9
9
|
- different versions of Ruby (e.g. MRI and JRuby)
|
10
|
-
- different versions of Rails (Rails
|
10
|
+
- different versions of Rails (Rails 5.0, 6.0)
|
11
11
|
- different deployment environments (with and without devise, etc)
|
12
12
|
|
13
13
|
where each scenario may involve different configurations, Gemfiles, etc.
|
data/Rakefile
CHANGED
@@ -10,7 +10,7 @@ end
|
|
10
10
|
|
11
11
|
task :generate_test_gem => ['engine_cart:setup'] do
|
12
12
|
system("rm -rf .internal_test_gem")
|
13
|
-
gem 'rails', '
|
13
|
+
gem 'rails', ENV['RAILS_VERSION']
|
14
14
|
|
15
15
|
rails_path = Gem.bin_path('railties', 'rails')
|
16
16
|
puts rails_path
|
@@ -29,6 +29,8 @@ task :generate_test_gem => ['engine_cart:setup'] do
|
|
29
29
|
IO.write(".internal_test_gem/internal_test_gem.gemspec", File.open(".internal_test_gem/internal_test_gem.gemspec") {|f| f.read.gsub(/TODO/, "DONTCARE")})
|
30
30
|
IO.write(".internal_test_gem/internal_test_gem.gemspec", File.open(".internal_test_gem/internal_test_gem.gemspec") {|f| f.read.gsub(/.*homepage.*/, "")})
|
31
31
|
IO.write(".internal_test_gem/internal_test_gem.gemspec", File.open(".internal_test_gem/internal_test_gem.gemspec") {|f| f.read.gsub(/.*sqlite3.*/, "")})
|
32
|
+
IO.write(".internal_test_gem/internal_test_gem.gemspec", File.open(".internal_test_gem/internal_test_gem.gemspec") {|f| f.read.gsub(/.*source_code_uri.*/, "")})
|
33
|
+
IO.write(".internal_test_gem/internal_test_gem.gemspec", File.open(".internal_test_gem/internal_test_gem.gemspec") {|f| f.read.gsub(/.*changelog_uri.*/, "")})
|
32
34
|
|
33
35
|
Rake::Task['engine_cart:inject_gemfile_extras'].invoke
|
34
36
|
EngineCart.within_test_app do
|
@@ -50,10 +52,7 @@ task :generate_test_gem => ['engine_cart:setup'] do
|
|
50
52
|
end
|
51
53
|
|
52
54
|
system "echo '\ngem \"rspec-rails\"\n' >> Gemfile"
|
53
|
-
|
54
|
-
system %Q{echo '\ngem "sass", "~> 3.2.15"\n' >> Gemfile}
|
55
|
-
system %Q{echo '\ngem "sprockets", "~> 2.11.0"\n' >> Gemfile}
|
56
|
-
end
|
55
|
+
|
57
56
|
Bundler.clean_system "bundle update --quiet"
|
58
57
|
system "echo 'require \"engine_cart/rake_task\"\n' >> Rakefile"
|
59
58
|
|
data/engine_cart.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency
|
21
|
+
spec.add_dependency 'rails', '>= 5.0'
|
22
22
|
spec.add_development_dependency "rake"
|
23
23
|
spec.add_development_dependency "rspec"
|
24
24
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module EngineCart
|
2
2
|
def self.gemfile_stanza_check_line
|
3
|
-
|
3
|
+
'engine_cart stanza: 2.5.0'
|
4
4
|
end
|
5
5
|
|
6
6
|
def self.gemfile_stanza_text
|
@@ -27,15 +27,16 @@ module EngineCart
|
|
27
27
|
else
|
28
28
|
gem 'rails', ENV['RAILS_VERSION']
|
29
29
|
end
|
30
|
-
end
|
31
30
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
31
|
+
case ENV['RAILS_VERSION']
|
32
|
+
when /^6.0/
|
33
|
+
gem 'sass-rails', '>= 6'
|
34
|
+
gem 'webpacker', '~> 4.0'
|
35
|
+
when /^5.[12]/
|
36
|
+
gem 'sass-rails', '~> 5.0'
|
37
|
+
gem 'sprockets', '~> 3.7'
|
38
|
+
gem 'thor', '~> 0.20'
|
39
|
+
end
|
39
40
|
end
|
40
41
|
end
|
41
42
|
# END ENGINE_CART BLOCK
|
@@ -34,6 +34,10 @@ namespace :engine_cart do
|
|
34
34
|
require 'rails/generators'
|
35
35
|
require 'rails/generators/rails/app/app_generator'
|
36
36
|
|
37
|
+
# Clear out our current bundle so that the rails generator can run with it's own bundle
|
38
|
+
backup_gemfile = ENV['BUNDLE_GEMFILE']
|
39
|
+
ENV.delete('BUNDLE_GEMFILE')
|
40
|
+
|
37
41
|
# Using the Rails generator directly, instead of shelling out, to
|
38
42
|
# ensure we use the right version of Rails.
|
39
43
|
Rails::Generators::AppGenerator.start([
|
@@ -43,11 +47,14 @@ namespace :engine_cart do
|
|
43
47
|
'--skip_spring',
|
44
48
|
'--skip-bootsnap',
|
45
49
|
'--skip-listen',
|
46
|
-
'--skip-bundle',
|
47
50
|
'--skip-test',
|
48
51
|
*EngineCart.rails_options,
|
49
52
|
("-m #{EngineCart.template}" if EngineCart.template)
|
50
53
|
].compact)
|
54
|
+
|
55
|
+
# Restore our gemfile
|
56
|
+
ENV['BUNDLE_GEMFILE'] = backup_gemfile
|
57
|
+
|
51
58
|
end
|
52
59
|
exit 0
|
53
60
|
end
|
@@ -67,22 +74,6 @@ namespace :engine_cart do
|
|
67
74
|
text.gsub(/^gem ["']sqlite3["']$/, 'gem "sqlite3", "~> 1.3.0"')
|
68
75
|
end)
|
69
76
|
end
|
70
|
-
|
71
|
-
if Gem.loaded_specs["rails"].version.to_s < '4.2.4'
|
72
|
-
has_web_console = false
|
73
|
-
|
74
|
-
# Hack for https://github.com/rails/web-console/issues/150
|
75
|
-
gemfile = File.join(EngineCart.destination, 'Gemfile')
|
76
|
-
IO.write(gemfile, File.open(gemfile) do |f|
|
77
|
-
text = f.read
|
78
|
-
has_web_console = text.match('web-console')
|
79
|
-
text.gsub(/.*web-console.*/, "").gsub(/.*IRB console on exception pages.*/, "")
|
80
|
-
end)
|
81
|
-
|
82
|
-
File.open(gemfile, "a") do |f|
|
83
|
-
f.puts 'gem "web-console", group: :development'
|
84
|
-
end if has_web_console
|
85
|
-
end
|
86
77
|
end
|
87
78
|
end
|
88
79
|
|
@@ -111,9 +102,6 @@ namespace :engine_cart do
|
|
111
102
|
|
112
103
|
# Create a new test rails app
|
113
104
|
Rake::Task['engine_cart:create_test_rails_app'].invoke
|
114
|
-
|
115
|
-
Bundler.clean_system "bundle install --quiet"
|
116
|
-
|
117
105
|
Rake::Task['engine_cart:inject_gemfile_extras'].invoke
|
118
106
|
|
119
107
|
# Copy our test app generators into the app and prepare it
|
data/lib/engine_cart/version.rb
CHANGED
data/lib/engine_cart.rb
CHANGED
@@ -75,7 +75,7 @@ module EngineCart
|
|
75
75
|
|
76
76
|
def self.fingerprinted_files
|
77
77
|
Dir.glob("./*.gemspec").select { |f| File.file? f } +
|
78
|
-
[Bundler.default_gemfile.to_s
|
78
|
+
[Bundler.default_gemfile.to_s] +
|
79
79
|
Dir.glob("./db/migrate/*").select { |f| File.file? f } +
|
80
80
|
Dir.glob("./lib/generators/**/**").select { |f| File.file? f } +
|
81
81
|
Dir.glob("./spec/test_app_templates/**/**").select { |f| File.file? f } +
|
@@ -79,7 +79,7 @@ describe "EngineCart powered application" do
|
|
79
79
|
File.open('spec/require_spec.rb', 'w') do |f|
|
80
80
|
f.puts <<-EOF
|
81
81
|
require 'spec_helper'
|
82
|
-
require '
|
82
|
+
require 'sqlite3'
|
83
83
|
|
84
84
|
describe ApplicationController do
|
85
85
|
it "should be able to run specs that reference gems provided by the test app" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: engine_cart
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Beer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-12-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
19
|
+
version: '5.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
26
|
+
version: '5.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -60,8 +60,8 @@ extensions: []
|
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
62
|
- ".engine_cart.yml"
|
63
|
+
- ".github/workflows/ci.yml"
|
63
64
|
- ".gitignore"
|
64
|
-
- ".travis.yml"
|
65
65
|
- Gemfile
|
66
66
|
- LICENSE.txt
|
67
67
|
- README.md
|
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0'
|
98
98
|
requirements: []
|
99
|
-
rubygems_version: 3.
|
99
|
+
rubygems_version: 3.1.4
|
100
100
|
signing_key:
|
101
101
|
specification_version: 4
|
102
102
|
summary: Helper for testing Rails Engines sanely
|