hashicorp-checkpoint 0.1.5 → 0.1.6

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.
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env bash
2
+ # Copyright (c) HashiCorp, Inc.
3
+ # SPDX-License-Identifier: MPL-2.0
4
+
5
+ csource="${BASH_SOURCE[0]}"
6
+ while [ -h "$csource" ] ; do csource="$(readlink "$csource")"; done
7
+ root="$( cd -P "$( dirname "$csource" )/../" && pwd )"
8
+
9
+ . "${root}/.ci/load-ci.sh"
10
+
11
+ # Allow the release name to be provided
12
+ release_name="${1}"
13
+ if [ -z "${release_name}" ]; then
14
+ release_name="${tag}"
15
+ fi
16
+
17
+ # Start by building the gem
18
+ gem build ./*.gemspec ||
19
+ failure "Unable to build RubyGem"
20
+
21
+ gem_files=(./*.gem)
22
+ if [ ! -f "${gem_files[0]}" ]; then
23
+ failure "Could not find built RubyGem"
24
+ fi
25
+ gem_file="${gem_files[0]}"
26
+
27
+ # Create the GitHub release
28
+ release "${release_name}" "${gem_file}"
data/.ci/load-ci.sh ADDED
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env bash
2
+ # Copyright (c) HashiCorp, Inc.
3
+ # SPDX-License-Identifier: MPL-2.0
4
+
5
+ csource="${BASH_SOURCE[0]}"
6
+ while [ -h "$csource" ] ; do csource="$(readlink "$csource")"; done
7
+ if ! root="$( cd -P "$( dirname "$csource" )/../" && pwd )"; then
8
+ echo "⛔ ERROR: Failed to determine root local directory ⛔" >&2
9
+ exit 1
10
+ fi
11
+
12
+ export root
13
+ export ci_bin_dir="${root}/.ci/.ci-utility-files"
14
+
15
+ # shellcheck source=/dev/null
16
+ if ! source "${ci_bin_dir}/common.sh"; then
17
+ echo "⛔ ERROR: Failed to source Vagrant CI common file ⛔" >&2
18
+ exit 1
19
+ fi
20
+ export PATH="${PATH}:${ci_bin_dir}"
21
+
22
+ # And we are done!
23
+ debug "VagrantCI Loaded"
data/.ci/publish ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env bash
2
+ # Copyright (c) HashiCorp, Inc.
3
+ # SPDX-License-Identifier: MPL-2.0
4
+
5
+ csource="${BASH_SOURCE[0]}"
6
+ while [ -h "$csource" ] ; do csource="$(readlink "$csource")"; done
7
+ root="$( cd -P "$( dirname "$csource" )/../" && pwd )"
8
+
9
+ . "${root}/.ci/load-ci.sh"
10
+
11
+ # Allow the release name to be provided
12
+ release_name="${1}"
13
+ if [ -z "${release_name}" ]; then
14
+ release_name="${tag}"
15
+ fi
16
+
17
+ # Send dispatch to vagrant-terraform
18
+ github_repository_dispatch "vagrant-terraform" "publish-rubygem" "repository_tag=${repository}" "release_name=${release_name}"
@@ -0,0 +1 @@
1
+ * @hashicorp/Vagrant
@@ -0,0 +1,33 @@
1
+ name: GitHub Release
2
+ on:
3
+ workflow_call:
4
+ inputs:
5
+ release_name:
6
+ description: 'Name of the GitHub release (example: v1.0.0)'
7
+ required: false
8
+ type: string
9
+ workflow_dispatch:
10
+ inputs:
11
+ release_name:
12
+ description: 'Name of the GitHub release (example: v1.0.0)'
13
+ required: false
14
+ type: string
15
+
16
+ jobs:
17
+ github-release:
18
+ name: Create GitHub Release
19
+ runs-on: ubuntu-latest
20
+ permissions:
21
+ contents: write
22
+ steps:
23
+ - name: Code Checkout
24
+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
25
+ - name: Setup Ruby
26
+ uses: ruby/setup-ruby@922ebc4c5262cd14e07bb0e1db020984b6c064fe # v1.226.0
27
+ with:
28
+ ruby-version: 3.3
29
+ - name: GitHub Release
30
+ run: ./.ci/github-release "${RELEASE_NAME}"
31
+ env:
32
+ RELEASE_NAME: ${{ inputs.release_name }}
33
+ GITHUB_TOKEN: ${{ github.token }}
@@ -0,0 +1,28 @@
1
+ name: Publish RubyGem
2
+ on:
3
+ workflow_call:
4
+ inputs:
5
+ release_name:
6
+ description: 'Name of the GitHub release (example: v1.0.0)'
7
+ required: false
8
+ type: string
9
+
10
+ workflow_dispatch:
11
+ inputs:
12
+ release_name:
13
+ description: 'Name of the GitHub release (example: v1.0.0)'
14
+ required: false
15
+ type: string
16
+
17
+ jobs:
18
+ rubygem-publish:
19
+ name: Trigger RubyGem publication
20
+ runs-on: ubuntu-latest
21
+ steps:
22
+ - name: Code Checkout
23
+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
24
+ - name: Trigger Publish
25
+ run: ./.ci/publish "${RELEASE_NAME}"
26
+ env:
27
+ RELEASE_NAME: ${{ inputs.release_name }}
28
+ HASHIBOT_TOKEN: ${{ vars.HASHIBOT_TOKEN }}
@@ -0,0 +1,27 @@
1
+ on:
2
+ push:
3
+ tags: 'v*'
4
+ workflow_dispatch:
5
+ inputs:
6
+ release_name:
7
+ description: 'Name of the GitHub release (example: v1.0.0)'
8
+ type: string
9
+ require: true
10
+
11
+ jobs:
12
+ github-release:
13
+ if: github.repository == 'hashicorp/ruby-checkpoint'
14
+ name: Create GitHub release
15
+ permissions:
16
+ contents: write
17
+ uses: ./.github/workflows/github-release.yml
18
+ with:
19
+ release_name: ${{ inputs.release_name }}
20
+ publish-rubygem:
21
+ if: github.repository == 'hashicorp/ruby-checkpoint'
22
+ needs: [github-release]
23
+ name: Trigger RubyGem publication
24
+ uses: ./.github/workflows/publish-rubygem.yml
25
+ secrets: inherit
26
+ with:
27
+ release_name: ${{ inputs.release_name }}
@@ -0,0 +1,23 @@
1
+ name: Vagrant Ruby Tests
2
+ on:
3
+ pull_request:
4
+ branches:
5
+ - main
6
+ ignored-paths:
7
+ - 'lib/**'
8
+ - 'spec/**'
9
+ - 'Gemfile'
10
+ - 'ruby-checkpoint.gemspec'
11
+ - 'Rakefile'
12
+
13
+ jobs:
14
+ unit-tests-ruby:
15
+ runs-on: ubuntu-latest
16
+ continue-on-error: true
17
+ strategy:
18
+ matrix:
19
+ ruby: [ '3.1', '3.2', '3.3', '3.4' ]
20
+ name: Checkpoint spec tests on Ruby ${{ matrix.ruby }}
21
+ steps:
22
+ - name: Stubbed for skip
23
+ run: "echo 'No testing required in changeset'"
@@ -0,0 +1,40 @@
1
+ name: Vagrant Ruby Tests
2
+ on:
3
+ push:
4
+ branches:
5
+ - main
6
+ - 'test-*'
7
+ paths:
8
+ - 'lib/**'
9
+ - 'spec/**'
10
+ - 'Gemfile'
11
+ - 'ruby-checkpoint.gemspec'
12
+ - 'Rakefile'
13
+ pull_request:
14
+ branches:
15
+ - main
16
+ paths:
17
+ - 'lib/**'
18
+ - 'spec/**'
19
+ - 'Gemfile'
20
+ - 'ruby-checkpoint.gemspec'
21
+ - 'Rakefile'
22
+
23
+ jobs:
24
+ unit-tests-ruby:
25
+ runs-on: ubuntu-latest
26
+ continue-on-error: true
27
+ strategy:
28
+ matrix:
29
+ ruby: [ '3.1', '3.2', '3.3', '3.4' ]
30
+ name: Checkpoint spec tests on Ruby ${{ matrix.ruby }}
31
+ steps:
32
+ - name: Code Checkout
33
+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
34
+ - name: Setup Ruby
35
+ uses: ruby/setup-ruby@922ebc4c5262cd14e07bb0e1db020984b6c064fe # v1.226.0
36
+ with:
37
+ ruby-version: ${{matrix.ruby}}
38
+ bundler-cache: true
39
+ - name: Run Tests
40
+ run: bundle exec rspec
data/Gemfile CHANGED
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  source 'https://rubygems.org'
2
5
 
3
6
  # Specify your gem's dependencies in ruby-checkpoint.gemspec
@@ -1,3 +1,5 @@
1
+ Copyright (c) 2014 HashiCorp, Inc.
2
+
1
3
  Mozilla Public License, version 2.0
2
4
 
3
5
  1. Definitions
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  require "rbconfig"
2
5
 
3
6
  module Checkpoint
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  module Checkpoint
2
- VERSION = "0.1.5"
5
+ VERSION = "0.1.6"
3
6
  end
data/lib/checkpoint.rb CHANGED
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  require "cgi"
2
5
  require "json"
3
6
  require "net/http"
@@ -26,9 +29,11 @@ module Checkpoint
26
29
  # a new random signature.
27
30
  # @option opts [String] :cache_file If specified, the response will be
28
31
  # cached here for cache_time period (defaults to 48 hours).
29
- def self.check(**opts)
32
+ def self.check(opts=nil, **kargs)
30
33
  return nil if @@disabled
31
34
 
35
+ opts = kargs if opts.nil?
36
+
32
37
  # If we have the cache file, then just return the contents.
33
38
  if opts[:cache_file] && File.file?(opts[:cache_file])
34
39
  # If the cache file is too old, then delete it
@@ -11,15 +11,14 @@ Gem::Specification.new do |spec|
11
11
  spec.summary = %q{Internal HashiCorp service to check version information.}
12
12
  spec.description = %q{Internal HashiCorp service to check version information}
13
13
  spec.homepage = "http://www.hashicorp.com"
14
- spec.license = "MPL2"
14
+ spec.license = "MPL-2.0"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
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.add_development_dependency "bundler", "~> 1.6"
22
21
  spec.add_development_dependency "rake"
23
- spec.add_development_dependency "rspec", "~> 3.0.0"
24
- spec.add_development_dependency "rspec-its", "~> 1.0.0"
22
+ spec.add_development_dependency "rspec", "~> 3.0"
23
+ spec.add_development_dependency "rspec-its", "~> 2.0"
25
24
  end
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  require "tempfile"
2
5
 
3
6
  require "helper"
@@ -21,6 +24,21 @@ describe Checkpoint do
21
24
  its(["current_version"]) { should eq("1.0") }
22
25
  its(["outdated"]) { should eq(false) }
23
26
  its(["product"]) { should eq("test") }
27
+
28
+ context "with hash argument" do
29
+ subject do
30
+ described_class.check({
31
+ product: "test",
32
+ version: "1.0",
33
+ raise_error: true,
34
+ })
35
+ end
36
+
37
+ its(["alerts"]) { should be_empty }
38
+ its(["current_version"]) { should eq("1.0") }
39
+ its(["outdated"]) { should eq(false) }
40
+ its(["product"]) { should eq("test") }
41
+ end
24
42
  end
25
43
 
26
44
  context "cache file" do
data/spec/helper.rb CHANGED
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  require 'rspec/its'
2
5
 
3
6
  require "checkpoint"
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hashicorp-checkpoint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mitchell Hashimoto
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-19 00:00:00.000000000 Z
11
+ date: 2025-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.6'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.6'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: rake
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -44,28 +30,28 @@ dependencies:
44
30
  requirements:
45
31
  - - "~>"
46
32
  - !ruby/object:Gem::Version
47
- version: 3.0.0
33
+ version: '3.0'
48
34
  type: :development
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
38
  - - "~>"
53
39
  - !ruby/object:Gem::Version
54
- version: 3.0.0
40
+ version: '3.0'
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: rspec-its
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
45
  - - "~>"
60
46
  - !ruby/object:Gem::Version
61
- version: 1.0.0
47
+ version: '2.0'
62
48
  type: :development
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
52
  - - "~>"
67
53
  - !ruby/object:Gem::Version
68
- version: 1.0.0
54
+ version: '2.0'
69
55
  description: Internal HashiCorp service to check version information
70
56
  email:
71
57
  - mitchell@hashicorp.com
@@ -73,9 +59,19 @@ executables: []
73
59
  extensions: []
74
60
  extra_rdoc_files: []
75
61
  files:
62
+ - ".ci/.ci-utility-files/common.sh"
63
+ - ".ci/github-release"
64
+ - ".ci/load-ci.sh"
65
+ - ".ci/publish"
66
+ - ".github/CODEOWNERS"
67
+ - ".github/workflows/github-release.yml"
68
+ - ".github/workflows/publish-rubygem.yml"
69
+ - ".github/workflows/release.yml"
70
+ - ".github/workflows/testing-skipped.yml"
71
+ - ".github/workflows/testing.yml"
76
72
  - ".gitignore"
77
73
  - Gemfile
78
- - LICENSE.txt
74
+ - LICENSE
79
75
  - README.md
80
76
  - Rakefile
81
77
  - lib/checkpoint.rb
@@ -86,9 +82,9 @@ files:
86
82
  - spec/helper.rb
87
83
  homepage: http://www.hashicorp.com
88
84
  licenses:
89
- - MPL2
85
+ - MPL-2.0
90
86
  metadata: {}
91
- post_install_message:
87
+ post_install_message:
92
88
  rdoc_options: []
93
89
  require_paths:
94
90
  - lib
@@ -103,9 +99,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
99
  - !ruby/object:Gem::Version
104
100
  version: '0'
105
101
  requirements: []
106
- rubyforge_project:
107
- rubygems_version: 2.6.14
108
- signing_key:
102
+ rubygems_version: 3.5.22
103
+ signing_key:
109
104
  specification_version: 4
110
105
  summary: Internal HashiCorp service to check version information.
111
106
  test_files: