appbundler 0.12.5 → 0.13.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1dcd59c708dccfad8673c092b7242d954942edeca4485f63a7b0e52562c54dfa
4
- data.tar.gz: bec45a212040f3d2da848076e4238b144281d95f3c86314df19fd5a62e6d62cf
3
+ metadata.gz: 657491b7f98dbe51565e148477363d71b52f891d65c0a1779c2c99629210fd83
4
+ data.tar.gz: 0dc420bb112e8ce3bdfa992836db8c456d90b2f1ad273ac6838840e346a7fe75
5
5
  SHA512:
6
- metadata.gz: '079b378d48e54ba64281ba9fe3b4d2e14ffd82a16efc5158871bfbc0ffe695c864e6f041965f4f6ba33b3286b522a62ff646ba90dea361b282da52646a08f71f'
7
- data.tar.gz: 918cf1efe62553289fe763cef454ef32df723d9459ac9bbad9bc5160fbfdb5547ba180b5ee51b0ea449c82f0f29bdf826aebdcac5a903c4b2c0260c6796b2cbd
6
+ metadata.gz: 35dbe56d77b5d2321fb963557fc90b008de94d03622788c34ad259c51bd4e8be6d7a956d58754214bb16e3f4b2c27f281420f9e2adbac3ecfed030655c239b75
7
+ data.tar.gz: 7fe22aed3da9a4c77b1bf00b796de05e232fd03a83b3ec6c2d3241383e6a123435d6413d3fe34beb0f6f42315a25bf928b1a34c2a86e1c50b8944234b067158a
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")
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]
@@ -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 = `git ls-files`.split($/)
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.3"
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"
@@ -17,10 +17,9 @@ 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
- # The bundle_path is always the path to the directory containing the Gemfile.lock
23
- # being used, e.g. /var/cache/omnibus/src/chef/chefor whatever. If
21
+ # The bundle_path is always the path to the Gemfile.lock being used, e.g.
22
+ # /var/cache/omnibus/src/chef/chef-14.10.9/Gemfile.lock or whatever. If
24
23
  # the name if the gem is not set then we behave like old style 2-arg appbundling
25
24
  # where the gem we are appbundling is in the gemspec in that directory.
26
25
  #
@@ -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, extra_bin_files = [])
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:
@@ -136,16 +134,6 @@ module Appbundler
136
134
  end
137
135
  end
138
136
 
139
- # This is used to copy the binstubs from the binstub source directory to the actual
140
- # binstub location.
141
- #
142
- def copy_binstubs(binstubs_source)
143
- gem_path = installed_spec.gem_dir
144
- dst = "#{gem_path}/bin"
145
- src = File.join(bundle_path, binstubs_source, "*")
146
- FileUtils.cp_r(Dir.glob(src), dst)
147
- end
148
-
149
137
  # This is the implementation of the 3-arg version of writing the merged lockfiles,
150
138
  # when called with the 2-arg version it short-circuits, however, to the copy_bundler_env
151
139
  # version above.
@@ -337,11 +325,17 @@ module Appbundler
337
325
  bin_basename = File.basename(bin_file)
338
326
  <<~E
339
327
  gem "#{name}", "= #{version}"
328
+ gem "bundler" # force activation of bundler to avoid unresolved specs if there are multiple bundler versions
340
329
  spec = Gem::Specification.find_by_name("#{name}", "= #{version}")
341
330
  else
342
331
  spec = Gem::Specification.find_by_name("#{name}")
343
332
  end
344
333
 
334
+ unless Gem::Specification.unresolved_deps.empty?
335
+ $stderr.puts "APPBUNDLER WARNING: unresolved deps are CRITICAL performance bug, this MUST be fixed"
336
+ Gem::Specification.reset
337
+ end
338
+
345
339
  bin_file = spec.bin_file("#{bin_basename}")
346
340
 
347
341
  Kernel.load(bin_file)
@@ -349,7 +343,8 @@ module Appbundler
349
343
  end
350
344
 
351
345
  def executables
352
- installed_spec.executables.map { |e| installed_spec.bin_file(e) } + extra_bin_files
346
+ spec = installed_spec
347
+ spec.executables.map { |e| spec.bin_file(e) }
353
348
  end
354
349
 
355
350
  def runtime_dep_specs
@@ -27,17 +27,6 @@ module Appbundler
27
27
  proc: lambda { |o| o.split(/[\s,]+/) },
28
28
  default: []
29
29
 
30
- option :binstubs_source,
31
- long: "--binstubs-source path/to/binstubs",
32
- description: "Path to binstubs within the gem to be moved into the bindir",
33
- default: nil
34
-
35
- option :extra_bin_files,
36
- long: "--extra-bin-files bin1,bin2",
37
- description: "Comma separated list of extra binstubs to wire up which are not listed in the gemspec",
38
- proc: lambda { |o| o.split(/[\s,]+/) },
39
- default: []
40
-
41
30
  option :version,
42
31
  short: "-v",
43
32
  long: "--version",
@@ -109,17 +98,13 @@ module Appbundler
109
98
 
110
99
  def run
111
100
  gems.each do |g|
112
- app = App.new(bundle_path, bin_path, g, config[:extra_bin_files])
101
+ app = App.new(bundle_path, bin_path, g)
113
102
  created_stubs = app.write_executable_stubs
114
103
  created_stubs.each do |real_executable_path, stub_path|
115
104
  $stdout.puts "Generated binstub #{stub_path} => #{real_executable_path}"
116
105
  end
117
106
  created_lockfile = app.write_merged_lockfiles(without: config[:without])
118
107
  $stdout.puts "Generated merged lockfile at #{created_lockfile}" if created_lockfile
119
- if config[:binstubs_source]
120
- app.copy_binstubs(config[:binstubs_source])
121
- $stdout.puts "Copied binstubs"
122
- end
123
108
  end
124
109
  end
125
110
 
@@ -1,3 +1,3 @@
1
1
  module Appbundler
2
- VERSION = "0.12.5".freeze
2
+ VERSION = "0.13.1".freeze
3
3
  end
@@ -100,21 +100,40 @@ describe Appbundler do
100
100
 
101
101
  it "locks the main app's gem via rubygems, and loads the proper binary" do
102
102
  expected_loading_code = <<~CODE
103
- gem "app", "= 1.0.0"
104
-
105
- spec = Gem::Specification.find_by_name("app", "= 1.0.0")
106
- bin_file = spec.bin_file("foo")
107
-
108
- Kernel.load(bin_file)
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)
109
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
120
  expected = <<~EOS
115
- ENV["GEM_HOME"] = ENV["GEM_PATH"] = nil unless ENV["APPBUNDLER_ALLOW_RVM"] == "true"
116
121
  require "rubygems"
117
- ::Gem.clear_paths
122
+
123
+ begin
124
+ # this works around rubygems/rubygems#2196 and can be removed in rubygems > 2.7.6
125
+ require "rubygems/bundler_version_finder"
126
+ rescue LoadError
127
+ # probably means rubygems is too old or too new to have this class, and we don't care
128
+ end
129
+
130
+ # avoid appbundling if we are definitely running within a Bundler bundle.
131
+ # most likely the check for defined?(Bundler) is enough since we don't require
132
+ # bundler above, but just for paranoia's sake also we test to see if Bundler is
133
+ # really doing its thing or not.
134
+ unless defined?(Bundler) && Bundler.instance_variable_defined?("@load")
135
+ ENV["GEM_HOME"] = ENV["GEM_PATH"] = nil unless ENV["APPBUNDLER_ALLOW_RVM"] == "true"
136
+ ::Gem.clear_paths
118
137
  EOS
119
138
 
120
139
  expect(app.env_sanitizer).to eq(expected)
metadata CHANGED
@@ -1,57 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appbundler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.5
4
+ version: 0.13.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chef Software, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-24 00:00:00.000000000 Z
11
+ date: 2019-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: rake
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: rspec
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '3.0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '3.0'
41
- - !ruby/object:Gem::Dependency
42
- name: pry
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
13
  - !ruby/object:Gem::Dependency
56
14
  name: mixlib-shellout
57
15
  requirement: !ruby/object:Gem::Requirement
@@ -101,26 +59,9 @@ executables:
101
59
  extensions: []
102
60
  extra_rdoc_files: []
103
61
  files:
104
- - ".expeditor/config.yml"
105
- - ".expeditor/update_version.sh"
106
- - ".github/CODEOWNERS"
107
- - ".github/ISSUE_TEMPLATE/BUG_TEMPLATE.md"
108
- - ".github/ISSUE_TEMPLATE/DESIGN_PROPOSAL.md"
109
- - ".github/ISSUE_TEMPLATE/ENHANCEMENT_REQUEST_TEMPLATE.md"
110
- - ".github/ISSUE_TEMPLATE/SUPPORT_QUESTION.md"
111
- - ".github/PULL_REQUEST_TEMPLATE.md"
112
- - ".github/lock.yml"
113
- - ".gitignore"
114
- - ".rspec"
115
- - ".travis.yml"
116
- - CHANGELOG.md
117
- - CODE_OF_CONDUCT.md
118
- - CONTRIBUTING.md
119
62
  - Gemfile
120
- - LICENSE.txt
121
- - README.md
63
+ - LICENSE
122
64
  - Rakefile
123
- - VERSION
124
65
  - appbundler.gemspec
125
66
  - bin/appbundler
126
67
  - lib/appbundler.rb
@@ -128,7 +69,6 @@ files:
128
69
  - lib/appbundler/cli.rb
129
70
  - lib/appbundler/version.rb
130
71
  - spec/appbundler/app_spec.rb
131
- - spec/fixtures/appbundler-example-app/.bundle/config
132
72
  - spec/fixtures/appbundler-example-app/Gemfile
133
73
  - spec/fixtures/appbundler-example-app/Gemfile.lock.unix
134
74
  - spec/fixtures/appbundler-example-app/Gemfile.lock.windows
@@ -150,7 +90,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
150
90
  requirements:
151
91
  - - ">="
152
92
  - !ruby/object:Gem::Version
153
- version: '2.3'
93
+ version: '2.4'
154
94
  required_rubygems_version: !ruby/object:Gem::Requirement
155
95
  requirements:
156
96
  - - ">="
@@ -163,7 +103,6 @@ specification_version: 4
163
103
  summary: Extracts a dependency solution from bundler's Gemfile.lock to speed gem activation
164
104
  test_files:
165
105
  - spec/appbundler/app_spec.rb
166
- - spec/fixtures/appbundler-example-app/.bundle/config
167
106
  - spec/fixtures/appbundler-example-app/Gemfile
168
107
  - spec/fixtures/appbundler-example-app/Gemfile.lock.unix
169
108
  - spec/fixtures/appbundler-example-app/Gemfile.lock.windows
@@ -1,44 +0,0 @@
1
- # Documentation available at https://expeditor.chef.io/docs/getting-started/
2
- ---
3
- # Slack channel in Chef Software slack to send notifications about build failures, etc
4
- slack:
5
- notify_channel: chef-notify
6
-
7
- # This publish is triggered by the `built_in:publish_rubygems` artifact_action.
8
- rubygems:
9
- - appbundler
10
-
11
- github:
12
- # This deletes the GitHub PR branch after successfully merged into the release branch
13
- delete_branch_on_merge: true
14
- # The tag format to use (e.g. v1.0.0)
15
- version_tag_format: "v{{version}}"
16
- # allow bumping the minor release via label
17
- minor_bump_labels:
18
- - "Expeditor: Bump Version Minor"
19
- # allow bumping the major release via label
20
- major_bump_labels:
21
- - "Expeditor: Bump Version Major"
22
-
23
- changelog:
24
- rollup_header: Changes not yet released to rubygems.org
25
-
26
- # These actions are taken, in order they are specified, anytime a Pull Request is merged.
27
- merge_actions:
28
- - built_in:bump_version:
29
- ignore_labels:
30
- - "Expeditor: Skip Version Bump"
31
- - "Expeditor: Skip All"
32
- - bash:.expeditor/update_version.sh:
33
- only_if: built_in:bump_version
34
- - built_in:update_changelog:
35
- ignore_labels:
36
- - "Expeditor: Skip Changelog"
37
- - "Expeditor: Skip All"
38
- - built_in:build_gem:
39
- only_if: built_in:bump_version
40
-
41
- promote:
42
- actions:
43
- - built_in:rollover_changelog
44
- - built_in:publish_rubygems
@@ -1,12 +0,0 @@
1
- #!/bin/sh
2
- #
3
- # After a PR merge, Chef Expeditor will bump the PATCH version in the VERSION file.
4
- # It then executes this file to update any other files/components with that new version.
5
- #
6
-
7
- set -evx
8
-
9
- sed -i -r "s/^(\s*)VERSION = \".+\"/\1VERSION = \"$(cat VERSION)\"/" lib/appbundler/version.rb
10
-
11
- # Once Expeditor finshes executing this script, it will commit the changes and push
12
- # the commit as a new tag corresponding to the value in the VERSION file.
@@ -1,7 +0,0 @@
1
- # Order is important. The last matching pattern has the most precedence.
2
-
3
- * @chef/client-maintainers
4
- .expeditor/** @chef/jex-team
5
- README.md @chef/docs-team
6
- RELEASE_NOTES.md @chef/docs-team
7
- .github/ISSUE_TEMPLATE/** @chef/docs-team
@@ -1,29 +0,0 @@
1
- ---
2
- name: � Bug Report
3
- about: If something isn't working as expected �.
4
- labels: "Status: Untriaged"
5
- ---
6
-
7
- # Version:
8
-
9
- [Version of the project installed]
10
-
11
- # Environment:
12
-
13
- [Details about the environment such as the Operating System, cookbook details, etc...]
14
-
15
- # Scenario:
16
-
17
- [What you are trying to achieve and you can't?]
18
-
19
- # Steps to Reproduce:
20
-
21
- [If you are filing an issue what are the things we need to do in order to repro your problem?]
22
-
23
- # Expected Result:
24
-
25
- [What are you expecting to happen as the consequence of above reproduction steps?]
26
-
27
- # Actual Result:
28
-
29
- [What actually happens after the reproduction steps?]
@@ -1,40 +0,0 @@
1
- ---
2
- name: Design Proposal
3
- about: I have a significant change I would like to propose and discuss before starting
4
- labels: "Status: Untriaged"
5
- ---
6
-
7
- ### When a Change Needs a Design Proposal
8
-
9
- A design proposal should be opened any time a change meets one of the following qualifications:
10
-
11
- - Significantly changes the user experience of a project in a way that impacts users.
12
- - Significantly changes the underlying architecture of the project in a way that impacts other developers.
13
- - Changes the development or testing process of the project such as a change of CI systems or test frameworks.
14
-
15
- ### Why We Use This Process
16
-
17
- - Allows all interested parties (including any community member) to discuss large impact changes to a project.
18
- - Serves as a durable paper trail for discussions regarding project architecture.
19
- - Forces design discussions to occur before PRs are created.
20
- - Reduces PR refactoring and rejected PRs.
21
-
22
- ---
23
-
24
- <!--- Proposal description and rationale. -->
25
-
26
- ## Motivation
27
-
28
- <!---
29
- As a <<user_profile>>,
30
- I want to <<functionality>>,
31
- so that <<benefit>>.
32
- -->
33
-
34
- ## Specification
35
-
36
- <!--- A detailed description of the planned implementation. -->
37
-
38
- ## Downstream Impact
39
-
40
- <!--- Which other tools will be impacted by this work? -->
@@ -1,17 +0,0 @@
1
- ---
2
- name: 🚀 Enhancement Request
3
- about: I have a suggestion (and may want to implement it 🙂)!
4
- labels: "Status: Untriaged"
5
- ---
6
-
7
- ### Describe the Enhancement:
8
- <!--- What you are trying to achieve that you can't? -->
9
-
10
- ### Describe the Need:
11
- <!--- What kind of user do you believe would utilize this enhancement, and how many users might want this functionality -->
12
-
13
- ### Current Alternative
14
- <!--- Is there a current alternative that you can utilize to workaround the lack of this enhancement -->
15
-
16
- ### Can We Help You Implement This?:
17
- <!--- The best way to ensure your enhancement is built is to help implement the enhancement yourself. If you're interested in helping out we'd love to give you a hand to make this possible. Let us know if there's something you need. -->
@@ -1,12 +0,0 @@
1
- ---
2
- name: 🤗 Support Question
3
- about: If you have a question 💬, please check out our Slack!
4
- ---
5
-
6
- We use GitHub issues to track bugs and feature requests. If you need help please post to our Mailing List or join the Chef Community Slack.
7
-
8
- * Chef Community Slack at http://community-slack.chef.io/.
9
- * Chef Mailing List https://discourse.chef.io/
10
-
11
-
12
- Support issues opened here will be closed and redirected to Slack or Discourse.
@@ -1,15 +0,0 @@
1
- ### Description
2
-
3
- [Please describe what this change achieves]
4
-
5
- ### Issues Resolved
6
-
7
- [List any existing issues this PR resolves, or any Discourse or
8
- StackOverflow discussions that are relevant]
9
-
10
- ### Check List
11
-
12
- - [ ] New functionality includes tests
13
- - [ ] All tests pass
14
- - [ ] All commits have been signed-off for the Developer Certificate of Origin. See <https://github.com/chef/chef/blob/master/CONTRIBUTING.md#developer-certification-of-origin-dco>
15
- - [ ] PR title is a worthy inclusion in the CHANGELOG
@@ -1 +0,0 @@
1
- daysUntilLock: 60
data/.gitignore DELETED
@@ -1,19 +0,0 @@
1
- *.gem
2
- *.rbc
3
- /.bundle
4
- b
5
- binstubs
6
- .config
7
- .yardoc
8
- Gemfile.lock
9
- InstalledFiles
10
- _yardoc
11
- coverage
12
- doc/
13
- lib/bundler/man
14
- pkg
15
- rdoc
16
- spec/reports
17
- test/tmp
18
- test/version_tmp
19
- tmp
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- -c
2
- -f doc
@@ -1,23 +0,0 @@
1
- language: ruby
2
- cache: bundler
3
- dist: xenial
4
-
5
- before_install:
6
- - gem update --system
7
- - gem install bundler || true
8
-
9
- rvm:
10
- - 2.3.8
11
- - 2.4.5
12
- - 2.5.5
13
- - 2.6.2
14
-
15
- branches:
16
- only:
17
- - master
18
-
19
- install:
20
- - bundle install --jobs 3 --retry 3
21
-
22
- # The integration tests need to see installed gems.
23
- script: rspec --color --format progress
@@ -1,46 +0,0 @@
1
- # Appbundler CHANGELOG
2
-
3
- This file is used to document the changes between releases of Appbundler
4
-
5
- <!-- latest_release 0.12.5 -->
6
- ## [v0.12.5](https://github.com/chef/appbundler/tree/v0.12.5) (2019-04-24)
7
-
8
- #### Merged Pull Requests
9
- - Pull binstubs from the app dir instead of gem dir [#54](https://github.com/chef/appbundler/pull/54) ([lamont-granquist](https://github.com/lamont-granquist))
10
- <!-- latest_release -->
11
-
12
- <!-- release_rollup since=0.12.4 -->
13
- ### Changes not yet released to rubygems.org
14
-
15
- #### Merged Pull Requests
16
- - Pull binstubs from the app dir instead of gem dir [#54](https://github.com/chef/appbundler/pull/54) ([lamont-granquist](https://github.com/lamont-granquist)) <!-- 0.12.5 -->
17
- <!-- release_rollup -->
18
-
19
- <!-- latest_stable_release -->
20
- ## [v0.12.4](https://github.com/chef/appbundler/tree/v0.12.4) (2019-04-24)
21
-
22
- #### Merged Pull Requests
23
- - add --binstub-source option [#53](https://github.com/chef/appbundler/pull/53) ([lamont-granquist](https://github.com/lamont-granquist))
24
- <!-- latest_stable_release -->
25
-
26
- ## [v0.12.3](https://github.com/chef/appbundler/tree/v0.12.3) (2019-04-17)
27
-
28
- #### Merged Pull Requests
29
- - syntax fix [#52](https://github.com/chef/appbundler/pull/52) ([lamont-granquist](https://github.com/lamont-granquist))
30
-
31
- ## [v0.12.2](https://github.com/chef/appbundler/tree/v0.12.2) (2019-04-16)
32
-
33
- #### Merged Pull Requests
34
- - fix syntax for cli options [#51](https://github.com/chef/appbundler/pull/51) ([lamont-granquist](https://github.com/lamont-granquist))
35
-
36
- ## [v0.12.1](https://github.com/chef/appbundler/tree/v0.12.1) (2019-04-16)
37
-
38
- #### Merged Pull Requests
39
- - add support for extra bin files not in the binstubs [#50](https://github.com/chef/appbundler/pull/50) ([lamont-granquist](https://github.com/lamont-granquist))
40
-
41
- ## [v0.12.0](https://github.com/chef/appbundler/tree/v0.12.0) (2019-03-18)
42
-
43
- #### Merged Pull Requests
44
- - Update README.md [#47](https://github.com/chef/appbundler/pull/47) ([markan](https://github.com/markan))
45
- - Require ruby 2.3+ and loosen gem deps [#48](https://github.com/chef/appbundler/pull/48) ([tas50](https://github.com/tas50))
46
- - Fix the labels to properly bump the gem [#49](https://github.com/chef/appbundler/pull/49) ([tas50](https://github.com/tas50))
@@ -1 +0,0 @@
1
- Please refer to the Chef Community Code of Conduct at https://www.chef.io/code-of-conduct/
@@ -1 +0,0 @@
1
- Please refer to https://github.com/chef/chef/blob/master/CONTRIBUTING.md
data/README.md DELETED
@@ -1,204 +0,0 @@
1
- # Appbundler
2
-
3
- [![Build Status Master](https://travis-ci.org/chef/appbundler.svg?branch=master)](https://travis-ci.org/chef/appbundler) [![Gem Version](https://badge.fury.io/rb/appbundler.svg)](https://badge.fury.io/rb/appbundler)
4
-
5
- Appbundler reads a Gemfile.lock and generates code with `gem "some-dep", "= VERSION"` statements to lock the app's dependencies to the versions selected by bundler. This code is used in binstubs for the application so that running (e.g.) `chef-client` on the command line activates the locked dependencies for `chef` before running the command.
6
-
7
- This provides the following benefits:
8
-
9
- - The application loads faster because rubygems is not resolving dependency constraints at runtime.
10
- - The application runs with the same dependencies that it would if bundler was used, so we can test applications (that will be installed in an omnibus package) using the default bundler workflow.
11
- - There's no need to `bundle exec` or patch the bundler runtime into the app.
12
- - The app can load gems not included in the Gemfile/gemspec. Our use case for this is to load plugins (e.g., for knife and test kitchen).
13
- - A user can use rvm and still use the application (see below).
14
- - The application is protected from installation of incompatible dependencies.
15
-
16
- ## ChefDK Usage
17
-
18
- ### Primary Design
19
-
20
- The 3-argument form of appbundler is used in ChefDK (and should be used elsewhere) to pin multiple apps in the same omnibus install against one master Gemfile.lock.
21
-
22
- When used this way appbundler takes three arguments: the lockdir containing the main Gemfile.lock of the omnibus package, the bindir to install the binstubs to, and
23
- the gem to appbundle. In this way all the gems in the omnibus app should be appbundled against the same Gemfile.lock. The omnibus software definition should bundle install
24
- this Gemfile.lock prior to appbundling.
25
-
26
- This will pin all of the bunstubs against every gem in the referenced Gemfile.lock. This is equivalent and identical behavior to copying the Gemfile.lock to a
27
- directory, running `bundle install` and then using `bundle exec` to launch any of the applications. The only major difference is that the appbundle pins apply only to the
28
- gems in the gemfile, while `bundle exec` will prevent any other external gems from being able to be loaded into the gemset.
29
-
30
- The design goals are brutally simple -- replicating the effects of `bundle exec` against the master Gemfile.lock while allowing the gemset to be open.
31
-
32
- ### Preventing duplicate gems
33
-
34
- One of the features of this approach are that it becomes guaranteed that there will be no duplicate gems. In order for this to be true, however, all gems must be installed
35
- only from the master Gemfile.lock (and only one version of a gem may appear in any valid Gemfile.lock). If the omnibus projects does anything other than a single
36
- `bundle install` against the master Gemfile.lock to install gems then there likely will be multiple gems installed. IF the apps are appbundled correctly, however, this
37
- will still not have any negative effects since all runtime gems are pinned.
38
-
39
- Historically this issue has caused problems due to transitive dep issues causing different version of gems to be loaded based on which application was launched which would
40
- later cause gem conflicts. It also simply caused user confusion.
41
-
42
- ### Preventing transitive gem issues
43
-
44
- Given that ChefDK and most chef applications are open pluggable architectures any arbitrary gems may be loaded lazily at runtime long after the initial application has
45
- launched. The classic example of the kind of bug which occurs is external third-party knife-plugins which require gems that are not part of the chef-client/knife
46
- gemset but which collide with the explict pins on berkshelf. Since the command line invocation is `knife` the berkshelf gem pins were not applied up front, a lazy
47
- load of the transitive gem was then executed which activated the latest version which was installed with the knife plugin, then berkshelf was activated which would
48
- conflict due to a pessimistic pin in the berksehlf gemspec itself.
49
-
50
- While this is a complicated set of events it was actually fairly commonly reported:
51
-
52
- * https://github.com/chef/chef-dk/issues/1187
53
- * https://github.com/chef/chef-dk/issues/281
54
- * https://github.com/berkshelf/berkshelf/issues/1357
55
- * https://stackoverflow.com/questions/31906153/chef-gemconflicterror-when-running-knife-bootstrap-windows
56
- * https://github.com/chef/chef-dk/issues/603
57
-
58
- The aggressive pinning of all gems in the Gemfile.lock against all apps in the Gemfile.lock have eliminated this complaint entirely.
59
-
60
- ### Appbundler and bundler coexistance
61
-
62
- Since this approach is deliberately inflexible against updating the appbundle pins in order to prevent transitive gem issues, it is instead possible and encouraged to
63
- use Gemfile and bundler as usual. If the binstubs detect that they are running from within bundler against an external Gemfile.lock they do not apply any pins
64
- at all.
65
-
66
- * https://github.com/chef/chef-dk/issues/1547
67
- * https://github.com/chef/appbundler/pull/43
68
-
69
- ### Encouraged use of bundler by end users
70
-
71
- The ability to patch an existing omnibus built package is not well supported. What it would result in would be the user taking the application Gemfile and
72
- patching it manually and producing a Gemfile.lock which was solved correctly and then running appubndler against that Gemfile.lock for all the applications in
73
- the bundle. The difficult part is obviously the user updating the Gemfile.lock which cannot be automated and ultimately boils down to the process that we
74
- use internally to solve gem conflict problems and produce the Gemfile.lock as an acutal product by experts.
75
-
76
- What is vastly simpler is to create Gemfiles and use bundler to solve specific issues. In particular the problem of new ChefDK (e.g. ChefDK 3.x) managing
77
- old chef-client (e.g. 12.x) can be solved via bundler in one specific case. For knife and test-kitchen the bootstrapped version of chef-client on the target
78
- host is entirely configurable in those tools. The only major conflict is in the use of chefspec. For that use case, users are encouraged to create a much
79
- more simplified Gemfile with a pinned chef version, berkshelf and chefspec and to `bundle install` and `bundle exec rspec` against the Gemfile.lock. This
80
- targeted use of bundler is vastly simpler than attempting to create a Chef-12 "version" of ChefDK 3.x.
81
-
82
- The alternative of trying to rebuild appbundled binstubs against an already built Chef-DK is documented here and is terrible idea:
83
-
84
- https://github.com/chef/chef-dk/issues/1559#issuecomment-468103827
85
-
86
- ### BUG: you cannot install git gems using this method
87
-
88
- This is simply a bug, although in practice it has turned into a feature. You should never ship git checked out non production released gems to customers, so should
89
- always be doing downstream gem releases in order to consume them in omnibus builds. If this becomes a blocker this bug should just be fixed, but in practice this
90
- has been a feature that has pushed development down the correct path.
91
-
92
- ### ChefDK transitive development gem Gemfile.locking madness
93
-
94
- A sub-concern and design goal of the three-argument mega-Gemfile.lock appbundling feature is decoupling the purely development gem dependencies of sub-applications
95
- from each other. This feature should perhaps have been designed to be decoupled, but since the whole feature was written somewhat "tactically" (aka "code rage")
96
- to deal with the complexity of the ChefDK builds and this feature is necessary there and came along for the ride.
97
-
98
- The ChefDK Gemfile.lock is already hard enough to build as it is, and it does not include any of the development gems for its sub-applications (berkshelf, test-kitchen,
99
- foodcritic, chefspec, etc, etc, etc). It is already difficult enough to generate a sane single runtime closure across all the runtime gems. The development gems used
100
- to test berkshelf, etc should not be shipped in the omnibus build. It is also an enormous amount of developer pain to keep the development gems consistent across all
101
- of those projects, particularly when several of them are or historically were external to the company.
102
-
103
- The result of that was a feature of the three argument version of appbundler where it takes the pins from the master ChefDK Gemfile.lock and merges those with the
104
- gem statements in the Gemfile of the application (e.g. berkshelf) and then creates a combined Gemfile.lock which is written out in the gem directory. So for ChefDK
105
- 3.8.14 the combined Gemfile.lock which is created for berkshelf is:
106
-
107
- ```
108
- /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/berkshelf-7.0.7/.appbundler-gemfile20190227-93370-84j06u.lock
109
- ```
110
-
111
- That Gemfile.lock is only solved, but not installed at build time when appbundler runs (`bundle lock` not `bundle update/install`) so that the development gems are not
112
- shipped. In the testing phase of CI a `bundle install` is run against that so that all the development gems are installed on the testing box, all the pins in the
113
- master Gemfile.lock will be applied (and those gems are already installed) and all the development gems of the app are installed with the constraints specified in
114
- the Gemfile of the application. The testing suite is then run via `bundle exec` against this Gemfile.lock via the `chef test` command.
115
-
116
- This ensures that we test the app against every gem pin that we ship, while we allow dev pins between different apps to potentially conflict since those have meaning
117
- only to the app in question.
118
-
119
- Yes, this is complicated, but the alternative(s) would be to either bake every dev gem into the master Gemfile.lock and take the pain of reconciling otherwise meaningless
120
- gem conficts, or to allow gems to float outside of the Gemfile.lock pins and to be guaranteed of shipping defects sooner or later due to not testing against exactly
121
- what we ship.
122
-
123
- For any consumers outside of ChefDK this Gemfile.lock being created can happily be entirely ignored and it won't hurt you at all.
124
-
125
- ### The meaning of the --without arg is not what you think
126
-
127
- The --without argument to appbundler in the three argument version does not apply to the installed gemset (that is handled entirely by the one `bundle install` which
128
- should be run against the master Gemfile.lock before appbundler runs) and it does not apply to the appbundled binstubs.
129
-
130
- What the --without argument does is affect the rendered transitive gemfile.lock and is used to filter out unnecessary dependencies which conflict with the master
131
- Gemfile.lock in the omnibus project. A notable example of this was the github-changelog-generator gem which would pin gems (like `addressable`) to restrictive pins
132
- and would not solve against the ChefDK master Gemfile.lock. If github-changelog-generator was in a `:changelog` group it could then be excluded here, and it would not
133
- conflict during generation of the transitive per-app gemfile.lock.
134
-
135
- This argument does not affect the shipping apps in the omnibus build (that should be handled by `--without` arguments to the `bundle install`) or affect the generated
136
- binstubs. It is only in the codepath of the transitive lock generation and only affects the groups defined in the sub-application's Gemfile.
137
-
138
- The `--without` argument was also added to the 3-argument version of appbundler specifically to handle this issue. It is silently ignored on the 2-argument version.
139
-
140
- ## Usage
141
-
142
- Install via rubygems: `gem install appbundler` or clone this project and bundle install:
143
-
144
- ```shell
145
- git clone https://github.com/chef/appbundler.git
146
- cd appbundler
147
- bundle install
148
- ```
149
-
150
- Clone whatever project you want to appbundle somewhere else, and bundle install it:
151
-
152
- ```shell
153
- mkdir ~/oc
154
- cd ~/oc
155
- git clone https://github.com/chef/chef.git
156
- cd chef
157
- bundle install
158
- ```
159
-
160
- Create a bin directory where your bundled binstubs will live:
161
-
162
- ```shell
163
- mkdir ~/appbundle-bin
164
- # Add to your PATH if you like
165
- ```
166
-
167
- Now you can app bundle your project (chef in our example):
168
-
169
- ```shell
170
- bin/appbundler ~/oc/chef ~/appbundler-bin
171
- ```
172
-
173
- Now you can run all of the app's executables with locked down deps:
174
-
175
- ```shell
176
- ~/appbundler-bin/chef-client -v
177
- ```
178
-
179
- ## RVM
180
-
181
- The generated binstubs explicitly disable rvm, so the above won't work if you're using rvm. This is intentional, because our use case is for omnibus applications where rvm's environment variables can break the embedded application by making ruby look for gems in rvm's gem repo.
182
-
183
- ## Contributing
184
-
185
- For information on contributing to this project see <https://github.com/chef/chef/blob/master/CONTRIBUTING.md>
186
-
187
- ## License
188
-
189
- - Copyright:: Copyright (c) 2014-2016 Chef Software, Inc.
190
- - License:: Apache License, Version 2.0
191
-
192
- ```text
193
- Licensed under the Apache License, Version 2.0 (the "License");
194
- you may not use this file except in compliance with the License.
195
- You may obtain a copy of the License at
196
-
197
- http://www.apache.org/licenses/LICENSE-2.0
198
-
199
- Unless required by applicable law or agreed to in writing, software
200
- distributed under the License is distributed on an "AS IS" BASIS,
201
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202
- See the License for the specific language governing permissions and
203
- limitations under the License.
204
- ```
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.12.5
@@ -1,2 +0,0 @@
1
- ---
2
- BUNDLE_WITHOUT: "something"