solidus_dev_support 1.1.0 → 1.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 +4 -4
- data/.circleci/config.yml +7 -16
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -1
- data/.github_changelog_generator +4 -0
- data/.mergify.yml +39 -0
- data/.rubocop.yml +42 -0
- data/CHANGELOG.md +74 -5
- data/Gemfile +1 -1
- data/OLD_CHANGELOG.md +200 -0
- data/README.md +13 -6
- data/Rakefile +11 -1
- data/lib/solidus_dev_support/extension.rb +1 -1
- data/lib/solidus_dev_support/rake_tasks.rb +12 -0
- data/lib/solidus_dev_support/rspec/feature_helper.rb +18 -9
- data/lib/solidus_dev_support/rspec/rails_helper.rb +28 -0
- data/lib/solidus_dev_support/rubocop/config.yml +82 -202
- data/lib/solidus_dev_support/solidus_command.rb +0 -1
- data/lib/solidus_dev_support/templates/extension/.circleci/config.yml +6 -0
- data/lib/solidus_dev_support/templates/extension/README.md +43 -22
- data/lib/solidus_dev_support/templates/extension/bin/rails +7 -0
- data/lib/solidus_dev_support/templates/extension/bin/{r.tt → rails-engine.tt} +0 -0
- data/lib/solidus_dev_support/templates/extension/bin/{sandbox_rails → rails-sandbox} +1 -3
- data/lib/solidus_dev_support/templates/extension/bin/sandbox.tt +3 -0
- data/lib/solidus_dev_support/templates/extension/extension.gemspec.tt +2 -2
- data/lib/solidus_dev_support/templates/extension/gitignore +3 -0
- data/lib/solidus_dev_support/templates/extension/lib/%file_name%/engine.rb.tt +1 -1
- data/lib/solidus_dev_support/templates/extension/lib/generators/%file_name%/install/install_generator.rb.tt +5 -5
- data/lib/solidus_dev_support/templates/extension/rubocop.yml +0 -5
- data/lib/solidus_dev_support/templates/extension/spec/spec_helper.rb.tt +9 -2
- data/lib/solidus_dev_support/version.rb +1 -1
- data/solidus_dev_support.gemspec +14 -12
- data/spec/features/create_extension_spec.rb +166 -0
- data/spec/lib/extension_spec.rb +33 -0
- data/spec/spec_helper.rb +16 -0
- metadata +37 -27
- data/.github/stale.yml +0 -17
@@ -16,12 +16,18 @@ jobs:
|
|
16
16
|
executor: solidusio_extensions/mysql
|
17
17
|
steps:
|
18
18
|
- solidusio_extensions/run-tests
|
19
|
+
lint-code:
|
20
|
+
executor: solidusio_extensions/sqlite-memory
|
21
|
+
steps:
|
22
|
+
- solidusio_extensions/lint-code
|
19
23
|
|
20
24
|
workflows:
|
21
25
|
"Run specs on supported Solidus versions":
|
22
26
|
jobs:
|
23
27
|
- run-specs-with-postgres
|
24
28
|
- run-specs-with-mysql
|
29
|
+
- lint-code
|
30
|
+
|
25
31
|
"Weekly run specs against master":
|
26
32
|
triggers:
|
27
33
|
- schedule:
|
@@ -1,10 +1,15 @@
|
|
1
|
-
<%= class_name %>
|
2
|
-
<%= "=" * class_name.size %>
|
1
|
+
# <%= class_name.gsub(/(?<=[^A-Z])([A-Z])/, ' \1') %>
|
3
2
|
|
4
|
-
|
3
|
+
<!-- Replace REPO_ORG and uncomment the following to show badges for CI and coverage. -->
|
5
4
|
|
6
|
-
|
7
|
-
|
5
|
+
<!--
|
6
|
+
[](https://circleci.com/gh/REPO_ORG/<%= file_name %>)
|
7
|
+
[](https://codecov.io/gh/REPO_ORG/<%= file_name %>)
|
8
|
+
-->
|
9
|
+
|
10
|
+
[Explain what your extension does.]
|
11
|
+
|
12
|
+
## Installation
|
8
13
|
|
9
14
|
Add <%= file_name %> to your Gemfile:
|
10
15
|
|
@@ -15,17 +20,22 @@ gem '<%= file_name %>'
|
|
15
20
|
Bundle your dependencies and run the installation generator:
|
16
21
|
|
17
22
|
```shell
|
18
|
-
|
19
|
-
bundle exec rails g <%= file_name %>:install
|
23
|
+
bin/rails generate <%= file_name %>:install
|
20
24
|
```
|
21
25
|
|
22
|
-
|
23
|
-
|
26
|
+
## Usage
|
27
|
+
|
28
|
+
[Explain how to use your extension once it's been installed.]
|
29
|
+
|
30
|
+
## Development
|
24
31
|
|
25
|
-
|
32
|
+
### Testing the extension
|
33
|
+
|
34
|
+
First bundle your dependencies, then run `bin/rake`. `bin/rake` will default to building the dummy
|
35
|
+
app if it does not exist, then it will run specs. The dummy app can be regenerated by using
|
36
|
+
`bin/rake extension:test_app`.
|
26
37
|
|
27
38
|
```shell
|
28
|
-
bundle
|
29
39
|
bin/rake
|
30
40
|
```
|
31
41
|
|
@@ -42,16 +52,15 @@ Simply add this require statement to your spec_helper:
|
|
42
52
|
require '<%= file_name %>/factories'
|
43
53
|
```
|
44
54
|
|
45
|
-
|
46
|
-
-----------
|
55
|
+
### Running the sandbox
|
47
56
|
|
48
|
-
To run this extension in a sandboxed Solidus application you can run `bin/sandbox
|
49
|
-
|
50
|
-
|
57
|
+
To run this extension in a sandboxed Solidus application, you can run `bin/sandbox`. The path for
|
58
|
+
the sandbox app is `./sandbox` and `bin/rails` will forward any Rails commands to
|
59
|
+
`sandbox/bin/rails`.
|
51
60
|
|
52
|
-
|
61
|
+
Here's an example:
|
53
62
|
|
54
|
-
```
|
63
|
+
```
|
55
64
|
$ bin/rails server
|
56
65
|
=> Booting Puma
|
57
66
|
=> Rails 6.0.2.1 application starting in development
|
@@ -59,13 +68,25 @@ $ bin/rails server
|
|
59
68
|
Use Ctrl-C to stop
|
60
69
|
```
|
61
70
|
|
62
|
-
|
63
|
-
|
71
|
+
### Updating the changelog
|
72
|
+
|
73
|
+
Before and after releases the changelog should be updated to reflect the up-to-date status of
|
74
|
+
the project:
|
75
|
+
|
76
|
+
```shell
|
77
|
+
bin/rake changelog
|
78
|
+
git add CHANGELOG.md
|
79
|
+
git commit -m "Update the changelog"
|
80
|
+
```
|
81
|
+
|
82
|
+
### Releasing new versions
|
64
83
|
|
65
84
|
Your new extension version can be released using `gem-release` like this:
|
66
85
|
|
67
86
|
```shell
|
68
|
-
bundle exec gem bump -v VERSION --tag --push --remote
|
87
|
+
bundle exec gem bump -v VERSION --tag --push --remote origin && gem release
|
69
88
|
```
|
70
89
|
|
71
|
-
|
90
|
+
## License
|
91
|
+
|
92
|
+
Copyright (c) <%= Time.now.year %> [name of extension author], released under the New BSD License.
|
File without changes
|
@@ -1,13 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
# frozen_string_literal: true
|
4
|
-
|
5
3
|
app_root = 'sandbox'
|
6
4
|
|
7
5
|
unless File.exist? "#{app_root}/bin/rails"
|
8
6
|
warn 'Creating the sandbox app...'
|
9
7
|
Dir.chdir "#{__dir__}/.." do
|
10
|
-
system "#{__dir__}/sandbox" or begin
|
8
|
+
system "#{__dir__}/sandbox" or begin
|
11
9
|
warn 'Automatic creation of the sandbox app failed'
|
12
10
|
exit 1
|
13
11
|
end
|
@@ -71,9 +71,12 @@ unbundled bundle exec rails generate spree:install \
|
|
71
71
|
--auto-accept \
|
72
72
|
--user_class=Spree::User \
|
73
73
|
--enforce_available_locales=true \
|
74
|
+
--with-authentication=false \
|
75
|
+
--payment-method=none
|
74
76
|
$@
|
75
77
|
|
76
78
|
unbundled bundle exec rails generate solidus:auth:install
|
79
|
+
unbundled bundle exec rails generate ${extension_name}:install
|
77
80
|
|
78
81
|
echo
|
79
82
|
echo "🚀 Sandbox app successfully created for $extension_name!"
|
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.metadata['source_code_uri'] = '<%= gemspec.homepage %>'
|
18
18
|
spec.metadata['changelog_uri'] = '<%= gemspec.metadata["changelog_uri"] %>'
|
19
19
|
|
20
|
-
spec.required_ruby_version = Gem::Requirement.new('~> 2.
|
20
|
+
spec.required_ruby_version = Gem::Requirement.new('~> 2.5')
|
21
21
|
|
22
22
|
# Specify which files should be added to the gem when it is released.
|
23
23
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.require_paths = ["lib"]
|
31
31
|
|
32
32
|
spec.add_dependency 'solidus_core', ['>= 2.0.0', '< 3']
|
33
|
-
spec.add_dependency 'solidus_support', '~> 0.
|
33
|
+
spec.add_dependency 'solidus_support', '~> 0.5'
|
34
34
|
|
35
35
|
spec.add_development_dependency 'solidus_dev_support'
|
36
36
|
end
|
@@ -6,13 +6,13 @@ module <%= class_name %>
|
|
6
6
|
class_option :auto_run_migrations, type: :boolean, default: false
|
7
7
|
|
8
8
|
def add_javascripts
|
9
|
-
append_file 'vendor/assets/javascripts/spree/frontend/all.js', "//= require spree/frontend/<%= file_name %>\n"
|
10
|
-
append_file 'vendor/assets/javascripts/spree/backend/all.js', "//= require spree/backend/<%= file_name %>\n"
|
9
|
+
append_file 'vendor/assets/javascripts/spree/frontend/all.js', "//= require spree/frontend/<%= file_name %>\n"
|
10
|
+
append_file 'vendor/assets/javascripts/spree/backend/all.js', "//= require spree/backend/<%= file_name %>\n"
|
11
11
|
end
|
12
12
|
|
13
13
|
def add_stylesheets
|
14
|
-
inject_into_file 'vendor/assets/stylesheets/spree/frontend/all.css', " *= require spree/frontend/<%= file_name %>\n", before: %r{\*/}, verbose: true # rubocop:disable
|
15
|
-
inject_into_file 'vendor/assets/stylesheets/spree/backend/all.css', " *= require spree/backend/<%= file_name %>\n", before: %r{\*/}, verbose: true # rubocop:disable
|
14
|
+
inject_into_file 'vendor/assets/stylesheets/spree/frontend/all.css', " *= require spree/frontend/<%= file_name %>\n", before: %r{\*/}, verbose: true # rubocop:disable Layout/LineLength
|
15
|
+
inject_into_file 'vendor/assets/stylesheets/spree/backend/all.css', " *= require spree/backend/<%= file_name %>\n", before: %r{\*/}, verbose: true # rubocop:disable Layout/LineLength
|
16
16
|
end
|
17
17
|
|
18
18
|
def add_migrations
|
@@ -20,7 +20,7 @@ module <%= class_name %>
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def run_migrations
|
23
|
-
run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask('Would you like to run the migrations now? [Y/n]')) # rubocop:disable
|
23
|
+
run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask('Would you like to run the migrations now? [Y/n]')) # rubocop:disable Layout/LineLength
|
24
24
|
if run_migrations
|
25
25
|
run 'bin/rails db:migrate'
|
26
26
|
else
|
@@ -6,14 +6,17 @@ ENV['RAILS_ENV'] = 'test'
|
|
6
6
|
# Run Coverage report
|
7
7
|
require 'solidus_dev_support/rspec/coverage'
|
8
8
|
|
9
|
-
|
9
|
+
# Create the dummy app if it's still missing.
|
10
|
+
dummy_env = "#{__dir__}/dummy/config/environment.rb"
|
11
|
+
system 'bin/rake extension:test_app' unless File.exist? dummy_env
|
12
|
+
require dummy_env
|
10
13
|
|
11
14
|
# Requires factories and other useful helpers defined in spree_core.
|
12
15
|
require 'solidus_dev_support/rspec/feature_helper'
|
13
16
|
|
14
17
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
15
18
|
# in spec/support/ and its subdirectories.
|
16
|
-
Dir[
|
19
|
+
Dir["#{__dir__}/support/**/*.rb"].sort.each { |f| require f }
|
17
20
|
|
18
21
|
# Requires factories defined in lib/<%= file_name %>/factories.rb
|
19
22
|
require '<%= file_name %>/factories'
|
@@ -21,4 +24,8 @@ require '<%= file_name %>/factories'
|
|
21
24
|
RSpec.configure do |config|
|
22
25
|
config.infer_spec_type_from_file_location!
|
23
26
|
config.use_transactional_fixtures = false
|
27
|
+
|
28
|
+
if Spree.solidus_gem_version < Gem::Version.new('2.11')
|
29
|
+
config.extend Spree::TestingSupport::AuthorizationHelpers::Request, type: :system
|
30
|
+
end
|
24
31
|
end
|
data/solidus_dev_support.gemspec
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
require 'solidus_dev_support/version'
|
3
|
+
require_relative 'lib/solidus_dev_support/version'
|
6
4
|
|
7
5
|
Gem::Specification.new do |spec|
|
8
6
|
spec.name = 'solidus_dev_support'
|
@@ -16,29 +14,33 @@ Gem::Specification.new do |spec|
|
|
16
14
|
|
17
15
|
spec.metadata['homepage_uri'] = spec.homepage
|
18
16
|
spec.metadata['source_code_uri'] = 'https://github.com/solidusio/solidus_dev_support'
|
17
|
+
spec.metadata['changelog_uri'] = 'https://github.com/solidusio/solidus_dev_support/blob/master/CHANGELOG.md'
|
18
|
+
|
19
|
+
spec.required_ruby_version = Gem::Requirement.new('~> 2.5')
|
19
20
|
|
20
21
|
# Specify which files should be added to the gem when it is released.
|
21
22
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
spec.
|
26
|
-
spec.
|
27
|
-
spec.
|
23
|
+
files = Dir.chdir(__dir__) { `git ls-files -z`.split("\x0") }
|
24
|
+
|
25
|
+
spec.files = files.grep_v(%r{^(test|spec|features)/})
|
26
|
+
spec.test_files = files.grep(%r{^(test|spec|features)/})
|
27
|
+
spec.bindir = "exe"
|
28
|
+
spec.executables = files.grep(%r{^exe/}) { |f| File.basename(f) }
|
29
|
+
spec.require_paths = ["lib"]
|
28
30
|
|
29
31
|
spec.add_dependency 'apparition', '~> 0.4'
|
30
32
|
spec.add_dependency 'capybara', '~> 3.29'
|
31
33
|
spec.add_dependency 'capybara-screenshot', '~> 1.0'
|
32
|
-
spec.add_dependency 'codecov', '~> 0.
|
34
|
+
spec.add_dependency 'codecov', '~> 0.2'
|
33
35
|
spec.add_dependency 'database_cleaner', '~> 1.7'
|
34
36
|
spec.add_dependency 'factory_bot_rails', '~> 5.1'
|
35
37
|
spec.add_dependency 'ffaker', '~> 2.13'
|
36
38
|
spec.add_dependency 'gem-release', '~> 2.1'
|
37
39
|
spec.add_dependency 'github_changelog_generator', '~> 1.15'
|
38
40
|
spec.add_dependency 'puma', '~> 4.3'
|
39
|
-
spec.add_dependency 'rspec-rails', '~> 4.0.0.beta3'
|
40
41
|
spec.add_dependency 'rspec_junit_formatter'
|
41
|
-
spec.add_dependency '
|
42
|
+
spec.add_dependency 'rspec-rails', '~> 4.0.0.beta3'
|
43
|
+
spec.add_dependency 'rubocop', '~> 0.87.1'
|
42
44
|
spec.add_dependency 'rubocop-performance', '~> 1.5'
|
43
45
|
spec.add_dependency 'rubocop-rails', '~> 2.3'
|
44
46
|
spec.add_dependency 'rubocop-rspec', '~> 1.36'
|
@@ -0,0 +1,166 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'fileutils'
|
4
|
+
require 'open3'
|
5
|
+
require 'spec_helper'
|
6
|
+
|
7
|
+
RSpec.describe 'Create extension' do
|
8
|
+
include FileUtils
|
9
|
+
|
10
|
+
let(:gem_root) { File.expand_path('../..', __dir__) }
|
11
|
+
let(:solidus_cmd) { "#{gem_root}/exe/solidus" }
|
12
|
+
let(:extension_name) { 'test_extension' }
|
13
|
+
let(:gemspec_name) { "solidus_#{extension_name}.gemspec" }
|
14
|
+
let(:tmp_path) { Pathname.new(gem_root).join('tmp') }
|
15
|
+
let(:install_path) { tmp_path.join("solidus_#{extension_name}") }
|
16
|
+
|
17
|
+
class CommandFailed < StandardError; end
|
18
|
+
|
19
|
+
before do
|
20
|
+
rm_rf(install_path)
|
21
|
+
mkdir_p(tmp_path)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'checks the create extension process' do
|
25
|
+
check_solidus_cmd
|
26
|
+
check_create_extension
|
27
|
+
check_bundle_install
|
28
|
+
check_default_task
|
29
|
+
check_run_specs
|
30
|
+
check_sandbox
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def check_solidus_cmd
|
36
|
+
cd(tmp_path) do
|
37
|
+
output = `#{solidus_cmd} -h`
|
38
|
+
expect($?).to be_success
|
39
|
+
expect(output).to include('Commands:')
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def check_create_extension
|
44
|
+
cd(tmp_path) do
|
45
|
+
output = `#{solidus_cmd} extension #{extension_name}`
|
46
|
+
expect($?).to be_success
|
47
|
+
expect(output).to include(gemspec_name)
|
48
|
+
expect(output).to include('.circleci')
|
49
|
+
end
|
50
|
+
|
51
|
+
cd(install_path) do
|
52
|
+
aggregate_failures do
|
53
|
+
%w[
|
54
|
+
bin/console
|
55
|
+
bin/rails
|
56
|
+
bin/rails-engine
|
57
|
+
bin/rails-sandbox
|
58
|
+
bin/sandbox
|
59
|
+
bin/setup
|
60
|
+
].each do |bin|
|
61
|
+
bin = Pathname(bin)
|
62
|
+
expect(
|
63
|
+
name: bin,
|
64
|
+
exist: bin.exist?,
|
65
|
+
executable: bin.stat.executable?
|
66
|
+
).to eq(
|
67
|
+
name: bin,
|
68
|
+
exist: true,
|
69
|
+
executable: true
|
70
|
+
)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def check_bundle_install
|
77
|
+
cd(install_path) do
|
78
|
+
open('Gemfile', 'a') { |f| f.puts "gem 'solidus_dev_support', path: '../../..'" }
|
79
|
+
end
|
80
|
+
|
81
|
+
expect { bundle_install }.to raise_error(CommandFailed, /invalid gemspec/)
|
82
|
+
|
83
|
+
# Update gemspec with the required fields
|
84
|
+
gemspec_path = install_path.join(gemspec_name)
|
85
|
+
gemspec = gemspec_path.read.lines
|
86
|
+
gemspec.grep(/spec\.author/).first.replace(" spec.author = 'John Doe'\n")
|
87
|
+
gemspec.grep(/spec\.email/).first.replace(" spec.email = 'john@example.com'\n")
|
88
|
+
gemspec.grep(/spec\.summary/).first.replace(" spec.summary = 'A nice extension'\n")
|
89
|
+
gemspec.grep(/spec\.description/).first.replace(" spec.description = 'A super nice extension'\n")
|
90
|
+
gemspec_path.write(gemspec.join)
|
91
|
+
|
92
|
+
expect(bundle_install).to match(/Bundle complete/)
|
93
|
+
end
|
94
|
+
|
95
|
+
def check_default_task
|
96
|
+
cd(install_path) do
|
97
|
+
output = sh('bin/rake')
|
98
|
+
expect(output).to include('Generating dummy Rails application')
|
99
|
+
expect(output).to include('0 examples, 0 failures')
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def check_run_specs
|
104
|
+
install_path.join('spec', 'some_spec.rb').write(
|
105
|
+
"require 'spec_helper'\nRSpec.describe 'Some test' do it { expect(true).to be_truthy } end\n"
|
106
|
+
)
|
107
|
+
cd(install_path) do
|
108
|
+
output = sh('bundle exec rspec')
|
109
|
+
expect(output).to include('1 example, 0 failures')
|
110
|
+
expect(output).to include(ENV['CODECOV_TOKEN'] ? 'Coverage reports upload successfully' : 'Provide a CODECOV_TOKEN environment variable to enable Codecov uploads')
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
def check_sandbox
|
115
|
+
cd(install_path) do
|
116
|
+
# rubocop:disable Lint/InterpolationCheck
|
117
|
+
command = 'bin/rails-sandbox runner "puts %{The version of SolidusTestExtension is #{SolidusTestExtension::VERSION}}"'
|
118
|
+
# rubocop:enable Lint/InterpolationCheck
|
119
|
+
|
120
|
+
first_run_output = sh(command)
|
121
|
+
expect(first_run_output).to include("Creating the sandbox app...")
|
122
|
+
expect(first_run_output).to include('The version of SolidusTestExtension is 0.0.1')
|
123
|
+
|
124
|
+
second_run_output = sh(command)
|
125
|
+
expect(second_run_output).not_to include("Creating the sandbox app...")
|
126
|
+
expect(second_run_output).to include('The version of SolidusTestExtension is 0.0.1')
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
def sh(*args)
|
131
|
+
command = args.size == 1 ? args.first : args.shelljoin
|
132
|
+
output, status = with_unbundled_env { Open3.capture2e(command) }
|
133
|
+
|
134
|
+
if status.success?
|
135
|
+
output.to_s
|
136
|
+
else
|
137
|
+
if $DEBUG
|
138
|
+
warn '~' * 80
|
139
|
+
warn "$ #{command}"
|
140
|
+
warn output.to_s
|
141
|
+
end
|
142
|
+
raise(CommandFailed, "command failed: #{command}\n#{output}")
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
def with_unbundled_env(&block)
|
147
|
+
if Bundler.respond_to?(:with_unbundled_env)
|
148
|
+
Bundler.with_unbundled_env(&block)
|
149
|
+
else
|
150
|
+
Bundler.with_clean_env(&block)
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
def bundle_install
|
155
|
+
# Optimize the bundle path within the CI, in this context using bundler env
|
156
|
+
# variables doesn't help because commands are run with a clean env.
|
157
|
+
bundle_path = "#{gem_root}/vendor/bundle"
|
158
|
+
|
159
|
+
command = 'bundle install'
|
160
|
+
command += " --path=#{bundle_path.shellescape}" if File.exist?(bundle_path)
|
161
|
+
|
162
|
+
output = nil
|
163
|
+
cd(install_path) { output = sh command }
|
164
|
+
output
|
165
|
+
end
|
166
|
+
end
|