engine_cart 2.4.0 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c910fecebf1668fff3496adb5ffbb775f8b26d6172c0bd852a42b2347ab37c5b
4
- data.tar.gz: c9f3f648c782203de8dec936e58057432db338ead895ac7f142829b130692e00
3
+ metadata.gz: 864ca4cc0c524ad80281f92e1dce77df32cb2a2c4b6f27d293721ee8e9305412
4
+ data.tar.gz: 5c8ec70e88e2a6efd9d919c04c56be20509afebacce106118d3061de56a40cfc
5
5
  SHA512:
6
- metadata.gz: 2a5b3d945948e1b95120b621085ca3b560ce1ae6e4f1b10b99edfa288e97a8d6a43e98db7b16ece7d736a8878d80384ff76baf3577ee00a509c1fe0d9c5e4473
7
- data.tar.gz: 54d05bb765b09739ae6e53816b488efa619d2d5b3730c8b8b30db427c51b33a32a822282c5d4b94f7e5eb841b71d9baad8d9d7707e6d3ea8dd86c74bb50d0d8f
6
+ metadata.gz: 324a7c844887c7f43923d6d8dadd72f599567158ad6bd8876496865700239be2a28a0314feef816e7ce2b8cb5dff405b4d6bc3ec93d8912ac8e7bb13554e56b1
7
+ data.tar.gz: f377f63b4585553142802de3451eaaa4882de55bd821976e45c892e820d43bb708ef9c6afba7d166a883d8150be6d03bfdaec62aa93614d9a21ce521eb8e7d10
@@ -12,17 +12,26 @@ jobs:
12
12
  strategy:
13
13
  matrix:
14
14
  ruby:
15
- - 2.7
15
+ - 3.1
16
16
  rails_version:
17
- - 5.2.6
18
- - 6.0.4.1
19
- - 6.1.4.1
17
+ - 6.1.6.1
18
+ - 7.0.3.1
19
+ include:
20
+ - ruby: '2.7.8' # Rails 6.0 will not run on Ruby 3
21
+ rails_version: '6.0.5.1'
22
+ - ruby: '2.7.8' # Rails 5.2 will not run on Ruby 3
23
+ rails_version: '5.2.8.1'
24
+ - ruby: '3.2.2'
25
+ rails_version: '7.1.1'
26
+ - ruby: '3.3.0'
27
+ rails_version: '7.1.1'
20
28
  steps:
21
29
  - uses: actions/checkout@v2
22
30
  - name: Set up Ruby
23
31
  uses: ruby/setup-ruby@v1
24
32
  with:
25
33
  ruby-version: ${{ matrix.ruby }}
34
+ bundler: 'latest'
26
35
  - name: Install dependencies
27
36
  run: bundle install
28
37
  env:
data/Rakefile CHANGED
@@ -25,12 +25,17 @@ task :generate_test_gem => ['engine_cart:setup'] do
25
25
 
26
26
  system("mv #{Dir.pwd}/internal_test_gem #{Dir.pwd}/.internal_test_gem")
27
27
 
28
- IO.write(".internal_test_gem/internal_test_gem.gemspec", File.open(".internal_test_gem/internal_test_gem.gemspec") {|f| f.read.gsub(/FIXME/, "DONTCARE")})
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
- IO.write(".internal_test_gem/internal_test_gem.gemspec", File.open(".internal_test_gem/internal_test_gem.gemspec") {|f| f.read.gsub(/.*homepage.*/, "")})
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.*/, "")})
28
+ gemspec_data = File.open(".internal_test_gem/internal_test_gem.gemspec") do |f|
29
+ f.read.gsub(/FIXME/, "DONTCARE")
30
+ .gsub(/TODO/, "DONTCARE")
31
+ .gsub(/.*homepage.*/, "")
32
+ .gsub(/.*sqlite3.*/, "")
33
+ .gsub(/.*source_code_uri.*/, "")
34
+ .gsub(/.*changelog_uri.*/, "")
35
+ end
36
+
37
+ IO.write(".internal_test_gem/internal_test_gem.gemspec", gemspec_data)
38
+ IO.write(".internal_test_gem/Gemfile", File.open(".internal_test_gem/Gemfile") {|f| f.read.gsub(/.*sqlite3.*/, "")})
34
39
 
35
40
  Rake::Task['engine_cart:inject_gemfile_extras'].invoke
36
41
  EngineCart.within_test_app do
@@ -52,12 +57,15 @@ task :generate_test_gem => ['engine_cart:setup'] do
52
57
  end
53
58
 
54
59
  system "echo '\ngem \"rspec-rails\"\n' >> Gemfile"
60
+ if RUBY_VERSION < '3.0'
61
+ system "echo '\ngem \"sqlite3\", \"< 1.7.0\"\n' >> Gemfile"
62
+ end
55
63
 
56
- Bundler.clean_system "bundle update --quiet"
64
+ Bundler.unbundled_system "bundle update --quiet"
57
65
  system "echo 'require \"engine_cart/rake_task\"\n' >> Rakefile"
58
66
 
59
67
  system("bundle exec rake engine_cart:prepare")
60
- Bundler.clean_system "bundle install --quiet"
68
+ Bundler.unbundled_system "bundle install --quiet"
61
69
  end
62
70
  end
63
71
 
@@ -1,5 +1,6 @@
1
1
  require 'yaml'
2
2
  require 'erb'
3
+ require 'shellwords'
3
4
 
4
5
  module EngineCart
5
6
  class Configuration
@@ -86,10 +87,11 @@ module EngineCart
86
87
  # Split a string of options into individual options.
87
88
  # @example
88
89
  # parse_options('--skip-foo --skip-bar -d postgres --skip-lala')
89
- # # => ["--skip-foo", "--skip-bar", "-d postgres", "--skip-lala"]
90
+ # # => ["--skip-foo", "--skip-bar", "-d", "postgres", "--skip-lala"]
90
91
  def parse_options(options)
91
92
  return if options.nil?
92
- options.scan(/(--[^\s]+|-[^\s]+\s+[^\s]+)/).flatten
93
+
94
+ Shellwords.shellwords(options)
93
95
  end
94
96
 
95
97
  def read_config(config_file)
@@ -27,6 +27,8 @@ namespace :engine_cart do
27
27
  task :create_test_rails_app => [:setup] do
28
28
  require 'tmpdir'
29
29
  require 'fileutils'
30
+ require 'rails/version'
31
+
30
32
  Dir.mktmpdir do |dir|
31
33
  # Fork into a new process to avoid polluting the current one with the partial Rails environment ...
32
34
  pid = fork do
@@ -66,7 +68,7 @@ namespace :engine_cart do
66
68
  Rake::Task['engine_cart:clean'].invoke if File.exist? EngineCart.destination
67
69
  FileUtils.move "#{dir}/internal", "#{EngineCart.destination}"
68
70
 
69
- if Gem.loaded_specs['rails'].version.to_s < '5.2.3'
71
+ if Rails.version < '5.2.3'
70
72
  # Hack for https://github.com/rails/rails/issues/35153
71
73
  gemfile = File.join(EngineCart.destination, 'Gemfile')
72
74
  IO.write(gemfile, File.open(gemfile) do |f|
@@ -74,6 +76,15 @@ namespace :engine_cart do
74
76
  text.gsub(/^gem ["']sqlite3["']$/, 'gem "sqlite3", "~> 1.3.0"')
75
77
  end)
76
78
  end
79
+
80
+ if RUBY_VERSION < '3.0'
81
+ # Hack for https://github.com/cbeer/engine_cart/issues/125
82
+ gemfile = File.join(EngineCart.destination, 'Gemfile')
83
+ IO.write(gemfile, File.open(gemfile) do |f|
84
+ text = f.read
85
+ text.gsub(/^gem ["']sqlite3["']$/, 'gem "sqlite3", "< 1.7"')
86
+ end)
87
+ end
77
88
  end
78
89
  end
79
90
 
@@ -106,18 +117,19 @@ namespace :engine_cart do
106
117
 
107
118
  # Copy our test app generators into the app and prepare it
108
119
  if File.exist? "#{EngineCart.templates_path}/lib/generators"
109
- Bundler.clean_system "cp -r #{EngineCart.templates_path}/lib/generators #{EngineCart.destination}/lib"
120
+ Bundler.unbundled_system "cp -r #{EngineCart.templates_path}/lib/generators #{EngineCart.destination}/lib"
110
121
  end
111
122
 
112
123
  within_test_app do
113
124
  unless (system("bundle install --quiet") or system("bundle update --quiet")) and
114
- system "(bundle exec rails g | grep test_app) && bundle exec rails generate test_app" and
115
- system "bundle exec rake db:migrate db:test:prepare"
125
+ system "(bin/rails g | grep test_app) && bin/rails generate test_app" and
126
+ system "bin/rails db:migrate" and
127
+ system "bin/rails db:test:prepare"
116
128
  raise "EngineCart failed on with: #{$?}"
117
129
  end
118
130
  end
119
131
 
120
- Bundler.clean_system "bundle install --quiet"
132
+ Bundler.unbundled_system "bundle install --quiet"
121
133
 
122
134
  EngineCart.write_fingerprint
123
135
 
@@ -128,14 +140,14 @@ namespace :engine_cart do
128
140
  desc 'Start the internal test application using `rails server`'
129
141
  task :server, [:rails_server_args] => [:generate] do |_, args|
130
142
  within_test_app do
131
- system "bundle exec rails server #{args[:rails_server_args]}"
143
+ system "bin/rails server #{args[:rails_server_args]}"
132
144
  end
133
145
  end
134
146
 
135
147
  desc 'Start the internal test application using `rails console`'
136
148
  task :console, [:rails_console_args] => [:generate] do |_, args|
137
149
  within_test_app do
138
- system "bundle exec rails console #{args[:rails_console_args]}"
150
+ system "bin/rails console #{args[:rails_console_args]}"
139
151
  end
140
152
  end
141
153
  end
@@ -143,7 +155,7 @@ end
143
155
  def within_test_app
144
156
  puts "\rtravis_fold:start:enginecart-bundler-cleanenv\r" if ENV['TRAVIS'] == 'true'
145
157
  Dir.chdir(EngineCart.destination) do
146
- Bundler.with_clean_env do
158
+ EngineCart.with_unbundled_env do
147
159
  yield
148
160
  end
149
161
  end
@@ -1,3 +1,3 @@
1
1
  module EngineCart
2
- VERSION = '2.4.0'
2
+ VERSION = '2.6.0'
3
3
  end
data/lib/engine_cart.rb CHANGED
@@ -12,9 +12,21 @@ module EngineCart
12
12
  require File.expand_path("config/environment", path || EngineCart.destination)
13
13
  end
14
14
 
15
+ def self.with_unbundled_env
16
+ method = if Bundler.respond_to?(:with_unbundled_env)
17
+ :with_unbundled_env
18
+ else
19
+ :with_clean_env
20
+ end
21
+
22
+ Bundler.public_send(method) do
23
+ yield
24
+ end
25
+ end
26
+
15
27
  def self.within_test_app
16
28
  Dir.chdir(EngineCart.destination) do
17
- Bundler.with_clean_env do
29
+ EngineCart.with_unbundled_env do
18
30
  yield
19
31
  end
20
32
  end
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.0
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Beer
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-26 00:00:00.000000000 Z
11
+ date: 2024-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -81,7 +81,7 @@ homepage: https://github.com/cbeer/engine_cart
81
81
  licenses:
82
82
  - MIT
83
83
  metadata: {}
84
- post_install_message:
84
+ post_install_message:
85
85
  rdoc_options: []
86
86
  require_paths:
87
87
  - lib
@@ -96,8 +96,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
98
  requirements: []
99
- rubygems_version: 3.1.4
100
- signing_key:
99
+ rubygems_version: 3.4.20
100
+ signing_key:
101
101
  specification_version: 4
102
102
  summary: Helper for testing Rails Engines sanely
103
103
  test_files: