engine_cart 2.5.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: db419965be01fa06326e357013ea09c444dec04e71428a38ee9eaa24cc79426f
4
- data.tar.gz: ee7b17829334ddeeb2e1b48c4557cce763b0bb7b12cd436713f6ddca97680fe1
3
+ metadata.gz: 864ca4cc0c524ad80281f92e1dce77df32cb2a2c4b6f27d293721ee8e9305412
4
+ data.tar.gz: 5c8ec70e88e2a6efd9d919c04c56be20509afebacce106118d3061de56a40cfc
5
5
  SHA512:
6
- metadata.gz: 817da9a19e20ed5ad760a3c7e3ad0b10ac484c341d8823487aae83c2a049d437de97134d7d966e9fae239f5d1faf57e1c2e7cf541c73c97498922ef6a07a8e62
7
- data.tar.gz: 8c520fea25e5ce140ce9e53c6ad5ec6015a679b783272383dbe9785c969dec91db194c592fed72d7c062a01b3649470edfd8fbeefdef6334c75fd39f02380b6b
6
+ metadata.gz: 324a7c844887c7f43923d6d8dadd72f599567158ad6bd8876496865700239be2a28a0314feef816e7ce2b8cb5dff405b4d6bc3ec93d8912ac8e7bb13554e56b1
7
+ data.tar.gz: f377f63b4585553142802de3451eaaa4882de55bd821976e45c892e820d43bb708ef9c6afba7d166a883d8150be6d03bfdaec62aa93614d9a21ce521eb8e7d10
@@ -12,18 +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.8.1
18
- - 6.0.5.1
19
17
  - 6.1.6.1
20
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'
21
28
  steps:
22
29
  - uses: actions/checkout@v2
23
30
  - name: Set up Ruby
24
31
  uses: ruby/setup-ruby@v1
25
32
  with:
26
33
  ruby-version: ${{ matrix.ruby }}
34
+ bundler: 'latest'
27
35
  - name: Install dependencies
28
36
  run: bundle install
29
37
  env:
data/Rakefile CHANGED
@@ -57,12 +57,15 @@ task :generate_test_gem => ['engine_cart:setup'] do
57
57
  end
58
58
 
59
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
60
63
 
61
- Bundler.clean_system "bundle update --quiet"
64
+ Bundler.unbundled_system "bundle update --quiet"
62
65
  system "echo 'require \"engine_cart/rake_task\"\n' >> Rakefile"
63
66
 
64
67
  system("bundle exec rake engine_cart:prepare")
65
- Bundler.clean_system "bundle install --quiet"
68
+ Bundler.unbundled_system "bundle install --quiet"
66
69
  end
67
70
  end
68
71
 
@@ -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,19 +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" and
116
- system "bundle exec rake 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"
117
128
  raise "EngineCart failed on with: #{$?}"
118
129
  end
119
130
  end
120
131
 
121
- Bundler.clean_system "bundle install --quiet"
132
+ Bundler.unbundled_system "bundle install --quiet"
122
133
 
123
134
  EngineCart.write_fingerprint
124
135
 
@@ -129,14 +140,14 @@ namespace :engine_cart do
129
140
  desc 'Start the internal test application using `rails server`'
130
141
  task :server, [:rails_server_args] => [:generate] do |_, args|
131
142
  within_test_app do
132
- system "bundle exec rails server #{args[:rails_server_args]}"
143
+ system "bin/rails server #{args[:rails_server_args]}"
133
144
  end
134
145
  end
135
146
 
136
147
  desc 'Start the internal test application using `rails console`'
137
148
  task :console, [:rails_console_args] => [:generate] do |_, args|
138
149
  within_test_app do
139
- system "bundle exec rails console #{args[:rails_console_args]}"
150
+ system "bin/rails console #{args[:rails_console_args]}"
140
151
  end
141
152
  end
142
153
  end
@@ -144,7 +155,7 @@ end
144
155
  def within_test_app
145
156
  puts "\rtravis_fold:start:enginecart-bundler-cleanenv\r" if ENV['TRAVIS'] == 'true'
146
157
  Dir.chdir(EngineCart.destination) do
147
- Bundler.with_clean_env do
158
+ EngineCart.with_unbundled_env do
148
159
  yield
149
160
  end
150
161
  end
@@ -1,3 +1,3 @@
1
1
  module EngineCart
2
- VERSION = '2.5.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.5.0
4
+ version: 2.6.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: 2022-07-27 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
@@ -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.3.7
99
+ rubygems_version: 3.4.20
100
100
  signing_key:
101
101
  specification_version: 4
102
102
  summary: Helper for testing Rails Engines sanely