yq 0.4.0 → 0.4.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d07d7b73032c8c61bbf2f18b8b9de799c52cbddeef69386953ebeb74fad9b009
4
- data.tar.gz: 35fd24192ad40d080f3b0a1a3217930ff41b0f96ad3f57e32bfc0ad990f04e27
3
+ metadata.gz: 6976e6a19af13ebbe442c23b74ffaaebfbd751de6893a9953182d346264d6089
4
+ data.tar.gz: bbce1e5d4b1430d6f158e6e8c0f669db83af69b6c1256358f55dffc653b5d750
5
5
  SHA512:
6
- metadata.gz: 31b279062178bf1b4179de42208cc6e8eb98d831cdf7ffd75bc5a4e6ad8fc963f2a6871f52ecb72bc1efa4fcac2e1a5483f25b1c730c0c8b134bb5adcba75055
7
- data.tar.gz: b52bbb79b6ee17a28a6fce17ca0c5c4354b1c9b4a899afcb869bd46376ea8b319b85f9ba136aeae6ceacd8c00dea19c739c0209bc4e18649ed3f22b54c0b5da8
6
+ metadata.gz: 172d6483b7a3a5b8a6e7a6cf37e63d031b816e297ce602ef25890e452dabaac19578d967d606cd6daeb5c5f4611fa9d0a1231979a2c44736f18f5952ca9276bc
7
+ data.tar.gz: f8565b4d2878a21c90a1fcfe45eb5ae91653361260faebe8cfc0637b8c86b3e360b35862fb00e960913c34cbb945c87959c041ab5bb73cea2a925bb10b621073
@@ -0,0 +1,14 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "bundler"
4
+ directory: "/" # Location of package manifests
5
+ schedule:
6
+ interval: "daily"
7
+ commit-message:
8
+ prefix: "fix"
9
+ prefix-development: "chore"
10
+ include: "scope"
11
+ - package-ecosystem: "github-actions"
12
+ directory: "/" # Location of package manifests
13
+ schedule:
14
+ interval: "daily"
@@ -0,0 +1,54 @@
1
+ name: Rspec and Release
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ rspec:
10
+ strategy:
11
+ fail-fast: false
12
+ matrix:
13
+ os: [ubuntu-latest, macos-latest]
14
+ # Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
15
+ ruby: [2.5, 2.6, 2.7]
16
+ runs-on: ${{ matrix.os }}
17
+ steps:
18
+ - uses: actions/checkout@v2
19
+ - name: Set up Ruby
20
+ uses: ruby/setup-ruby@v1
21
+ with:
22
+ ruby-version: ${{ matrix.ruby }}
23
+ bundler-cache: true
24
+ - name: Test with Rspec
25
+ run: |
26
+ bundle exec rspec --format documentation --require spec_helper
27
+ release:
28
+ if: github.event_name == 'push'
29
+ needs: rspec
30
+ runs-on: ubuntu-latest
31
+ env:
32
+ BUNDLE_DEPLOYMENT: true
33
+ steps:
34
+ - uses: actions/checkout@v2
35
+ - name: Set up Ruby 2.7
36
+ uses: ruby/setup-ruby@v1
37
+ with:
38
+ ruby-version: 2.7
39
+ bundler-cache: true
40
+ - name: Zip
41
+ run : |
42
+ zip -r yq.zip ./*
43
+ - name: Semantic Release
44
+ id: semantic
45
+ uses: cycjimmy/semantic-release-action@v2
46
+ env:
47
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48
+ GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_TOKEN }}
49
+ with:
50
+ semantic_version: 17
51
+ extra_plugins: |
52
+ @semantic-release/changelog
53
+ @semantic-release/git
54
+ semantic-release-rubygem
data/Gemfile CHANGED
@@ -1,13 +1,3 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'json2yaml'
4
-
5
- group :development, :test do
6
- gem 'pry'
7
- gem 'rspec', '~> 3.3'
8
- gem 'rake'
9
- gem 'guard'
10
- gem 'guard-rspec'
11
- gem 'climate_control'
12
- gem 'coveralls', require: false
13
- end
3
+ gemspec
data/Guardfile CHANGED
@@ -1,9 +1,9 @@
1
- directories %w(lib bin spec )
1
+ directories %w[lib bin spec]
2
2
 
3
3
  clearing :on
4
4
 
5
- guard :rspec, cmd: "bundle exec rspec" do
6
- require "guard/rspec/dsl"
5
+ guard :rspec, cmd: 'bundle exec rspec' do
6
+ require 'guard/rspec/dsl'
7
7
  dsl = Guard::RSpec::Dsl.new(self)
8
8
 
9
9
  # Feel free to open issues for suggestions and improvements
data/README.md CHANGED
@@ -1,8 +1,7 @@
1
1
  # Yq
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/yq.svg)](http://badge.fury.io/rb/yq)
4
- [![Build Status](https://travis-ci.org/jim80net/yq.svg?branch=master)](https://travis-ci.org/jim80net/yq)
5
- [![Coverage Status](https://coveralls.io/repos/jim80net/yq/badge.svg?branch=master&service=github)](https://coveralls.io/github/jim80net/yq?branch=master)
4
+ ![Rspec and Release](https://github.com/jim80net/yq/workflows/Rspec%20and%20Release/badge.svg)
6
5
 
7
6
  Use `yq` to parse YAML documents using [jq](https://stedolan.github.io/jq/). This gem is a simple wrapper around the executable. It will convert the YAML input into JSON, run `jq` against it, then convert the output back into YAML. Sometimes, `jq` will output non-JSON, but `yq` will just turn that into valid YAML.
8
7
 
@@ -29,6 +28,8 @@ bar: baz
29
28
 
30
29
  ```
31
30
 
31
+ `yq` converts the STDIN to JSON, and passes it to `jq`, along with the `jq` query you specify. The result is then turned back into YAML.
32
+
32
33
  ## Contributing
33
34
 
34
35
  1. Fork it ( https://github.com/jim80net/yq/fork )
data/Rakefile CHANGED
@@ -1,6 +1,5 @@
1
- require "bundler/gem_tasks"
1
+ require 'bundler/gem_tasks'
2
2
 
3
3
  Dir.glob('tasks/**/*.rake').each(&method(:import))
4
4
 
5
5
  task default: :spec
6
-
data/bin/yq CHANGED
@@ -8,9 +8,7 @@ require 'optparse'
8
8
  require 'yq'
9
9
 
10
10
  $stdout.sync = $stderr.sync = true
11
- unless defined?(LOGGER)
12
- LOGGER = Logger.new($stderr)
13
- end
11
+ LOGGER = Logger.new($stderr) unless defined?(LOGGER)
14
12
  LOGGER.level = Logger::INFO
15
13
 
16
14
  @options = {
@@ -31,7 +29,7 @@ def prereqs
31
29
  opts.on('--verbose', '-v', 'verbose') do
32
30
  LOGGER.level = Logger::DEBUG
33
31
  end
34
- opts.on("--develop", "Run in developer mode") do
32
+ opts.on('--develop', 'Run in developer mode') do
35
33
  @options[:context] = :develop
36
34
  end
37
35
  opts.on('-r', '--raw-output') do
@@ -49,30 +47,25 @@ def prereqs
49
47
  raise "#{v} must be specified in the environment variables" unless ENV[v]
50
48
  end
51
49
 
52
- raise "jq not installed" unless Yq.which('jq')
50
+ raise 'jq not installed' unless Yq.which('jq')
53
51
  end
54
52
 
55
-
56
53
  def start
57
- begin
58
- @yaml = $stdin.read
59
-
60
- puts Yq.search_yaml(ARGV[0], @yaml, output: @options[:output])
54
+ @yaml = $stdin.read
61
55
 
62
- rescue => e
63
- LOGGER.error "Unhandled exception #{e.class}: #{e.message}"
64
- e.backtrace.each do |v|
65
- LOGGER.debug v
66
- end
67
- raise
56
+ puts Yq.search_yaml(ARGV[0], @yaml, output: @options[:output])
57
+ rescue StandardError => e
58
+ LOGGER.error "Unhandled exception #{e.class}: #{e.message}"
59
+ e.backtrace.each do |v|
60
+ LOGGER.debug v
68
61
  end
69
-
62
+ raise
70
63
  end
71
64
 
72
65
  def develop
73
66
  require 'pry'
74
67
  LOGGER.level = Logger::DEBUG
75
- LOGGER.info "Develop mode"
68
+ LOGGER.info 'Develop mode'
76
69
  start
77
70
  end
78
71
 
@@ -80,6 +73,5 @@ def main_loop
80
73
  start
81
74
  end
82
75
 
83
-
84
76
  prereqs
85
- self.send(@options[:context])
77
+ send(@options[:context])
data/lib/yq.rb CHANGED
@@ -1,4 +1,4 @@
1
- require "yq/version"
1
+ require 'yq/version'
2
2
  require 'open3'
3
3
  require 'stringio'
4
4
  require 'yaml'
@@ -8,11 +8,11 @@ require 'timeout'
8
8
  module Yq
9
9
  def self.which(cmd)
10
10
  exts = ENV['PATH'] ? ENV['PATH'].split(':') : ['']
11
- exts.each { |ext|
11
+ exts.each do |ext|
12
12
  exe = File.join(ext, cmd)
13
13
  return exe if File.executable?(exe) && !File.directory?(exe)
14
- }
15
- return nil
14
+ end
15
+ nil
16
16
  end
17
17
 
18
18
  def self.search_yaml(query, yaml, output: :yaml)
@@ -23,7 +23,7 @@ module Yq
23
23
  when :json
24
24
  search(query, req_json)
25
25
  when :yaml
26
- resp_json = search(query, req_json)
26
+ resp_json = search(query, req_json)
27
27
  json_to_yaml(resp_json)
28
28
  end
29
29
  end
@@ -31,32 +31,30 @@ module Yq
31
31
  def self.search(query, json, flags: [])
32
32
  cmd = [which('jq')] + flags + [query]
33
33
  input = json
34
- output = ""
34
+ output = ''
35
35
  LOGGER.debug "sending jq #{cmd}"
36
36
 
37
37
  Open3.popen2(*cmd) do |i, o, t|
38
- begin
39
- pid = t.pid
38
+ pid = t.pid
40
39
 
41
- if input
42
- i.puts input
43
- i.close
44
- end
40
+ if input
41
+ i.puts input
42
+ i.close
43
+ end
45
44
 
46
- Timeout.timeout(5) do
47
- o.each { |v|
48
- output << v
49
- }
45
+ Timeout.timeout(5) do
46
+ o.each do |v|
47
+ output << v
50
48
  end
51
- rescue Timeout::Error
52
- LOGGER.warn "Timing out #{t.inspect} after 1 second"
53
- Process.kill(15, pid)
54
- ensure
55
- status = t.value
56
- raise "JQ failed to exit cleanly" unless status.success?
57
49
  end
50
+ rescue Timeout::Error
51
+ LOGGER.warn "Timing out #{t.inspect} after 1 second"
52
+ Process.kill(15, pid)
53
+ ensure
54
+ status = t.value
55
+ raise 'JQ failed to exit cleanly' unless status.success?
58
56
  end
59
- return output
57
+ output
60
58
  end
61
59
 
62
60
  def self.yaml_to_json(yaml)
@@ -80,7 +78,7 @@ module Yq
80
78
  def self.json_to_hash(json)
81
79
  JSON.parse(json)
82
80
  rescue JSON::ParserError
83
- LOGGER.debug "Non JSON output from jq. Interpreting."
81
+ LOGGER.debug 'Non JSON output from jq. Interpreting.'
84
82
  interpret_non_json_output(json)
85
83
  end
86
84
 
@@ -94,13 +92,11 @@ module Yq
94
92
 
95
93
  without_the_wrapping_array = matches.map(&:first)
96
94
  without_the_wrapping_array.map do |line|
97
- begin
98
- JSON.parse(line)
99
- rescue JSON::ParserError
100
- LOGGER.debug "Assuming #{line} is a string."
101
- obj = JSON.parse(%Q[{ "value": #{line} }])
102
- obj["value"]
103
- end
95
+ JSON.parse(line)
96
+ rescue JSON::ParserError
97
+ LOGGER.debug "Assuming #{line} is a string."
98
+ obj = JSON.parse(%({ "value": #{line} }))
99
+ obj['value']
104
100
  end
105
101
  end
106
102
  end
data/lib/yq/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Yq
2
- VERSION = '0.4.0'
2
+ VERSION = '0.4.1'.freeze
3
3
  end
data/release.config.js ADDED
@@ -0,0 +1,43 @@
1
+ module.exports = {
2
+ "plugins": [
3
+ "@semantic-release/commit-analyzer",
4
+ "@semantic-release/release-notes-generator",
5
+ [
6
+ "@semantic-release/changelog",
7
+ {
8
+ "changelogFile": "CHANGELOG.md"
9
+ }
10
+ ],
11
+ [
12
+ "semantic-release-rubygem",
13
+ {
14
+ "gemFileDir": "."
15
+ }
16
+ ],
17
+ [
18
+ "@semantic-release/git",
19
+ {
20
+ "assets": [
21
+ "CHANGELOG.md"
22
+ ],
23
+ "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
24
+ }
25
+ ],
26
+ [
27
+ "@semantic-release/github",
28
+ {
29
+ "assets": [
30
+ {
31
+ "path": "yq.zip",
32
+ "name": "yq.${nextRelease.version}.zip",
33
+ "label": "Full zip distribution"
34
+ },
35
+ {
36
+ "path": "yq-*.gem",
37
+ "label": "Gem distribution"
38
+ }
39
+ ]
40
+ }
41
+ ],
42
+ ]
43
+ };
data/spec/spec_helper.rb CHANGED
@@ -1,15 +1,11 @@
1
- $:.unshift(File.expand_path("../lib", File.dirname(__FILE__)))
2
-
3
- require 'coveralls'
4
- Coveralls.wear!
1
+ $:.unshift(File.expand_path('../lib', File.dirname(__FILE__)))
5
2
 
6
3
  require 'logger'
7
4
  require 'pry'
8
5
  require 'yq'
9
6
 
10
-
11
7
  LOGGER = Logger.new('/dev/null')
12
- SPEC_ROOT = File.expand_path(File.dirname(__FILE__))
8
+ SPEC_ROOT = __dir__
13
9
  WORK_ROOT = File.expand_path(File.join(SPEC_ROOT, '..'))
14
10
 
15
11
  RSpec.configure do |config|
data/spec/yq_bin_spec.rb CHANGED
@@ -4,30 +4,28 @@ require 'timeout'
4
4
 
5
5
  describe 'bin/yq' do
6
6
  # Contract Or[nil,String] => self
7
- def run_bin(args = "", input = nil)
7
+ def run_bin(args = '', input = nil)
8
8
  status = nil
9
- output = ""
9
+ output = ''
10
10
  cmd = "bin/yq #{args}"
11
11
  Open3.popen2e(cmd) do |i, oe, t|
12
- begin
13
- pid = t.pid
12
+ pid = t.pid
14
13
 
15
- if input
16
- i.puts input
17
- i.close
18
- end
14
+ if input
15
+ i.puts input
16
+ i.close
17
+ end
19
18
 
20
- Timeout.timeout(0.5) do
21
- oe.each { |v|
22
- output << v
23
- }
19
+ Timeout.timeout(1.0) do
20
+ oe.each do |v|
21
+ output << v
24
22
  end
25
- rescue Timeout::Error
26
- LOGGER.warn "Timing out #{t.inspect} after 1 second"
27
- Process.kill(15, pid)
28
- ensure
29
- status = t.value
30
23
  end
24
+ rescue Timeout::Error
25
+ LOGGER.warn "Timing out #{t.inspect} after 1 second"
26
+ Process.kill(15, pid)
27
+ ensure
28
+ status = t.value
31
29
  end
32
30
  [output, status]
33
31
  end
@@ -51,17 +49,17 @@ describe 'bin/yq' do
51
49
  end
52
50
 
53
51
  it 'supplies help' do
54
- out_err, status = run_bin("--help")
52
+ out_err, status = run_bin('--help')
55
53
  expect(out_err).to match(/Usage: yq/)
56
54
  expect(status).to be_success
57
55
  end
58
56
 
59
57
  describe 'parses' do
60
- let(:yaml) { <<-EOF }
61
- foo:
62
- bar:
63
- baz: value
64
- EOF
58
+ let(:yaml) { <<~EOF }
59
+ foo:
60
+ bar:
61
+ baz: value
62
+ EOF
65
63
 
66
64
  it '.foo.bar' do
67
65
  out_err, status = run_bin('.foo.bar', yaml)
data/spec/yq_spec.rb CHANGED
@@ -1,100 +1,99 @@
1
1
  describe Yq do
2
2
  subject { described_class }
3
3
 
4
- let(:hash) {
5
- { "foo" => { "bar" => { "'" => "value" }}}
6
- }
4
+ let(:hash) do
5
+ { 'foo' => { 'bar' => { "'" => 'value' } } }
6
+ end
7
7
 
8
- let(:yaml) {<<EOF}
9
- foo:
10
- bar:
11
- "'": value
12
- EOF
8
+ let(:yaml) { <<~EOF }
9
+ foo:
10
+ bar:
11
+ "'": value
12
+ EOF
13
13
 
14
14
  # support equivalent YAML syntaxes (depends on ruby version)
15
- let(:yaml_regexp) {<<EOF}
16
- foo:
17
- bar:
18
- ("'"|''''|! ''''): value
19
- EOF
15
+ let(:yaml_regexp) { <<~EOF }
16
+ foo:
17
+ bar:
18
+ ("'"|''''|! ''''): value
19
+ EOF
20
20
 
21
- let(:json) {<<EOF.chomp}
22
- {"foo":{"bar":{"'":"value"}}}
23
- EOF
21
+ let(:json) { <<~EOF.chomp }
22
+ {"foo":{"bar":{"'":"value"}}}
23
+ EOF
24
24
 
25
25
  let(:jq_query) { %q({"\\t": .foo.bar["'"]}) }
26
26
 
27
- let(:jq_response) {<<EOF}
28
- {
29
- "\\t": "value"
30
- }
31
- EOF
32
-
33
- let(:jq_non_json_response) {<<EOF}
34
- "foo"
35
- "bar"
36
- "baz"
37
- EOF
38
-
39
- let(:yaml_from_non_json_response) {<<EOF}
40
- ---
41
- - foo
42
- - bar
43
- - baz
44
- EOF
45
-
46
- let(:jq_non_json_response_2) {<<EOF}
47
- {
48
- "foo": "bar",
49
- "baz": {
50
- "blah": 10240,
51
- "asdf": "qwer"
52
- },
53
- "bing": "bo.ng"
54
- }
55
- {
56
- "foo": "far",
57
- "bing": "ba.ng"
58
- }
59
- [1,2,3]
60
- [4,5,6]
61
- "asdf"
62
- "qwer"
63
- EOF
64
-
65
- let(:yaml_from_non_json_response_2) {<<EOF}
66
- ---
67
- - foo: bar
68
- baz:
69
- blah: 10240
70
- asdf: qwer
71
- bing: bo.ng
72
- - foo: far
73
- bing: ba.ng
74
- - - 1
75
- - 2
76
- - 3
77
- - - 4
78
- - 5
79
- - 6
80
- - asdf
81
- - qwer
82
- EOF
27
+ let(:jq_response) { <<~EOF }
28
+ {
29
+ "\\t": "value"
30
+ }
31
+ EOF
32
+
33
+ let(:jq_non_json_response) { <<~EOF }
34
+ "foo"
35
+ "bar"
36
+ "baz"
37
+ EOF
38
+
39
+ let(:yaml_from_non_json_response) { <<~EOF }
40
+ ---
41
+ - foo
42
+ - bar
43
+ - baz
44
+ EOF
45
+
46
+ let(:jq_non_json_response_2) { <<~EOF }
47
+ {
48
+ "foo": "bar",
49
+ "baz": {
50
+ "blah": 10240,
51
+ "asdf": "qwer"
52
+ },
53
+ "bing": "bo.ng"
54
+ }
55
+ {
56
+ "foo": "far",
57
+ "bing": "ba.ng"
58
+ }
59
+ [1,2,3]
60
+ [4,5,6]
61
+ "asdf"
62
+ "qwer"
63
+ EOF
64
+
65
+ let(:yaml_from_non_json_response_2) { <<~EOF }
66
+ ---
67
+ - foo: bar
68
+ baz:
69
+ blah: 10240
70
+ asdf: qwer
71
+ bing: bo.ng
72
+ - foo: far
73
+ bing: ba.ng
74
+ - - 1
75
+ - 2
76
+ - 3
77
+ - - 4
78
+ - 5
79
+ - 6
80
+ - asdf
81
+ - qwer
82
+ EOF
83
83
 
84
84
  describe '.search' do
85
-
86
85
  subject { described_class.search(jq_query, json) }
87
86
 
88
87
  it { is_expected.to match(jq_response) }
89
88
 
90
89
  it 'passes it through to jq' do
91
90
  allow(Yq).to receive(:which).with('jq').and_return('/bin/jq')
92
- expect(Open3).to receive(:popen2).with('/bin/jq' , jq_query).and_return(jq_response)
91
+ expect(Open3).to receive(:popen2).with('/bin/jq', jq_query).and_return(jq_response)
93
92
  subject
94
93
  end
95
94
 
96
95
  context 'unclean exit' do
97
- subject { described_class.search'.foobar', json }
96
+ subject { described_class.search '.foobar', json }
98
97
 
99
98
  it 'stops processing when jq exits uncleanly' do
100
99
  # not mocking at this level, see implementation
@@ -123,12 +122,12 @@ EOF
123
122
 
124
123
  context 'non-json response' do
125
124
  subject { described_class.json_to_yaml(jq_non_json_response) }
126
- it {is_expected.to match(yaml_from_non_json_response)}
125
+ it { is_expected.to match(yaml_from_non_json_response) }
127
126
  end
128
127
 
129
128
  context 'non-json response 2' do
130
129
  subject { described_class.json_to_yaml(jq_non_json_response_2) }
131
- it {is_expected.to match(yaml_from_non_json_response_2)}
130
+ it { is_expected.to match(yaml_from_non_json_response_2) }
132
131
  end
133
132
  end
134
133
 
@@ -138,29 +137,28 @@ EOF
138
137
  it { is_expected.to match(/("'"|''''|! ''''): value/) }
139
138
  end
140
139
 
141
-
142
140
  describe '.which' do
143
141
  subject { described_class.which('jq') }
144
142
 
145
- before(:each) {
146
- allow(ENV).to receive(:[]).with('PATH').and_return("/bin:/other/bin")
147
- allow(File).to receive(:executable?).with("/bin/jq").and_return(false)
148
- allow(File).to receive(:directory?).with("/bin/jq").and_return(false)
149
- allow(File).to receive(:directory?).with("/other/bin/jq").and_return(false)
150
- }
143
+ before(:each) do
144
+ allow(ENV).to receive(:[]).with('PATH').and_return('/bin:/other/bin')
145
+ allow(File).to receive(:executable?).with('/bin/jq').and_return(false)
146
+ allow(File).to receive(:directory?).with('/bin/jq').and_return(false)
147
+ allow(File).to receive(:directory?).with('/other/bin/jq').and_return(false)
148
+ end
151
149
 
152
150
  context 'but it does not exist' do
153
- before(:each) {
154
- allow(File).to receive(:executable?).with("/other/bin/jq").and_return(false)
155
- }
156
- it { is_expected.to be_falsey }
151
+ before(:each) do
152
+ allow(File).to receive(:executable?).with('/other/bin/jq').and_return(false)
153
+ end
154
+ it { is_expected.to be_falsey }
157
155
  end
158
156
 
159
157
  context 'and it does exist' do
160
- before(:each) {
161
- allow(File).to receive(:executable?).with("/other/bin/jq").and_return(true)
162
- }
163
- it { is_expected.to eq('/other/bin/jq') }
158
+ before(:each) do
159
+ allow(File).to receive(:executable?).with('/other/bin/jq').and_return(true)
160
+ end
161
+ it { is_expected.to eq('/other/bin/jq') }
164
162
  end
165
163
  end
166
164
  end
data/yq.gemspec CHANGED
@@ -1,26 +1,29 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path('lib', __dir__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
  require 'yq/version'
5
4
 
6
5
  Gem::Specification.new do |spec|
7
- spec.name = "yq"
6
+ spec.name = 'yq'
8
7
  spec.version = Yq::VERSION
9
- spec.authors = ["Jim Park"]
10
- spec.email = ["yq@jim80.net"]
11
- spec.summary = %q{A JQ wrapper for YAML}
8
+ spec.authors = ['Jim Park']
9
+ spec.email = ['yq@jim80.net']
10
+ spec.summary = 'A JQ wrapper for YAML'
12
11
  spec.description = "This unceremoniously shells out to a jq available in $PATH.
13
12
  Please make sure jq is installed."
14
- spec.homepage = "https://github.com/jim80net/yq"
15
- spec.license = "GPLv2"
13
+ spec.homepage = 'https://github.com/jim80net/yq'
14
+ spec.license = 'GPLv2'
16
15
 
17
16
  spec.files = `git ls-files -z`.split("\x0")
18
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
- spec.require_paths = ["lib"]
19
+ spec.require_paths = ['lib']
21
20
 
22
- spec.add_development_dependency "bundler", "~> 1.7"
23
- spec.add_development_dependency "rake", "~> 10.0"
24
- spec.add_development_dependency "rspec", '~> 3.3'
25
- spec.add_development_dependency "pry"
21
+ spec.add_development_dependency 'bundler'
22
+ spec.add_development_dependency 'climate_control'
23
+ spec.add_development_dependency 'guard'
24
+ spec.add_development_dependency 'guard-rspec'
25
+ spec.add_development_dependency 'pry'
26
+ spec.add_development_dependency 'rake'
27
+ spec.add_development_dependency 'rspec'
28
+ spec.add_development_dependency 'rubocop'
26
29
  end
metadata CHANGED
@@ -1,59 +1,115 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Park
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-12 00:00:00.000000000 Z
11
+ date: 2021-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
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: climate_control
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: guard
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
+ - - ">="
18
53
  - !ruby/object:Gem::Version
19
- version: '1.7'
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: guard-rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
20
62
  type: :development
21
63
  prerelease: false
22
64
  version_requirements: !ruby/object:Gem::Requirement
23
65
  requirements:
24
- - - "~>"
66
+ - - ">="
25
67
  - !ruby/object:Gem::Version
26
- version: '1.7'
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
27
83
  - !ruby/object:Gem::Dependency
28
84
  name: rake
29
85
  requirement: !ruby/object:Gem::Requirement
30
86
  requirements:
31
- - - "~>"
87
+ - - ">="
32
88
  - !ruby/object:Gem::Version
33
- version: '10.0'
89
+ version: '0'
34
90
  type: :development
35
91
  prerelease: false
36
92
  version_requirements: !ruby/object:Gem::Requirement
37
93
  requirements:
38
- - - "~>"
94
+ - - ">="
39
95
  - !ruby/object:Gem::Version
40
- version: '10.0'
96
+ version: '0'
41
97
  - !ruby/object:Gem::Dependency
42
98
  name: rspec
43
99
  requirement: !ruby/object:Gem::Requirement
44
100
  requirements:
45
- - - "~>"
101
+ - - ">="
46
102
  - !ruby/object:Gem::Version
47
- version: '3.3'
103
+ version: '0'
48
104
  type: :development
49
105
  prerelease: false
50
106
  version_requirements: !ruby/object:Gem::Requirement
51
107
  requirements:
52
- - - "~>"
108
+ - - ">="
53
109
  - !ruby/object:Gem::Version
54
- version: '3.3'
110
+ version: '0'
55
111
  - !ruby/object:Gem::Dependency
56
- name: pry
112
+ name: rubocop
57
113
  requirement: !ruby/object:Gem::Requirement
58
114
  requirements:
59
115
  - - ">="
@@ -76,9 +132,11 @@ executables:
76
132
  extensions: []
77
133
  extra_rdoc_files: []
78
134
  files:
135
+ - ".github/dependabot.yml"
136
+ - ".github/workflows/rspec_and_release.yml"
79
137
  - ".gitignore"
80
- - ".travis.yml"
81
138
  - Gemfile
139
+ - Gemfile.lock
82
140
  - Guardfile
83
141
  - LICENSE
84
142
  - README.md
@@ -86,6 +144,7 @@ files:
86
144
  - bin/yq
87
145
  - lib/yq.rb
88
146
  - lib/yq/version.rb
147
+ - release.config.js
89
148
  - spec/spec_helper.rb
90
149
  - spec/yq_bin_spec.rb
91
150
  - spec/yq_spec.rb
@@ -110,8 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
169
  - !ruby/object:Gem::Version
111
170
  version: '0'
112
171
  requirements: []
113
- rubyforge_project:
114
- rubygems_version: 2.7.7
172
+ rubygems_version: 3.1.6
115
173
  signing_key:
116
174
  specification_version: 4
117
175
  summary: A JQ wrapper for YAML
data/.travis.yml DELETED
@@ -1,8 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.0
4
- - 2.4
5
- - 2.5
6
- - ruby-head
7
- # uncomment this line if your project needs to run something other than `rake`:
8
- script: bundle exec rspec --require spec_helper --color --format documentation spec