cartage-rack 2.2 → 2.3

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
- SHA1:
3
- metadata.gz: 2465d098dc1c5b15660734a754de4665cff292af
4
- data.tar.gz: e48adff2eed98b3ce4c5ce3e0079535882bb7c02
2
+ SHA256:
3
+ metadata.gz: c6357c37ee4d9d28e1f86c9c9b6faf08e1055cbc984728e5b36fdfee1ed6d5f6
4
+ data.tar.gz: e9a6fb9b02d54955114bddfe1dfa33c36232da0fe940f5ad10a884245ae55f08
5
5
  SHA512:
6
- metadata.gz: 3bce5c5f612e32ba55a271b64629632f89ba59a1c063d6a314af921698fb1dcad47d24ec2d9d965f3d4fc55016fe6cf916d583ba6396c749f79972fb32fb7f23
7
- data.tar.gz: 487205fedd6cb0ad42a54a36c2c1fe0f6f17f9dcc73156ca1d9ad02923b613885ecb2c5194cf5b1b8a20a706aa5f3c698d523c6d7ac28131b052349e49badb7e
6
+ metadata.gz: 74dc05db4625ba79f1cf4001f39381aef8d44ad3bcd62553372a501e1109c42ad7cda2ebafc925a0b1b45617f15486309cd44ffd2324160d307f7f28699ae7b7
7
+ data.tar.gz: e22dc98cd990f1b15b90fe9f68efb30b6bb082b0cc3ffded72ee124e0ea4b15bf0c9fe169963691d3512a9f121e6f61623d81c98d1fc8bae5dc3938757d230cd
data/History.md CHANGED
@@ -1,55 +1,81 @@
1
- ### 2.2 / 2018-03-23
1
+ # Change History
2
2
 
3
- * Add support for ENV['APP_ENV'] per Sinatra documentation recommendations.
3
+ ## 2.3 / 2022-12-16
4
4
 
5
- ### 2.1 / 2016-06-28
5
+ This is primarily a (mostly-mechanical) modernization of the codebase,
6
+ bringing it up to Kinetic Commerce 2022 standards.
6
7
 
7
- * Fix default env issue where ENV['RAILS_ENV'] nor ENV['RACK_ENV'] is set
8
- by adding default string.
8
+ - Remove dead development files: `.autotest`, `.gemtest`, `.minitest.rb`,
9
+ `.rubocop.yml`, `.simplecov-prelude.rb`, `.travis.yml`
9
10
 
10
- ### 2.0 / 2016-05-31
11
+ - Add new development files: `.github/workflows/ruby.yml`, `.rdoc_options`,
12
+ `.standard.yml`, `Appraisals`, `gemfiles/*.gemfile`
11
13
 
12
- * Rewrote for compatibility with cartage 2.0.
14
+ - Clean up configuration: `.gitignore`, `.hoerc`, `Rakefile`
13
15
 
14
- * Renamed Cartage::Rack to Cartage::Rack::Simple and created a *new*
15
- Cartage::Rack that returns more information.
16
+ - Updated generated files: `Manifest.txt`, `cartage-rack.gemspec`
16
17
 
17
- * Extracted metadata gathering out of Cartage::Rack and into
18
- Cartage::Rack::Metadata.
18
+ - Renamed `test/minitest_config.rb` to `test/minitest_helper.rb` to reflect
19
+ consistent naming.
19
20
 
20
- * Deprecated Cartage::Rack.mount in favour of Cartage::Rack() and
21
- Cartage::Rack::Simple() methods.
21
+ - Removed `context` alias for `describe`.
22
22
 
23
- * 1 governance change
23
+ - Apply formatting from `standardrb` after dropping raw rubocop.
24
24
 
25
- * cartage-rack is now under the Kinetic Cafe Open Source [Code of
26
- Conduct][kccoc].
25
+ - Sunset cartage-rack as of this version.
27
26
 
28
- ### 1.1 / 2015-04-11
27
+ ## 2.2 / 2018-03-23
29
28
 
30
- * 2 minor enhancements
29
+ - Add support for ENV['APP_ENV'] per Sinatra documentation recommendations.
31
30
 
32
- * Implemented Cartage::Rack#inspect to prevent `rake routes` from
33
- presenting badly.
31
+ ## 2.1 / 2016-06-28
34
32
 
35
- * Preparing for a future Cartage change to the contents of the
36
- `release_hashref` file. The future `release_hashref` will be two lines:
33
+ - Fix default env issue where ENV['RAILS_ENV'] nor ENV['RACK_ENV'] is set
34
+ by adding default string.
37
35
 
38
- hashref
39
- timestamp
36
+ ## 2.0 / 2016-05-31
40
37
 
41
- If `release_hashref` has two lines, the timestamp will be included in
42
- the response. A timestamp will not be included if there is no
43
- `release_hashref` file.
38
+ - Rewrote for compatibility with cartage 2.0.
44
39
 
45
- * 1 development change
40
+ - Renamed Cartage::Rack to Cartage::Rack::Simple and created a _new_
41
+ Cartage::Rack that returns more information.
46
42
 
47
- * Implemented tests for Cartage::Rack.
43
+ - Extracted metadata gathering out of Cartage::Rack and into
44
+ Cartage::Rack::Metadata.
48
45
 
49
- ### 1.0 / 2015-03-20
46
+ - Deprecated Cartage::Rack.mount in favour of Cartage::Rack() and
47
+ Cartage::Rack::Simple() methods.
50
48
 
51
- * 1 major enhancement
49
+ - 1 governance change
52
50
 
53
- * Birthday!
51
+ - cartage-rack is now under the Kinetic Cafe Open Source [Code of
52
+ Conduct][kccoc].
53
+
54
+ ## 1.1 / 2015-04-11
55
+
56
+ - 2 minor enhancements
57
+
58
+ - Implemented Cartage::Rack#inspect to prevent `rake routes` from
59
+ presenting badly.
60
+
61
+ - Preparing for a future Cartage change to the contents of the
62
+ `release_hashref` file. The future `release_hashref` will be two lines:
63
+
64
+ hashref
65
+ timestamp
66
+
67
+ If `release_hashref` has two lines, the timestamp will be included in
68
+ the response. A timestamp will not be included if there is no
69
+ `release_hashref` file.
70
+
71
+ - 1 development change
72
+
73
+ - Implemented tests for Cartage::Rack.
74
+
75
+ ## 1.0 / 2015-03-20
76
+
77
+ - 1 major enhancement
78
+
79
+ - Birthday!
54
80
 
55
81
  [kccoc]: https://github.com/KineticCafe/code-of-conduct
data/Manifest.txt CHANGED
@@ -7,7 +7,7 @@ Rakefile
7
7
  lib/cartage/rack.rb
8
8
  lib/cartage/rack/metadata.rb
9
9
  lib/cartage/rack/simple.rb
10
- test/minitest_config.rb
10
+ test/minitest_helper.rb
11
11
  test/test_cartage_rack.rb
12
12
  test/test_cartage_rack_metadata.rb
13
13
  test/test_cartage_rack_simple.rb
data/README.rdoc CHANGED
@@ -6,14 +6,19 @@ continuous integration :: {<img src="https://travis-ci.org/KineticCafe/cartage-r
6
6
 
7
7
  == Description
8
8
 
9
- cartage-rack is a plug-in for {cartage}[https://github.com/KineticCafe/cartage]
10
- to provide a Rack application that reports on release metadata.
11
-
12
- Cartage provides a repeatable means to create a package for a Rails application
13
- that can be used in deployment with a configuration tool like Ansible, Chef,
14
- Puppet, or Salt. The package is created with its dependencies bundled in
15
- +vendor/bundle+, so it can be deployed in environments with strict access
16
- control rules and without requiring development tool access.
9
+ This release is the *last* version of cartage-rack. It will be replaced with
10
+ a different tool in the future, but this release will allow installation in
11
+ modern Ruby versions.
12
+
13
+ cartage-rack is a plug-in for
14
+ {cartage}[https://github.com/KineticCafe/cartage] to provide a Rack
15
+ application that reports on release metadata.
16
+
17
+ Cartage provides a repeatable means to create a package for a Rails
18
+ application that can be used in deployment with a configuration tool like
19
+ Ansible, Chef, Puppet, or Salt. The package is created with its dependencies
20
+ bundled in +vendor/bundle+, so it can be deployed in environments with strict
21
+ access control rules and without requiring development tool access.
17
22
 
18
23
  == Synopsis
19
24
 
data/Rakefile CHANGED
@@ -1,68 +1,71 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'rubygems'
4
- require 'hoe'
5
- require 'rake/clean'
3
+ require "rubygems"
4
+ require "hoe"
5
+ require "rake/clean"
6
6
 
7
7
  Hoe.plugin :doofus
8
- Hoe.plugin :email unless ENV['CI'] || ENV['TRAVIS']
9
8
  Hoe.plugin :gemspec2
10
- Hoe.plugin :git
11
- Hoe.plugin :minitest
9
+ Hoe.plugin :git2
12
10
  Hoe.plugin :rubygems
13
- Hoe.plugin :travis
14
11
 
15
- spec = Hoe.spec 'cartage-rack' do
16
- developer('Austin Ziegler', 'aziegler@kineticcafe.com')
12
+ Hoe.spec "cartage-rack" do
13
+ developer("Austin Ziegler", "aziegler@kineticcommerce.com")
14
+ developer("Kinetic Commerce", "dev@kineticcommerce.com")
17
15
 
18
- self.history_file = 'History.md'
19
- self.readme_file = 'README.rdoc'
16
+ self.history_file = "History.md"
17
+ self.readme_file = "README.rdoc"
20
18
 
21
- license 'MIT'
22
-
23
- ruby20!
24
-
25
- # This gem *explicitly* does not have a hard link to cartage.
19
+ # This is a hack because of an issue with Hoe 3.26, but I'm not sure which
20
+ # hoe version introduced this issue or if it's a JRuby issue. This issue is
21
+ # demonstrable in lib/hoe.rb at line 676, which is (reformatted for space):
22
+ #
23
+ # ```ruby
24
+ # readme =
25
+ # input
26
+ # .lines
27
+ # .chunk { |l| l[/^(?:=+|#+)/] || "" } # # chunk is different somehow
28
+ # .map(&:last) # <-- HERE: "#" does not respond to #last
29
+ # .each_slice(2)
30
+ # .map { |k, v|
31
+ # kp = k.join
32
+ # kp = kp.strip.chomp(":").split.last.downcase if k.size == 1
33
+ # [kp, v.join.strip]
34
+ # }
35
+ # .to_h
36
+ # ```
37
+ #
38
+ # We don't *ship* with JRuby, but use it in CI only, so this is here at least
39
+ # temporarily.
40
+ if RUBY_PLATFORM.match?(/java/)
41
+ self.summary = self.description = "Description for testing"
42
+ self.homepage = "https://github.com/KineticCafe/app-identity/tree/main/ruby/"
43
+ end
26
44
 
27
- extra_dev_deps << ['rake', '>= 10.0']
28
- extra_dev_deps << ['rdoc', '~> 4.2']
29
- extra_dev_deps << ['rack-test', '~> 0.6']
30
- extra_dev_deps << ['hoe-doofus', '~> 1.0']
31
- extra_dev_deps << ['hoe-gemspec2', '~> 1.1']
32
- extra_dev_deps << ['hoe-git', '~> 1.5']
33
- extra_dev_deps << ['hoe-travis', '~> 1.2']
34
- extra_dev_deps << ['minitest', '~> 5.4']
35
- extra_dev_deps << ['minitest-autotest', '~> 1.0']
36
- extra_dev_deps << ['minitest-bisect', '~> 1.2']
37
- extra_dev_deps << ['minitest-bonus-assertions', '~> 2.0']
38
- extra_dev_deps << ['minitest-focus', '~> 1.1']
39
- extra_dev_deps << ['minitest-hooks', '~> 1.4']
40
- extra_dev_deps << ['minitest-moar', '~> 0.0']
41
- extra_dev_deps << ['minitest-pretty_diff', '~> 0.1']
42
- extra_dev_deps << ['timecop', '~> 0.8']
43
- extra_dev_deps << ['simplecov', '~> 0.7']
44
- end
45
+ license "MIT"
45
46
 
46
- ENV['RUBYOPT'] = '-W0'
47
+ require_ruby_version ">= 2.7", "< 4"
47
48
 
48
- module Hoe::Publish #:nodoc:
49
- alias __make_rdoc_cmd__cartage__ make_rdoc_cmd
49
+ spec_extras[:metadata] = ->(val) { val["rubygems_mfa_required"] = "true" }
50
50
 
51
- def make_rdoc_cmd(*extra_args) # :nodoc:
52
- spec.extra_rdoc_files.delete_if { |f| f == 'Manifest.txt' }
53
- __make_rdoc_cmd__cartage__(*extra_args)
54
- end
55
- end
56
-
57
- if File.exist?('.simplecov-prelude.rb')
58
- namespace :test do
59
- task :coverage do
60
- spec.test_prelude = 'load ".simplecov-prelude.rb"'
61
- Rake::Task['test'].execute
62
- end
51
+ # This gem *explicitly* does not have a hard link to cartage.
63
52
 
64
- CLOBBER << 'coverage'
65
- end
53
+ extra_dev_deps << ["appraisal", "~> 2.4"]
54
+ extra_dev_deps << ["hoe-doofus", "~> 1.0"]
55
+ extra_dev_deps << ["hoe-gemspec2", "~> 1.1"]
56
+ extra_dev_deps << ["hoe-git2", "~> 1.7"]
57
+ extra_dev_deps << ["hoe-rubygems", "~> 1.0"]
58
+ extra_dev_deps << ["minitest", "~> 5.16"]
59
+ extra_dev_deps << ["minitest-autotest", "~> 1.0"]
60
+ extra_dev_deps << ["minitest-bisect", "~> 1.2"]
61
+ extra_dev_deps << ["minitest-focus", "~> 1.1"]
62
+ extra_dev_deps << ["minitest-hooks", "~> 1.4"]
63
+ extra_dev_deps << ["minitest-moar", "~> 0.0"]
64
+ extra_dev_deps << ["minitest-pretty_diff", "~> 0.1"]
65
+ extra_dev_deps << ["rack-test", "~> 2.0"]
66
+ extra_dev_deps << ["rake", ">= 10.0", "< 14"]
67
+ extra_dev_deps << ["rdoc", "~> 6.4"]
68
+ extra_dev_deps << ["simplecov", "~> 0.7"]
69
+ extra_dev_deps << ["standard", "~> 1.0"]
70
+ extra_dev_deps << ["timecop", "~> 0.8"]
66
71
  end
67
-
68
- CLOBBER << 'tmp'
@@ -1,14 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'pathname'
4
- require 'json'
3
+ require "pathname"
4
+ require "json"
5
5
 
6
6
  ##
7
7
  # A representation for Cartage metadata for use with Cartage::Rack and
8
8
  # Cartage::Rack::Simple.
9
9
  class Cartage::Rack::Metadata
10
- METADATA_CLEANER = ->(_, v) { #:nodoc:
11
- v.delete_if(&METADATA_CLEANER) if v.kind_of?(Hash)
10
+ METADATA_CLEANER = ->(_, v) { # :nodoc:
11
+ v.delete_if(&METADATA_CLEANER) if v.is_a?(Hash)
12
12
  v.nil? || (v.respond_to?(:empty?) && v.empty?)
13
13
  }
14
14
  private_constant :METADATA_CLEANER
@@ -31,7 +31,7 @@ class Cartage::Rack::Metadata
31
31
  @filter = filter
32
32
  @content = read_release_metadata_json || read_release_hashref
33
33
 
34
- fail 'Cannot find release-metadata.json or release_hashref' if required && !@content
34
+ fail "Cannot find release-metadata.json or release_hashref" if required && !@content
35
35
 
36
36
  @source ||= :live
37
37
  end
@@ -41,11 +41,11 @@ class Cartage::Rack::Metadata
41
41
  # content data.
42
42
  def resolve
43
43
  content.merge(application_env).tap do |data|
44
- @filter.call(data) if @filter
44
+ @filter&.call(data)
45
45
  end.delete_if(&METADATA_CLEANER)
46
46
  end
47
47
 
48
- def inspect #:nodoc:
48
+ def inspect # :nodoc:
49
49
  "#{@root_path.expand_path.basename} (#{@source})"
50
50
  end
51
51
 
@@ -53,7 +53,7 @@ class Cartage::Rack::Metadata
53
53
 
54
54
  def application_env
55
55
  @application_env ||= {
56
- 'env' => { 'name' => ENV['RAILS_ENV'] || ENV['APP_ENV'] || ENV['RACK_ENV'] || 'UNKNOWN' }
56
+ "env" => {"name" => ENV["RAILS_ENV"] || ENV["APP_ENV"] || ENV["RACK_ENV"] || "UNKNOWN"}
57
57
  }
58
58
  end
59
59
 
@@ -61,24 +61,24 @@ class Cartage::Rack::Metadata
61
61
  return @content if @content
62
62
 
63
63
  {
64
- 'package' => {}
64
+ "package" => {}
65
65
  }.tap do |result|
66
- package = result['package']
67
- package['name'] = @root_path.basename.to_s
68
- package['hashref'] = release_hashref
69
- package['timestamp'] = Time.now.utc.strftime('%Y%m%d%H%M%S')
66
+ package = result["package"]
67
+ package["name"] = @root_path.basename.to_s
68
+ package["hashref"] = release_hashref
69
+ package["timestamp"] = Time.now.utc.strftime("%Y%m%d%H%M%S")
70
70
 
71
71
  if repo?
72
- package['repo'] = {
73
- 'type' => 'git', # Hardcoded until we have other support
74
- 'url' => repo_url
72
+ package["repo"] = {
73
+ "type" => "git", # Hardcoded until we have other support
74
+ "url" => repo_url
75
75
  }
76
76
  end
77
77
  end
78
78
  end
79
79
 
80
80
  def read_release_metadata_json
81
- file = @root_path.join('release-metadata.json')
81
+ file = @root_path.join("release-metadata.json")
82
82
 
83
83
  return unless file.exist?
84
84
 
@@ -87,7 +87,7 @@ class Cartage::Rack::Metadata
87
87
  end
88
88
 
89
89
  def read_release_hashref
90
- file = @root_path.join('release_hashref')
90
+ file = @root_path.join("release_hashref")
91
91
 
92
92
  return unless file.exist?
93
93
 
@@ -96,10 +96,10 @@ class Cartage::Rack::Metadata
96
96
  hashref, timestamp, = file.read.split($/)
97
97
 
98
98
  {
99
- 'package' => {
100
- 'name' => @root_path.basename.to_s,
101
- 'hashref' => hashref,
102
- 'timestamp' => timestamp
99
+ "package" => {
100
+ "name" => @root_path.basename.to_s,
101
+ "hashref" => hashref,
102
+ "timestamp" => timestamp
103
103
  }
104
104
  }.delete_if(&METADATA_CLEANER)
105
105
  end
@@ -107,22 +107,22 @@ class Cartage::Rack::Metadata
107
107
  def repo_url
108
108
  return unless repo?
109
109
  unless defined?(@repo_url)
110
- @repo_url = %x(git remote show -n origin).
111
- match(/\n\s+Fetch URL: (?<fetch>[^\n]+)/)[:fetch]
110
+ @repo_url = `git remote show -n origin`
111
+ .match(/\n\s+Fetch URL: (?<fetch>[^\n]+)/)[:fetch]
112
112
  end
113
113
  @repo_url
114
114
  end
115
115
 
116
116
  def release_hashref
117
117
  if repo?
118
- "(git) #{%x(git rev-parse --abbrev-ref HEAD).chomp}"
118
+ "(git) #{`git rev-parse --abbrev-ref HEAD`.chomp}"
119
119
  else
120
- 'UNKNOWN - no .git directory'
120
+ "UNKNOWN - no .git directory"
121
121
  end
122
122
  end
123
123
 
124
124
  def repo?
125
- @is_repo = @root_path.join('.git').directory? unless defined?(@is_repo)
125
+ @is_repo = @root_path.join(".git").directory? unless defined?(@is_repo)
126
126
  @is_repo
127
127
  end
128
128
  end
@@ -6,9 +6,9 @@ class Cartage::Rack
6
6
  # Creates a new instance of the Cartage::Rack::Simple application to the
7
7
  # specified +root_path+, or +Dir.pwd+. This method has been deprecated.
8
8
  def mount(root_path = nil)
9
- warn <<-warning
10
- Cartage::Rack.mount(path) is deprecated; use Cartage::Rack::Simple(path) instead.
11
- warning
9
+ warn <<~WARNING
10
+ Cartage::Rack.mount(path) is deprecated; use Cartage::Rack::Simple(path) instead.
11
+ WARNING
12
12
  Simple(root_path)
13
13
  end
14
14
 
@@ -36,21 +36,21 @@ Cartage::Rack.mount(path) is deprecated; use Cartage::Rack::Simple(path) instead
36
36
 
37
37
  content = {}
38
38
 
39
- content[:env] = dig(full_content, 'env', 'name')
40
- content[:release_hashref] = dig(full_content, 'package', 'hashref')
41
- content[:timestamp] = dig(full_content, 'package', 'timestamp')
39
+ content[:env] = dig(full_content, "env", "name")
40
+ content[:release_hashref] = dig(full_content, "package", "hashref")
41
+ content[:timestamp] = dig(full_content, "package", "timestamp")
42
42
 
43
- case env['PATH_INFO']
43
+ case env["PATH_INFO"]
44
44
  when /\.json\z/
45
- type = 'application/json'
45
+ type = "application/json"
46
46
  body = content.to_json
47
47
  else
48
- type = 'text/plain'
48
+ type = "text/plain"
49
49
  body = "#{content[:env]}: #{content[:release_hashref]}"
50
50
  body += " (#{content[:timestamp]})" if content[:timestamp]
51
51
  end
52
52
 
53
- [ type, body ]
53
+ [type, body]
54
54
  end
55
55
  end
56
56
  end
data/lib/cartage/rack.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'pathname'
4
- require 'json'
3
+ require "pathname"
4
+ require "json"
5
5
 
6
6
  # Cartage, a package builder.
7
7
  class Cartage
@@ -15,7 +15,7 @@ class Cartage
15
15
  # +application/json+ value, or as a +text/plain+ string if called with
16
16
  # +.text+ or +.txt+.
17
17
  class Rack
18
- VERSION = '2.2' #:nodoc:
18
+ VERSION = "2.3" # :nodoc:
19
19
 
20
20
  class << self
21
21
  # When +true+, Cartage::Rack and Cartage::Rack::Simple will raise an
@@ -32,7 +32,7 @@ class Cartage
32
32
  private
33
33
 
34
34
  def default_require_metadata
35
- environment = ENV['RAILS_ENV'] || ENV['APP_ENV'] || ENV['RACK_ENV'] || 'development'
35
+ environment = ENV["RAILS_ENV"] || ENV["APP_ENV"] || ENV["RACK_ENV"] || "development"
36
36
  environment !~ /\A(?:development|test)\z/i
37
37
  end
38
38
  end
@@ -41,12 +41,12 @@ class Cartage
41
41
  @metadata = Cartage::Rack::Metadata.new(root_path, filter: filter)
42
42
  end
43
43
 
44
- def call(env) #:nodoc:
44
+ def call(env) # :nodoc:
45
45
  type, body = resolve_content(env)
46
- [ '200', { 'Content-Type' => type }, [ body ] ]
46
+ ["200", {"Content-Type" => type}, [body]]
47
47
  end
48
48
 
49
- def inspect #:nodoc:
49
+ def inspect # :nodoc:
50
50
  "#{self.class} for #{@metadata.inspect}"
51
51
  end
52
52
 
@@ -55,32 +55,32 @@ class Cartage
55
55
  def resolve_content(env)
56
56
  content = @metadata.resolve
57
57
 
58
- case env['PATH_INFO']
58
+ case env["PATH_INFO"]
59
59
  when /\.te?xt\z/
60
- type = 'text/plain'
60
+ type = "text/plain"
61
61
  body = [
62
- "name: #{dig(content, 'package', 'name')}",
63
- "environment: #{dig(content, 'env', 'name')}",
64
- "hashref: #{dig(content, 'package', 'hashref')}"
62
+ "name: #{dig(content, "package", "name")}",
63
+ "environment: #{dig(content, "env", "name")}",
64
+ "hashref: #{dig(content, "package", "hashref")}"
65
65
  ]
66
66
 
67
- value = dig(content, 'package', 'timestamp')
67
+ value = dig(content, "package", "timestamp")
68
68
  body << "timestamp: #{value}" if value
69
69
 
70
- repo = dig(content, 'package', 'repo')
71
- body << "#{repo['type']}: #{repo['url']}" if repo
70
+ repo = dig(content, "package", "repo")
71
+ body << "#{repo["type"]}: #{repo["url"]}" if repo
72
72
  body = body.join("\n")
73
73
  else
74
- type = 'application/json'
74
+ type = "application/json"
75
75
  body = content.to_json
76
76
  end
77
77
 
78
- [ type, body ]
78
+ [type, body]
79
79
  end
80
80
 
81
81
  attr_reader :metadata
82
82
 
83
- #:nocov:
83
+ # :nocov:
84
84
  def dig(hash, key, *rest)
85
85
  if hash.respond_to?(:dig)
86
86
  hash.dig(key, *rest)
@@ -89,7 +89,7 @@ class Cartage
89
89
  end
90
90
  end
91
91
 
92
- DIGGER = ->(h, k, *r) { #:nodoc:
92
+ DIGGER = ->(h, k, *r) { # :nodoc:
93
93
  v = h[k]
94
94
  if v.nil? || r.empty?
95
95
  v
@@ -98,9 +98,9 @@ class Cartage
98
98
  end
99
99
  }
100
100
  private_constant :DIGGER
101
- #:nocov:
101
+ # :nocov:
102
102
  end
103
103
  end
104
104
 
105
- require_relative 'rack/simple'
106
- require_relative 'rack/metadata'
105
+ require_relative "rack/simple"
106
+ require_relative "rack/metadata"
@@ -1,18 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- gem 'minitest'
4
- require 'rack/test'
5
- require 'minitest/autorun'
6
- require 'minitest/pretty_diff'
7
- require 'minitest/focus'
8
- require 'minitest/moar'
9
- require 'minitest/bisect'
10
- require 'minitest/hooks/default'
11
- require 'timecop'
3
+ gem "minitest"
4
+
5
+ require "minitest/autorun"
6
+ require "minitest/hooks/default"
7
+ require "minitest/moar"
8
+ require "rack/test"
9
+ require "timecop"
12
10
 
13
11
  Timecop.safe_mode = true
14
12
 
15
- require 'cartage/rack'
13
+ require "cartage/rack"
16
14
 
17
15
  module Minitest::CartageRackStubs
18
16
  def stub_dir_pwd value, *block_args, &block
@@ -24,8 +22,6 @@ module Minitest::CartageRackStubs
24
22
  env.fetch(key) { |k|
25
23
  if options[:passthrough]
26
24
  ENV.send(:"__minitest_stub__[]", k)
27
- else
28
- nil
29
25
  end
30
26
  }
31
27
  }
@@ -75,8 +71,3 @@ module Minitest::CartageRackStubs
75
71
 
76
72
  Minitest::Test.send(:include, self)
77
73
  end
78
-
79
- class << Minitest::Spec
80
- alias context describe
81
- private :context
82
- end