appbundler 0.12.3 → 0.13.4
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/Gemfile +25 -1
- data/{LICENSE.txt → LICENSE} +0 -0
- data/Rakefile +40 -0
- data/appbundler.gemspec +2 -6
- data/lib/appbundler/app.rb +59 -48
- data/lib/appbundler/cli.rb +30 -36
- data/lib/appbundler/version.rb +1 -1
- data/spec/appbundler/app_spec.rb +171 -146
- data/spec/fixtures/appbundler-example-app/lib/example_app.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +5 -66
- data/.expeditor/config.yml +0 -44
- data/.expeditor/update_version.sh +0 -12
- data/.github/CODEOWNERS +0 -7
- data/.github/ISSUE_TEMPLATE/BUG_TEMPLATE.md +0 -29
- data/.github/ISSUE_TEMPLATE/DESIGN_PROPOSAL.md +0 -40
- data/.github/ISSUE_TEMPLATE/ENHANCEMENT_REQUEST_TEMPLATE.md +0 -17
- data/.github/ISSUE_TEMPLATE/SUPPORT_QUESTION.md +0 -12
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -15
- data/.github/lock.yml +0 -1
- data/.gitignore +0 -19
- data/.rspec +0 -2
- data/.travis.yml +0 -23
- data/CHANGELOG.md +0 -36
- data/CODE_OF_CONDUCT.md +0 -1
- data/CONTRIBUTING.md +0 -1
- data/README.md +0 -204
- data/VERSION +0 -1
- data/spec/fixtures/appbundler-example-app/.bundle/config +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b358a8a633dd6341cf56809d02b4c99ca7d78db88813e36ab385d24f861be8e0
|
4
|
+
data.tar.gz: 842dec2877ea932c7da9c5c849abb822f33a9eba10049a11d2089db42d3239ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a80ca5d2b58325a163f433b70b71ce81f3008513ce72faa6956ab1c32783bfddc377e9fedc9644dcc0392723b264697392d48cb072404d8ff3257fd0ff2c45fd
|
7
|
+
data.tar.gz: 4cf2163f2b0aaefbb5495c08d90da311c39dcb29216fc7ac1eb0f7e0f66595d3145a21f40abb9a968091731c27ca09c0f893e13b5cb787da7b69b7e31dafa547
|
data/Gemfile
CHANGED
@@ -1,4 +1,28 @@
|
|
1
1
|
source "https://rubygems.org"
|
2
2
|
|
3
|
-
# Specify your gem's dependencies in appbundler.gemspec
|
4
3
|
gemspec
|
4
|
+
|
5
|
+
group :docs do
|
6
|
+
gem "yard"
|
7
|
+
gem "redcarpet"
|
8
|
+
gem "github-markup"
|
9
|
+
end
|
10
|
+
|
11
|
+
group :test do
|
12
|
+
gem "chefstyle"
|
13
|
+
gem "rspec", "~> 3.0"
|
14
|
+
gem "rake"
|
15
|
+
end
|
16
|
+
|
17
|
+
group :debug do
|
18
|
+
gem "pry"
|
19
|
+
gem "pry-byebug"
|
20
|
+
gem "pry-stack_explorer"
|
21
|
+
gem "rb-readline"
|
22
|
+
end
|
23
|
+
|
24
|
+
instance_eval(ENV["GEMFILE_MOD"]) if ENV["GEMFILE_MOD"]
|
25
|
+
|
26
|
+
# If you want to load debugging tools into the bundle exec sandbox,
|
27
|
+
# add these additional dependencies into Gemfile.local
|
28
|
+
eval_gemfile(__FILE__ + ".local") if File.exist?(__FILE__ + ".local")
|
data/{LICENSE.txt → LICENSE}
RENAMED
File without changes
|
data/Rakefile
CHANGED
@@ -1 +1,41 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
|
+
|
3
|
+
begin
|
4
|
+
require "rspec/core/rake_task"
|
5
|
+
RSpec::Core::RakeTask.new do |t|
|
6
|
+
t.pattern = "spec/**/*_spec.rb"
|
7
|
+
end
|
8
|
+
rescue LoadError
|
9
|
+
desc "rspec is not installed, this task is disabled"
|
10
|
+
task :spec do
|
11
|
+
abort "rspec is not installed. bundle install first to make sure all dependencies are installed."
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
begin
|
16
|
+
require "chefstyle"
|
17
|
+
require "rubocop/rake_task"
|
18
|
+
desc "Run Chefstyle tests"
|
19
|
+
RuboCop::RakeTask.new(:style) do |task|
|
20
|
+
task.options += ["--display-cop-names", "--no-color"]
|
21
|
+
end
|
22
|
+
rescue LoadError
|
23
|
+
puts "chefstyle gem is not installed. bundle install first to make sure all dependencies are installed."
|
24
|
+
end
|
25
|
+
|
26
|
+
begin
|
27
|
+
require "yard"
|
28
|
+
YARD::Rake::YardocTask.new(:docs)
|
29
|
+
rescue LoadError
|
30
|
+
puts "yard is not available. bundle install first to make sure all dependencies are installed."
|
31
|
+
end
|
32
|
+
|
33
|
+
task :console do
|
34
|
+
require "irb"
|
35
|
+
require "irb/completion"
|
36
|
+
require "appbundler"
|
37
|
+
ARGV.clear
|
38
|
+
IRB.start
|
39
|
+
end
|
40
|
+
|
41
|
+
task default: [:spec, :style]
|
data/appbundler.gemspec
CHANGED
@@ -13,16 +13,12 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.homepage = "https://github.com/chef/appbundler"
|
14
14
|
spec.license = "Apache-2.0"
|
15
15
|
|
16
|
-
spec.files =
|
16
|
+
spec.files = Dir.glob("{bin,lib,spec}/**/*").reject { |f| File.directory?(f) } + %w{ LICENSE appbundler.gemspec Rakefile Gemfile }
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.required_ruby_version = ">= 2.
|
22
|
-
|
23
|
-
spec.add_development_dependency "rake"
|
24
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
25
|
-
spec.add_development_dependency "pry"
|
21
|
+
spec.required_ruby_version = ">= 2.4"
|
26
22
|
|
27
23
|
spec.add_dependency "mixlib-shellout", ">= 2.0", "< 4.0"
|
28
24
|
spec.add_dependency "mixlib-cli", ">= 1.4", "< 3.0"
|
data/lib/appbundler/app.rb
CHANGED
@@ -17,7 +17,6 @@ module Appbundler
|
|
17
17
|
attr_reader :bundle_path
|
18
18
|
attr_reader :target_bin_dir
|
19
19
|
attr_reader :name
|
20
|
-
attr_reader :extra_bin_files
|
21
20
|
|
22
21
|
# The bundle_path is always the path to the Gemfile.lock being used, e.g.
|
23
22
|
# /var/cache/omnibus/src/chef/chef-14.10.9/Gemfile.lock or whatever. If
|
@@ -31,11 +30,10 @@ module Appbundler
|
|
31
30
|
# @param bundle_path [String] the directory path of the Gemfile.lock
|
32
31
|
# @param target_bin_dir [String] the binstub dir, e.g. /opt/chefdk/bin
|
33
32
|
# @param name [String] name of the gem
|
34
|
-
def initialize(bundle_path, target_bin_dir, name
|
33
|
+
def initialize(bundle_path, target_bin_dir, name)
|
35
34
|
@bundle_path = bundle_path
|
36
35
|
@target_bin_dir = target_bin_dir
|
37
36
|
@name = name
|
38
|
-
@extra_bin_files = extra_bin_files
|
39
37
|
end
|
40
38
|
|
41
39
|
# For the 2-arg version this is the gemfile in the omnibus build directory:
|
@@ -86,7 +84,7 @@ module Appbundler
|
|
86
84
|
# of our appbundle calls. But to ship ChefDK 2.0 we just do this.
|
87
85
|
SHITLIST = [
|
88
86
|
"github_changelog_generator",
|
89
|
-
]
|
87
|
+
].freeze
|
90
88
|
|
91
89
|
# This is a check which is equivalent to asking if we are running 2-arg or 3-arg. If
|
92
90
|
# we have an "external_lockfile" that means the chef-dk omnibus Gemfile.lock, e.g.:
|
@@ -111,11 +109,11 @@ module Appbundler
|
|
111
109
|
#
|
112
110
|
def local_gemfile_lock_specs
|
113
111
|
gemfile_lock_specs.map do |s|
|
114
|
-
#if SHITLIST.include?(s.name)
|
112
|
+
# if SHITLIST.include?(s.name)
|
115
113
|
# nil
|
116
|
-
#else
|
117
|
-
|
118
|
-
#end
|
114
|
+
# else
|
115
|
+
safe_resolve_local_gem(s)
|
116
|
+
# end
|
119
117
|
end.compact
|
120
118
|
end
|
121
119
|
|
@@ -129,7 +127,7 @@ module Appbundler
|
|
129
127
|
gem_path = installed_spec.gem_dir
|
130
128
|
# If we're already using that directory, don't copy (it won't work anyway)
|
131
129
|
return if gem_path == File.dirname(gemfile_lock)
|
132
|
-
FileUtils.install(gemfile_lock, gem_path, :
|
130
|
+
FileUtils.install(gemfile_lock, gem_path, mode: 0644)
|
133
131
|
if File.exist?(dot_bundle_dir) && File.directory?(dot_bundle_dir)
|
134
132
|
FileUtils.cp_r(dot_bundle_dir, gem_path)
|
135
133
|
FileUtils.chmod_R("ugo+rX", File.join(gem_path, ".bundle"))
|
@@ -155,7 +153,7 @@ module Appbundler
|
|
155
153
|
locked_gems = {}
|
156
154
|
|
157
155
|
gemfile_lock_specs.each do |s|
|
158
|
-
#next if SHITLIST.include?(s.name)
|
156
|
+
# next if SHITLIST.include?(s.name)
|
159
157
|
spec = safe_resolve_local_gem(s)
|
160
158
|
next if spec.nil?
|
161
159
|
|
@@ -197,7 +195,7 @@ module Appbundler
|
|
197
195
|
end
|
198
196
|
|
199
197
|
t.close
|
200
|
-
puts IO.read(t.path)
|
198
|
+
puts IO.read(t.path) # debugging
|
201
199
|
Dir.chdir(app_dir) do
|
202
200
|
FileUtils.rm_f "#{app_dir}/Gemfile.lock"
|
203
201
|
Bundler.with_clean_env do
|
@@ -208,7 +206,7 @@ module Appbundler
|
|
208
206
|
FileUtils.mv t.path, "#{app_dir}/Gemfile"
|
209
207
|
end
|
210
208
|
end
|
211
|
-
|
209
|
+
"#{app_dir}/Gemfile"
|
212
210
|
end
|
213
211
|
|
214
212
|
def write_executable_stubs
|
@@ -247,10 +245,10 @@ module Appbundler
|
|
247
245
|
|
248
246
|
def batchfile_stub
|
249
247
|
ruby_relpath_windows = ruby_relative_path.tr("/", '\\')
|
250
|
-
|
251
|
-
@ECHO OFF
|
252
|
-
"%~dp0\\#{ruby_relpath_windows}" "%~dpn0" %*
|
253
|
-
E
|
248
|
+
<<~E
|
249
|
+
@ECHO OFF
|
250
|
+
"%~dp0\\#{ruby_relpath_windows}" "%~dpn0" %*
|
251
|
+
E
|
254
252
|
end
|
255
253
|
|
256
254
|
# Relative path from #target_bin_dir to #ruby. This is used to
|
@@ -288,24 +286,30 @@ E
|
|
288
286
|
# APPBUNDLER_ALLOW_RVM environment variable to "true". This feature
|
289
287
|
# exists to make tests run correctly on travis.ci (which uses rvm).
|
290
288
|
def env_sanitizer
|
291
|
-
|
292
|
-
require "rubygems"
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
289
|
+
<<~EOS
|
290
|
+
require "rubygems"
|
291
|
+
|
292
|
+
# this works around OpenSSL FIPS fingerprint matching issue where
|
293
|
+
# it expects to be loaded in image base known at compile time. We
|
294
|
+
# load OpenSSL early so that the shared library gets loaded in its
|
295
|
+
# preferred image base address
|
296
|
+
require "openssl"
|
297
|
+
|
298
|
+
begin
|
299
|
+
# this works around rubygems/rubygems#2196 and can be removed in rubygems > 2.7.6
|
300
|
+
require "rubygems/bundler_version_finder"
|
301
|
+
rescue LoadError
|
302
|
+
# probably means rubygems is too old or too new to have this class, and we don't care
|
303
|
+
end
|
300
304
|
|
301
|
-
# avoid appbundling if we are definitely running within a Bundler bundle.
|
302
|
-
# most likely the check for defined?(Bundler) is enough since we don't require
|
303
|
-
# bundler above, but just for paranoia's sake also we test to see if Bundler is
|
304
|
-
# really doing its thing or not.
|
305
|
-
unless defined?(Bundler) && Bundler.instance_variable_defined?("@load")
|
306
|
-
|
307
|
-
|
308
|
-
EOS
|
305
|
+
# avoid appbundling if we are definitely running within a Bundler bundle.
|
306
|
+
# most likely the check for defined?(Bundler) is enough since we don't require
|
307
|
+
# bundler above, but just for paranoia's sake also we test to see if Bundler is
|
308
|
+
# really doing its thing or not.
|
309
|
+
unless defined?(Bundler) && Bundler.instance_variable_defined?("@load")
|
310
|
+
ENV["GEM_HOME"] = ENV["GEM_PATH"] = nil unless ENV["APPBUNDLER_ALLOW_RVM"] == "true"
|
311
|
+
::Gem.clear_paths
|
312
|
+
EOS
|
309
313
|
end
|
310
314
|
|
311
315
|
def runtime_activate
|
@@ -325,21 +329,28 @@ EOS
|
|
325
329
|
def load_statement_for(bin_file)
|
326
330
|
name, version = app_spec.name, app_spec.version
|
327
331
|
bin_basename = File.basename(bin_file)
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
332
|
+
<<~E
|
333
|
+
gem "#{name}", "= #{version}"
|
334
|
+
gem "bundler" # force activation of bundler to avoid unresolved specs if there are multiple bundler versions
|
335
|
+
spec = Gem::Specification.find_by_name("#{name}", "= #{version}")
|
336
|
+
else
|
337
|
+
spec = Gem::Specification.find_by_name("#{name}")
|
338
|
+
end
|
339
|
+
|
340
|
+
unless Gem::Specification.unresolved_deps.empty?
|
341
|
+
$stderr.puts "APPBUNDLER WARNING: unresolved deps are CRITICAL performance bug, this MUST be fixed"
|
342
|
+
Gem::Specification.reset
|
343
|
+
end
|
334
344
|
|
335
|
-
bin_file = spec.bin_file("#{bin_basename}")
|
345
|
+
bin_file = spec.bin_file("#{bin_basename}")
|
336
346
|
|
337
|
-
Kernel.load(bin_file)
|
338
|
-
E
|
347
|
+
Kernel.load(bin_file)
|
348
|
+
E
|
339
349
|
end
|
340
350
|
|
341
351
|
def executables
|
342
|
-
|
352
|
+
spec = installed_spec
|
353
|
+
spec.executables.map { |e| spec.bin_file(e) }
|
343
354
|
end
|
344
355
|
|
345
356
|
def runtime_dep_specs
|
@@ -413,12 +424,12 @@ E
|
|
413
424
|
inaccessable_gems = inaccessable_git_sourced_gems
|
414
425
|
return true if inaccessable_gems.empty?
|
415
426
|
|
416
|
-
message =
|
417
|
-
Application '#{name}' contains gems in the lockfile which are
|
418
|
-
not accessible by rubygems. This usually occurs when you fetch gems from git in
|
419
|
-
your Gemfile and do not install the same version of the gems beforehand.
|
427
|
+
message = <<~MESSAGE
|
428
|
+
Application '#{name}' contains gems in the lockfile which are
|
429
|
+
not accessible by rubygems. This usually occurs when you fetch gems from git in
|
430
|
+
your Gemfile and do not install the same version of the gems beforehand.
|
420
431
|
|
421
|
-
MESSAGE
|
432
|
+
MESSAGE
|
422
433
|
|
423
434
|
message << "The Gemfile.lock is located here:\n- #{gemfile_lock}\n\n"
|
424
435
|
|
data/lib/appbundler/cli.rb
CHANGED
@@ -1,54 +1,48 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require_relative "version"
|
2
|
+
require_relative "app"
|
3
3
|
require "mixlib/cli"
|
4
4
|
|
5
5
|
module Appbundler
|
6
6
|
class CLI
|
7
7
|
include Mixlib::CLI
|
8
8
|
|
9
|
-
banner(
|
10
|
-
* appbundler #{VERSION} *
|
9
|
+
banner(<<~BANNER)
|
10
|
+
* appbundler #{VERSION} *
|
11
11
|
|
12
|
-
Usage: appbundler BUNDLE_DIR BINSTUB_DIR [GEM_NAME] [GEM_NAME] ...
|
12
|
+
Usage: appbundler BUNDLE_DIR BINSTUB_DIR [GEM_NAME] [GEM_NAME] ...
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
BUNDLE_DIR is the root directory to the bundle containing your app
|
15
|
+
BINSTUB_DIR is the directory where you want generated executables to be written
|
16
|
+
GEM_NAME is the name of a gem you want to appbundle. Default is the directory name
|
17
|
+
of BUNDLE_DIR (e.g. /src/chef -> chef)
|
18
18
|
|
19
|
-
Your bundled application must already be gem installed. Generated binstubs
|
20
|
-
will point to the gem, not your working copy.
|
21
|
-
BANNER
|
19
|
+
Your bundled application must already be gem installed. Generated binstubs
|
20
|
+
will point to the gem, not your working copy.
|
21
|
+
BANNER
|
22
22
|
|
23
23
|
# this is used by chef-dk, its probably not an external API, here be dragons
|
24
24
|
option :without,
|
25
|
-
:
|
26
|
-
:
|
27
|
-
:
|
28
|
-
:
|
29
|
-
|
30
|
-
option :extra_bin_files,
|
31
|
-
:long => "--extra-bin-files bin1,bin2",
|
32
|
-
:description => "Comma separated list of extra binstubs to wire up which are not listed in the gemspec",
|
33
|
-
:proc => lambda { |o| o.split(/[\s,]+/) },
|
34
|
-
:default => []
|
25
|
+
long: "--without GROUPS",
|
26
|
+
description: "Comma separated list of groups to exclude when building transitive Gemfile.locks (internal API)",
|
27
|
+
proc: lambda { |o| o.split(/[\s,]+/) },
|
28
|
+
default: []
|
35
29
|
|
36
30
|
option :version,
|
37
|
-
:
|
38
|
-
:
|
39
|
-
:
|
40
|
-
:
|
41
|
-
:
|
42
|
-
:
|
31
|
+
short: "-v",
|
32
|
+
long: "--version",
|
33
|
+
description: "Show appbundler version",
|
34
|
+
boolean: true,
|
35
|
+
proc: lambda { |v| $stdout.puts("Appbundler Version: #{::Appbundler::VERSION}") },
|
36
|
+
exit: 0
|
43
37
|
|
44
38
|
option :help,
|
45
|
-
:
|
46
|
-
:
|
47
|
-
:
|
48
|
-
:
|
49
|
-
:
|
50
|
-
:
|
51
|
-
:
|
39
|
+
short: "-h",
|
40
|
+
long: "--help",
|
41
|
+
description: "Show this message",
|
42
|
+
on: :tail,
|
43
|
+
boolean: true,
|
44
|
+
show_options: true,
|
45
|
+
exit: 0
|
52
46
|
|
53
47
|
def self.run(argv)
|
54
48
|
cli = new(argv)
|
@@ -104,7 +98,7 @@ BANNER
|
|
104
98
|
|
105
99
|
def run
|
106
100
|
gems.each do |g|
|
107
|
-
app = App.new(bundle_path, bin_path, g
|
101
|
+
app = App.new(bundle_path, bin_path, g)
|
108
102
|
created_stubs = app.write_executable_stubs
|
109
103
|
created_stubs.each do |real_executable_path, stub_path|
|
110
104
|
$stdout.puts "Generated binstub #{stub_path} => #{real_executable_path}"
|
data/lib/appbundler/version.rb
CHANGED
data/spec/appbundler/app_spec.rb
CHANGED
@@ -11,15 +11,15 @@ describe Appbundler do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def double_spec(name, version, dep_names)
|
14
|
-
deps = dep_names.map { |n| double("Bundler::Dependency #{n}", :
|
14
|
+
deps = dep_names.map { |n| double("Bundler::Dependency #{n}", name: n.to_s) }
|
15
15
|
source = double("Bundler::Source::Rubygems")
|
16
|
-
spec = double("Bundler::LazySpecification '#{name}'", :
|
16
|
+
spec = double("Bundler::LazySpecification '#{name}'", name: name.to_s, version: version, dependencies: deps, source: source)
|
17
17
|
all_specs << spec
|
18
18
|
spec
|
19
19
|
end
|
20
20
|
|
21
21
|
def shellout!(cmd)
|
22
|
-
s = Mixlib::ShellOut.new(cmd, :
|
22
|
+
s = Mixlib::ShellOut.new(cmd, env: { "RUBYOPT" => nil, "BUNDLE_GEMFILE" => nil, "APPBUNDLER_ALLOW_RVM" => "true" })
|
23
23
|
s.run_command
|
24
24
|
s.error!
|
25
25
|
s
|
@@ -99,23 +99,48 @@ describe Appbundler do
|
|
99
99
|
end
|
100
100
|
|
101
101
|
it "locks the main app's gem via rubygems, and loads the proper binary" do
|
102
|
-
expected_loading_code =
|
103
|
-
gem "app", "= 1.0.0"
|
104
|
-
|
105
|
-
spec = Gem::Specification.find_by_name("app", "= 1.0.0")
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
102
|
+
expected_loading_code = <<~CODE
|
103
|
+
gem "app", "= 1.0.0"
|
104
|
+
gem "bundler" # force activation of bundler to avoid unresolved specs if there are multiple bundler versions
|
105
|
+
spec = Gem::Specification.find_by_name("app", "= 1.0.0")
|
106
|
+
else
|
107
|
+
spec = Gem::Specification.find_by_name("app")
|
108
|
+
end
|
109
|
+
unless Gem::Specification.unresolved_deps.empty?
|
110
|
+
$stderr.puts "APPBUNDLER WARNING: unresolved deps are CRITICAL performance bug, this MUST be fixed"
|
111
|
+
Gem::Specification.reset
|
112
|
+
end
|
113
|
+
bin_file = spec.bin_file("foo")
|
114
|
+
Kernel.load(bin_file)
|
115
|
+
CODE
|
110
116
|
expect(app.load_statement_for(bin_path)).to eq(expected_loading_code)
|
111
117
|
end
|
112
118
|
|
113
119
|
it "generates code to override GEM_HOME and GEM_PATH (e.g., rvm)" do
|
114
|
-
expected =
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
120
|
+
expected = <<~EOS
|
121
|
+
require "rubygems"
|
122
|
+
|
123
|
+
# this works around OpenSSL FIPS fingerprint matching issue where
|
124
|
+
# it expects to be loaded in image base known at compile time. We
|
125
|
+
# load OpenSSL early so that the shared library gets loaded in its
|
126
|
+
# preferred image base address
|
127
|
+
require "openssl"
|
128
|
+
|
129
|
+
begin
|
130
|
+
# this works around rubygems/rubygems#2196 and can be removed in rubygems > 2.7.6
|
131
|
+
require "rubygems/bundler_version_finder"
|
132
|
+
rescue LoadError
|
133
|
+
# probably means rubygems is too old or too new to have this class, and we don't care
|
134
|
+
end
|
135
|
+
|
136
|
+
# avoid appbundling if we are definitely running within a Bundler bundle.
|
137
|
+
# most likely the check for defined?(Bundler) is enough since we don't require
|
138
|
+
# bundler above, but just for paranoia's sake also we test to see if Bundler is
|
139
|
+
# really doing its thing or not.
|
140
|
+
unless defined?(Bundler) && Bundler.instance_variable_defined?("@load")
|
141
|
+
ENV["GEM_HOME"] = ENV["GEM_PATH"] = nil unless ENV["APPBUNDLER_ALLOW_RVM"] == "true"
|
142
|
+
::Gem.clear_paths
|
143
|
+
EOS
|
119
144
|
|
120
145
|
expect(app.env_sanitizer).to eq(expected)
|
121
146
|
expect(app.runtime_activate).to include(expected)
|
@@ -134,10 +159,10 @@ EOS
|
|
134
159
|
end
|
135
160
|
|
136
161
|
it "generates batchfile stub code" do
|
137
|
-
expected_batch_code =
|
138
|
-
@ECHO OFF
|
139
|
-
"%~dp0\\..\\embedded\\bin\\ruby.exe" "%~dpn0" %*
|
140
|
-
E
|
162
|
+
expected_batch_code = <<~E
|
163
|
+
@ECHO OFF
|
164
|
+
"%~dp0\\..\\embedded\\bin\\ruby.exe" "%~dpn0" %*
|
165
|
+
E
|
141
166
|
expect(app.batchfile_stub).to eq(expected_batch_code)
|
142
167
|
end
|
143
168
|
|
@@ -155,8 +180,8 @@ E
|
|
155
180
|
|
156
181
|
# Ensure that the behavior we emulate in our stubs is correct:
|
157
182
|
it "sanity checks rubygems behavior" do
|
158
|
-
expect { Gem::Specification.find_by_name("there-is-no-such-gem-named-this", "= 999.999.999") }
|
159
|
-
to raise_error(Gem::LoadError)
|
183
|
+
expect { Gem::Specification.find_by_name("there-is-no-such-gem-named-this", "= 999.999.999") }
|
184
|
+
.to raise_error(Gem::LoadError)
|
160
185
|
end
|
161
186
|
|
162
187
|
context "and the gems are not accessible by rubygems" do
|
@@ -238,123 +263,123 @@ E
|
|
238
263
|
|
239
264
|
it "generates runtime activation code for the app" do
|
240
265
|
expected_gem_activates = if windows?
|
241
|
-
|
242
|
-
ENV["GEM_HOME"] = ENV["GEM_PATH"] = nil unless ENV["APPBUNDLER_ALLOW_RVM"] == "true"
|
243
|
-
require "rubygems"
|
244
|
-
::Gem.clear_paths
|
245
|
-
|
246
|
-
gem "chef", "= 12.4.1"
|
247
|
-
gem "chef-config", "= 12.4.1"
|
248
|
-
gem "mixlib-config", "= 2.2.1"
|
249
|
-
gem "mixlib-shellout", "= 2.2.0"
|
250
|
-
gem "win32-process", "= 0.7.5"
|
251
|
-
gem "ffi", "= 1.9.10"
|
252
|
-
gem "chef-zero", "= 4.3.0"
|
253
|
-
gem "ffi-yajl", "= 2.2.2"
|
254
|
-
gem "libyajl2", "= 1.2.0"
|
255
|
-
gem "hashie", "= 2.1.2"
|
256
|
-
gem "mixlib-log", "= 1.6.0"
|
257
|
-
gem "rack", "= 1.6.4"
|
258
|
-
gem "uuidtools", "= 2.1.5"
|
259
|
-
gem "diff-lcs", "= 1.2.5"
|
260
|
-
gem "erubis", "= 2.7.0"
|
261
|
-
gem "highline", "= 1.7.3"
|
262
|
-
gem "mixlib-authentication", "= 1.3.0"
|
263
|
-
gem "mixlib-cli", "= 1.5.0"
|
264
|
-
gem "net-ssh", "= 2.9.2"
|
265
|
-
gem "net-ssh-multi", "= 1.2.1"
|
266
|
-
gem "net-ssh-gateway", "= 1.2.0"
|
267
|
-
gem "ohai", "= 8.5.1"
|
268
|
-
gem "ipaddress", "= 0.8.0"
|
269
|
-
gem "mime-types", "= 2.6.1"
|
270
|
-
gem "rake", "= 10.1.1"
|
271
|
-
gem "systemu", "= 2.6.5"
|
272
|
-
gem "wmi-lite", "= 1.0.0"
|
273
|
-
gem "plist", "= 3.1.0"
|
274
|
-
gem "pry", "= 0.9.12.6"
|
275
|
-
gem "coderay", "= 1.1.0"
|
276
|
-
gem "method_source", "= 0.8.2"
|
277
|
-
gem "slop", "= 3.4.7"
|
278
|
-
gem "win32console", "= 1.3.2"
|
279
|
-
gem "rspec-core", "= 3.3.2"
|
280
|
-
gem "rspec-support", "= 3.3.0"
|
281
|
-
gem "rspec-expectations", "= 3.3.1"
|
282
|
-
gem "rspec-mocks", "= 3.3.2"
|
283
|
-
gem "rspec_junit_formatter", "= 0.2.3"
|
284
|
-
gem "builder", "= 3.2.2"
|
285
|
-
gem "serverspec", "= 2.23.1"
|
286
|
-
gem "multi_json", "= 1.11.2"
|
287
|
-
gem "rspec", "= 3.3.0"
|
288
|
-
gem "rspec-its", "= 1.2.0"
|
289
|
-
gem "specinfra", "= 2.43.3"
|
290
|
-
gem "net-scp", "= 1.2.1"
|
291
|
-
gem "net-telnet", "= 0.1.1"
|
292
|
-
gem "sfl", "= 2.2"
|
293
|
-
gem "syslog-logger", "= 1.6.8"
|
294
|
-
gem "win32-api", "= 1.5.3"
|
295
|
-
gem "win32-dir", "= 0.5.0"
|
296
|
-
gem "win32-event", "= 0.6.1"
|
297
|
-
gem "win32-ipc", "= 0.6.6"
|
298
|
-
gem "win32-eventlog", "= 0.6.3"
|
299
|
-
gem "win32-mmap", "= 0.4.1"
|
300
|
-
gem "win32-mutex", "= 0.4.2"
|
301
|
-
gem "win32-service", "= 0.8.6"
|
302
|
-
gem "windows-api", "= 0.4.4"
|
303
|
-
gem "windows-pr", "= 1.2.4"
|
304
|
-
E
|
266
|
+
<<~E
|
267
|
+
ENV["GEM_HOME"] = ENV["GEM_PATH"] = nil unless ENV["APPBUNDLER_ALLOW_RVM"] == "true"
|
268
|
+
require "rubygems"
|
269
|
+
::Gem.clear_paths
|
270
|
+
|
271
|
+
gem "chef", "= 12.4.1"
|
272
|
+
gem "chef-config", "= 12.4.1"
|
273
|
+
gem "mixlib-config", "= 2.2.1"
|
274
|
+
gem "mixlib-shellout", "= 2.2.0"
|
275
|
+
gem "win32-process", "= 0.7.5"
|
276
|
+
gem "ffi", "= 1.9.10"
|
277
|
+
gem "chef-zero", "= 4.3.0"
|
278
|
+
gem "ffi-yajl", "= 2.2.2"
|
279
|
+
gem "libyajl2", "= 1.2.0"
|
280
|
+
gem "hashie", "= 2.1.2"
|
281
|
+
gem "mixlib-log", "= 1.6.0"
|
282
|
+
gem "rack", "= 1.6.4"
|
283
|
+
gem "uuidtools", "= 2.1.5"
|
284
|
+
gem "diff-lcs", "= 1.2.5"
|
285
|
+
gem "erubis", "= 2.7.0"
|
286
|
+
gem "highline", "= 1.7.3"
|
287
|
+
gem "mixlib-authentication", "= 1.3.0"
|
288
|
+
gem "mixlib-cli", "= 1.5.0"
|
289
|
+
gem "net-ssh", "= 2.9.2"
|
290
|
+
gem "net-ssh-multi", "= 1.2.1"
|
291
|
+
gem "net-ssh-gateway", "= 1.2.0"
|
292
|
+
gem "ohai", "= 8.5.1"
|
293
|
+
gem "ipaddress", "= 0.8.0"
|
294
|
+
gem "mime-types", "= 2.6.1"
|
295
|
+
gem "rake", "= 10.1.1"
|
296
|
+
gem "systemu", "= 2.6.5"
|
297
|
+
gem "wmi-lite", "= 1.0.0"
|
298
|
+
gem "plist", "= 3.1.0"
|
299
|
+
gem "pry", "= 0.9.12.6"
|
300
|
+
gem "coderay", "= 1.1.0"
|
301
|
+
gem "method_source", "= 0.8.2"
|
302
|
+
gem "slop", "= 3.4.7"
|
303
|
+
gem "win32console", "= 1.3.2"
|
304
|
+
gem "rspec-core", "= 3.3.2"
|
305
|
+
gem "rspec-support", "= 3.3.0"
|
306
|
+
gem "rspec-expectations", "= 3.3.1"
|
307
|
+
gem "rspec-mocks", "= 3.3.2"
|
308
|
+
gem "rspec_junit_formatter", "= 0.2.3"
|
309
|
+
gem "builder", "= 3.2.2"
|
310
|
+
gem "serverspec", "= 2.23.1"
|
311
|
+
gem "multi_json", "= 1.11.2"
|
312
|
+
gem "rspec", "= 3.3.0"
|
313
|
+
gem "rspec-its", "= 1.2.0"
|
314
|
+
gem "specinfra", "= 2.43.3"
|
315
|
+
gem "net-scp", "= 1.2.1"
|
316
|
+
gem "net-telnet", "= 0.1.1"
|
317
|
+
gem "sfl", "= 2.2"
|
318
|
+
gem "syslog-logger", "= 1.6.8"
|
319
|
+
gem "win32-api", "= 1.5.3"
|
320
|
+
gem "win32-dir", "= 0.5.0"
|
321
|
+
gem "win32-event", "= 0.6.1"
|
322
|
+
gem "win32-ipc", "= 0.6.6"
|
323
|
+
gem "win32-eventlog", "= 0.6.3"
|
324
|
+
gem "win32-mmap", "= 0.4.1"
|
325
|
+
gem "win32-mutex", "= 0.4.2"
|
326
|
+
gem "win32-service", "= 0.8.6"
|
327
|
+
gem "windows-api", "= 0.4.4"
|
328
|
+
gem "windows-pr", "= 1.2.4"
|
329
|
+
E
|
305
330
|
else
|
306
|
-
|
307
|
-
ENV["GEM_HOME"] = ENV["GEM_PATH"] = nil unless ENV["APPBUNDLER_ALLOW_RVM"] == "true"
|
308
|
-
require "rubygems"
|
309
|
-
::Gem.clear_paths
|
310
|
-
|
311
|
-
gem "chef", "= 12.4.1"
|
312
|
-
gem "chef-config", "= 12.4.1"
|
313
|
-
gem "mixlib-config", "= 2.2.1"
|
314
|
-
gem "mixlib-shellout", "= 2.2.0"
|
315
|
-
gem "chef-zero", "= 4.3.0"
|
316
|
-
gem "ffi-yajl", "= 2.2.2"
|
317
|
-
gem "libyajl2", "= 1.2.0"
|
318
|
-
gem "hashie", "= 2.1.2"
|
319
|
-
gem "mixlib-log", "= 1.6.0"
|
320
|
-
gem "rack", "= 1.6.4"
|
321
|
-
gem "uuidtools", "= 2.1.5"
|
322
|
-
gem "diff-lcs", "= 1.2.5"
|
323
|
-
gem "erubis", "= 2.7.0"
|
324
|
-
gem "highline", "= 1.7.3"
|
325
|
-
gem "mixlib-authentication", "= 1.3.0"
|
326
|
-
gem "mixlib-cli", "= 1.5.0"
|
327
|
-
gem "net-ssh", "= 2.9.2"
|
328
|
-
gem "net-ssh-multi", "= 1.2.1"
|
329
|
-
gem "net-ssh-gateway", "= 1.2.0"
|
330
|
-
gem "ohai", "= 8.5.1"
|
331
|
-
gem "ffi", "= 1.9.10"
|
332
|
-
gem "ipaddress", "= 0.8.0"
|
333
|
-
gem "mime-types", "= 2.6.1"
|
334
|
-
gem "rake", "= 10.1.1"
|
335
|
-
gem "systemu", "= 2.6.5"
|
336
|
-
gem "wmi-lite", "= 1.0.0"
|
337
|
-
gem "plist", "= 3.1.0"
|
338
|
-
gem "pry", "= 0.9.12.6"
|
339
|
-
gem "coderay", "= 1.1.0"
|
340
|
-
gem "method_source", "= 0.8.2"
|
341
|
-
gem "slop", "= 3.4.7"
|
342
|
-
gem "rspec-core", "= 3.3.2"
|
343
|
-
gem "rspec-support", "= 3.3.0"
|
344
|
-
gem "rspec-expectations", "= 3.3.1"
|
345
|
-
gem "rspec-mocks", "= 3.3.2"
|
346
|
-
gem "rspec_junit_formatter", "= 0.2.3"
|
347
|
-
gem "builder", "= 3.2.2"
|
348
|
-
gem "serverspec", "= 2.23.1"
|
349
|
-
gem "multi_json", "= 1.11.2"
|
350
|
-
gem "rspec", "= 3.3.0"
|
351
|
-
gem "rspec-its", "= 1.2.0"
|
352
|
-
gem "specinfra", "= 2.43.3"
|
353
|
-
gem "net-scp", "= 1.2.1"
|
354
|
-
gem "net-telnet", "= 0.1.1"
|
355
|
-
gem "sfl", "= 2.2"
|
356
|
-
gem "syslog-logger", "= 1.6.8"
|
357
|
-
E
|
331
|
+
<<~E
|
332
|
+
ENV["GEM_HOME"] = ENV["GEM_PATH"] = nil unless ENV["APPBUNDLER_ALLOW_RVM"] == "true"
|
333
|
+
require "rubygems"
|
334
|
+
::Gem.clear_paths
|
335
|
+
|
336
|
+
gem "chef", "= 12.4.1"
|
337
|
+
gem "chef-config", "= 12.4.1"
|
338
|
+
gem "mixlib-config", "= 2.2.1"
|
339
|
+
gem "mixlib-shellout", "= 2.2.0"
|
340
|
+
gem "chef-zero", "= 4.3.0"
|
341
|
+
gem "ffi-yajl", "= 2.2.2"
|
342
|
+
gem "libyajl2", "= 1.2.0"
|
343
|
+
gem "hashie", "= 2.1.2"
|
344
|
+
gem "mixlib-log", "= 1.6.0"
|
345
|
+
gem "rack", "= 1.6.4"
|
346
|
+
gem "uuidtools", "= 2.1.5"
|
347
|
+
gem "diff-lcs", "= 1.2.5"
|
348
|
+
gem "erubis", "= 2.7.0"
|
349
|
+
gem "highline", "= 1.7.3"
|
350
|
+
gem "mixlib-authentication", "= 1.3.0"
|
351
|
+
gem "mixlib-cli", "= 1.5.0"
|
352
|
+
gem "net-ssh", "= 2.9.2"
|
353
|
+
gem "net-ssh-multi", "= 1.2.1"
|
354
|
+
gem "net-ssh-gateway", "= 1.2.0"
|
355
|
+
gem "ohai", "= 8.5.1"
|
356
|
+
gem "ffi", "= 1.9.10"
|
357
|
+
gem "ipaddress", "= 0.8.0"
|
358
|
+
gem "mime-types", "= 2.6.1"
|
359
|
+
gem "rake", "= 10.1.1"
|
360
|
+
gem "systemu", "= 2.6.5"
|
361
|
+
gem "wmi-lite", "= 1.0.0"
|
362
|
+
gem "plist", "= 3.1.0"
|
363
|
+
gem "pry", "= 0.9.12.6"
|
364
|
+
gem "coderay", "= 1.1.0"
|
365
|
+
gem "method_source", "= 0.8.2"
|
366
|
+
gem "slop", "= 3.4.7"
|
367
|
+
gem "rspec-core", "= 3.3.2"
|
368
|
+
gem "rspec-support", "= 3.3.0"
|
369
|
+
gem "rspec-expectations", "= 3.3.1"
|
370
|
+
gem "rspec-mocks", "= 3.3.2"
|
371
|
+
gem "rspec_junit_formatter", "= 0.2.3"
|
372
|
+
gem "builder", "= 3.2.2"
|
373
|
+
gem "serverspec", "= 2.23.1"
|
374
|
+
gem "multi_json", "= 1.11.2"
|
375
|
+
gem "rspec", "= 3.3.0"
|
376
|
+
gem "rspec-its", "= 1.2.0"
|
377
|
+
gem "specinfra", "= 2.43.3"
|
378
|
+
gem "net-scp", "= 1.2.1"
|
379
|
+
gem "net-telnet", "= 0.1.1"
|
380
|
+
gem "sfl", "= 2.2"
|
381
|
+
gem "syslog-logger", "= 1.6.8"
|
382
|
+
E
|
358
383
|
end
|
359
384
|
expect(app.runtime_activate).to include(expected_gem_activates)
|
360
385
|
end
|
@@ -391,8 +416,8 @@ E
|
|
391
416
|
binary_2 = File.join(target_bindir, "app-binary-2")
|
392
417
|
expect(File.exist?(binary_1)).to be(true)
|
393
418
|
expect(File.exist?(binary_2)).to be(true)
|
394
|
-
expect(File.executable?(binary_1) || File.
|
395
|
-
expect(File.executable?(binary_1) || File.
|
419
|
+
expect(File.executable?(binary_1) || File.exist?(binary_1 + ".bat")).to be(true)
|
420
|
+
expect(File.executable?(binary_1) || File.exist?(binary_1 + ".bat")).to be(true)
|
396
421
|
expect(shellout!(binary_1).stdout.strip).to eq("binary 1 ran")
|
397
422
|
expect(shellout!(binary_2).stdout.strip).to eq("binary 2 ran")
|
398
423
|
end
|
@@ -401,7 +426,7 @@ E
|
|
401
426
|
spec = Gem::Specification.find_by_name("appbundler-example-app", "= 1.0.0")
|
402
427
|
gem_path = spec.gem_dir
|
403
428
|
app.copy_bundler_env
|
404
|
-
expect(File.
|
429
|
+
expect(File.exist?(File.join(gem_path, "Gemfile.lock"))).to be(true)
|
405
430
|
end
|
406
431
|
|
407
432
|
it "copies over .bundler to the gem directory" do
|
@@ -409,7 +434,7 @@ E
|
|
409
434
|
gem_path = spec.gem_dir
|
410
435
|
app.copy_bundler_env
|
411
436
|
expect(File.directory?(File.join(gem_path, ".bundle"))).to be(true)
|
412
|
-
expect(File.
|
437
|
+
expect(File.exist?(File.join(gem_path, ".bundle/config"))).to be(true)
|
413
438
|
end
|
414
439
|
context "and the executable is symlinked to a different directory", :not_supported_on_windows do
|
415
440
|
|
@@ -449,10 +474,10 @@ E
|
|
449
474
|
end
|
450
475
|
|
451
476
|
let(:expected_batch_code) do
|
452
|
-
|
453
|
-
@ECHO OFF
|
454
|
-
"%~dp0\\#{expected_ruby_relpath}" "%~dpn0" %*
|
455
|
-
E
|
477
|
+
<<~E
|
478
|
+
@ECHO OFF
|
479
|
+
"%~dp0\\#{expected_ruby_relpath}" "%~dpn0" %*
|
480
|
+
E
|
456
481
|
end
|
457
482
|
|
458
483
|
before do
|