gemline 0.4.0 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/tests.yml +32 -0
- data/Gemfile +1 -1
- data/README.rdoc +2 -0
- data/gemline.gemspec +8 -8
- data/lib/gemline.rb +3 -5
- data/spec/acceptance_spec.rb +2 -2
- data/spec/gemline_spec.rb +4 -4
- data/spec/spec_helper.rb +4 -12
- metadata +31 -45
- data/.travis.yml +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e3db9a6652fac1ac236055d4788dbf67546683d8dbab7d17a7af1c1aa523097e
|
4
|
+
data.tar.gz: 0613e6225bcb1016d8a0535dae98388455e4eb0b9ac415ea0e5c95c087c4f5e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31a155836315d9bababfb8b505c6df2893213b5f7fb08ca20f4aed963c9e0acdd169324092093e8272caf116fa6c8cea15f41e8e4bd3601060e222f3e211df67
|
7
|
+
data.tar.gz: 1d21c18c40a0af36d350ad709437d94b7840eb046febea3ff8407ea8bf4d3c9e194cca535ba6caf666f2896a294e0e5ebebf3918aefe1092f9eb825bb5a1ba84
|
@@ -0,0 +1,32 @@
|
|
1
|
+
name: Ruby CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- main
|
7
|
+
paths-ignore:
|
8
|
+
- 'README.rdoc'
|
9
|
+
pull_request:
|
10
|
+
branches:
|
11
|
+
- main
|
12
|
+
paths-ignore:
|
13
|
+
- 'README.rdoc'
|
14
|
+
jobs:
|
15
|
+
test:
|
16
|
+
runs-on: ubuntu-latest
|
17
|
+
if: "contains(github.event.commits[0].message, '[ci skip]') == false"
|
18
|
+
|
19
|
+
strategy:
|
20
|
+
matrix:
|
21
|
+
ruby: [3.0.2, 2.7.4, 2.6.8]
|
22
|
+
|
23
|
+
steps:
|
24
|
+
- name: Checkout
|
25
|
+
uses: actions/checkout@v2
|
26
|
+
- name: Setup Ruby
|
27
|
+
uses: ruby/setup-ruby@v1
|
28
|
+
with:
|
29
|
+
ruby-version: ${{ matrix.ruby }}
|
30
|
+
bundler-cache: true
|
31
|
+
- name: Test
|
32
|
+
run: bundle exec rake spec
|
data/Gemfile
CHANGED
data/README.rdoc
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
= gemline
|
2
2
|
|
3
|
+
{<img src="https://travis-ci.org/joealba/gemline.svg?branch=master" alt="Build Status" />}[https://travis-ci.org/joealba/gemline]
|
4
|
+
|
3
5
|
Create a tilde-arrow Gemfile line for a gem on rubygems.org using the latest version number available according to the rubygems api.
|
4
6
|
|
5
7
|
If possible, we'll also copy that Gemfile line into the clipboard using pbcopy.
|
data/gemline.gemspec
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
|
-
gem.authors = ["
|
4
|
+
gem.authors = ["Joe Alba"]
|
5
5
|
gem.email = ["joe@joealba.com"]
|
6
6
|
gem.description = %q{Grab the latest Gemfile 'gem' line for a specific Ruby gem}
|
7
7
|
gem.summary = %q{}
|
8
|
-
gem.homepage = "
|
8
|
+
gem.homepage = "https://github.com/joealba/gemline"
|
9
9
|
|
10
10
|
gem.executables = ['gemline']
|
11
11
|
gem.files = `git ls-files`.split("\n")
|
@@ -13,10 +13,10 @@ Gem::Specification.new do |gem|
|
|
13
13
|
gem.name = "gemline"
|
14
14
|
gem.require_paths = ["lib"]
|
15
15
|
|
16
|
-
gem.version = '0.4.
|
16
|
+
gem.version = '0.4.5'
|
17
|
+
gem.license = 'MIT'
|
17
18
|
|
18
|
-
gem.add_dependency "
|
19
|
-
gem.add_dependency "clipboard", ">= 1.0.1"
|
19
|
+
gem.add_dependency "clipboard", ">= 1.3.5"
|
20
20
|
|
21
21
|
# if RUBY_PLATFORM =~ /(win|w)32$/
|
22
22
|
## The clipboard gem doesn't do a platform-dependent check,
|
@@ -24,7 +24,7 @@ Gem::Specification.new do |gem|
|
|
24
24
|
gem.add_dependency "ffi"
|
25
25
|
# end
|
26
26
|
|
27
|
-
gem.add_development_dependency "rake"
|
28
|
-
gem.add_development_dependency "rspec", ">=
|
29
|
-
gem.add_development_dependency "simplecov"
|
27
|
+
gem.add_development_dependency "rake"
|
28
|
+
gem.add_development_dependency "rspec", ">= 3.0"
|
29
|
+
gem.add_development_dependency "simplecov"
|
30
30
|
end
|
data/lib/gemline.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
require 'json/pure'
|
2
1
|
require 'net/https'
|
3
2
|
require 'clipboard'
|
3
|
+
require 'json'
|
4
4
|
|
5
5
|
class Gemline
|
6
6
|
attr_accessor :gem, :gemline, :json, :response
|
@@ -31,17 +31,15 @@ class Gemline
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def gem_not_found?
|
34
|
-
|
34
|
+
!!@json.match(/(could not be found|does not exist)/)
|
35
35
|
end
|
36
36
|
|
37
|
-
|
38
37
|
private
|
39
38
|
|
40
39
|
def self.get_rubygem_json(gem_name)
|
41
40
|
uri = URI.parse("https://rubygems.org/api/v1/gems/#{gem_name}.json")
|
42
41
|
http = Net::HTTP.new(uri.host, uri.port)
|
43
42
|
http.use_ssl = true
|
44
|
-
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
45
43
|
request = Net::HTTP::Get.new(uri.request_uri)
|
46
44
|
response = http.request(request)
|
47
45
|
response.body
|
@@ -66,6 +64,7 @@ class Gemline
|
|
66
64
|
options[:group] = [options[:group]].flatten.map { |x| x.to_sym }
|
67
65
|
options[:group] = options[:group].first if options[:group].length == 1
|
68
66
|
end
|
67
|
+
|
69
68
|
options.inspect.delete('{}').gsub(/(?!\s)=>(?!\s)/, ' => ')
|
70
69
|
end
|
71
70
|
|
@@ -85,5 +84,4 @@ class Gemline
|
|
85
84
|
## Yeah, I hate this too. But it does what I want -- silently fail if Clipboard fails.
|
86
85
|
end
|
87
86
|
end
|
88
|
-
|
89
87
|
end
|
data/spec/acceptance_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require 'stringio'
|
|
3
3
|
|
4
4
|
describe "gemline output" do
|
5
5
|
|
6
|
-
before do
|
6
|
+
before do
|
7
7
|
stub_rubygems_json_output
|
8
8
|
end
|
9
9
|
|
@@ -13,7 +13,7 @@ describe "gemline output" do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should output nothing to STDOUT on error" do
|
16
|
-
Kernel.
|
16
|
+
allow(Kernel).to receive(:exit).and_return(true)
|
17
17
|
grab_io { Gemline.query('doesnotexist') }
|
18
18
|
expect(@stdout.readlines.count).to eq(0)
|
19
19
|
end
|
data/spec/gemline_spec.rb
CHANGED
@@ -15,14 +15,14 @@ describe Gemline do
|
|
15
15
|
|
16
16
|
it "should whine when the gem you are querying does not exist" do
|
17
17
|
g = Gemline.new('doesnotexist')
|
18
|
-
g.gem_not_found
|
19
|
-
expect(g.gemline).to
|
18
|
+
expect(g.gem_not_found?).to eq true
|
19
|
+
expect(g.gemline).to eq nil
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should properly detect a blocked gem name" do
|
23
23
|
g = Gemline.new('yaml')
|
24
|
-
expect(g.gem_not_found?).to
|
25
|
-
expect(g.gemline).to
|
24
|
+
expect(g.gem_not_found?).to eq true
|
25
|
+
expect(g.gemline).to eq nil
|
26
26
|
end
|
27
27
|
|
28
28
|
it "should properly handle funny characters in the returned JSON" do
|
data/spec/spec_helper.rb
CHANGED
@@ -1,29 +1,21 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
add_filter "/spec/"
|
5
|
-
end
|
1
|
+
require 'simplecov'
|
2
|
+
SimpleCov.start do
|
3
|
+
add_filter "/spec/"
|
6
4
|
end
|
7
5
|
|
8
6
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
9
7
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
10
8
|
|
11
|
-
require 'rubygems'
|
12
9
|
require 'gemline'
|
13
10
|
|
14
|
-
require 'bundler'
|
15
|
-
Bundler.setup
|
16
|
-
|
17
|
-
|
18
11
|
RSpec.configure do |c|
|
19
12
|
# c.mock_with :rr
|
20
13
|
end
|
21
14
|
|
22
|
-
|
23
15
|
def stub_rubygems_json_output
|
24
16
|
Dir.glob(File.join(File.dirname(__FILE__),'samples', '*.json')).each do |f|
|
25
17
|
gem_name = $1 if f =~ /\/([\w\-]+).json$/
|
26
|
-
Gemline.
|
18
|
+
allow(Gemline).to receive(:get_rubygem_json).with(gem_name).and_return(IO.read(f))
|
27
19
|
end
|
28
20
|
end
|
29
21
|
|
metadata
CHANGED
@@ -1,99 +1,85 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gemline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
8
|
-
autorequire:
|
7
|
+
- Joe Alba
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: json_pure
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - '>='
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 1.7.6
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - '>='
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 1.7.6
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: clipboard
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
30
16
|
requirements:
|
31
|
-
- -
|
17
|
+
- - ">="
|
32
18
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
19
|
+
version: 1.3.5
|
34
20
|
type: :runtime
|
35
21
|
prerelease: false
|
36
22
|
version_requirements: !ruby/object:Gem::Requirement
|
37
23
|
requirements:
|
38
|
-
- -
|
24
|
+
- - ">="
|
39
25
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
26
|
+
version: 1.3.5
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: ffi
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
44
30
|
requirements:
|
45
|
-
- -
|
31
|
+
- - ">="
|
46
32
|
- !ruby/object:Gem::Version
|
47
33
|
version: '0'
|
48
34
|
type: :runtime
|
49
35
|
prerelease: false
|
50
36
|
version_requirements: !ruby/object:Gem::Requirement
|
51
37
|
requirements:
|
52
|
-
- -
|
38
|
+
- - ">="
|
53
39
|
- !ruby/object:Gem::Version
|
54
40
|
version: '0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: rake
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
58
44
|
requirements:
|
59
|
-
- -
|
45
|
+
- - ">="
|
60
46
|
- !ruby/object:Gem::Version
|
61
47
|
version: '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
54
|
version: '0'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: rspec
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
72
58
|
requirements:
|
73
|
-
- -
|
59
|
+
- - ">="
|
74
60
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
61
|
+
version: '3.0'
|
76
62
|
type: :development
|
77
63
|
prerelease: false
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
79
65
|
requirements:
|
80
|
-
- -
|
66
|
+
- - ">="
|
81
67
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
68
|
+
version: '3.0'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: simplecov
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
86
72
|
requirements:
|
87
|
-
- -
|
73
|
+
- - ">="
|
88
74
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0
|
75
|
+
version: '0'
|
90
76
|
type: :development
|
91
77
|
prerelease: false
|
92
78
|
version_requirements: !ruby/object:Gem::Requirement
|
93
79
|
requirements:
|
94
|
-
- -
|
80
|
+
- - ">="
|
95
81
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0
|
82
|
+
version: '0'
|
97
83
|
description: Grab the latest Gemfile 'gem' line for a specific Ruby gem
|
98
84
|
email:
|
99
85
|
- joe@joealba.com
|
@@ -102,9 +88,9 @@ executables:
|
|
102
88
|
extensions: []
|
103
89
|
extra_rdoc_files: []
|
104
90
|
files:
|
105
|
-
- .
|
106
|
-
- .
|
107
|
-
- .
|
91
|
+
- ".github/workflows/tests.yml"
|
92
|
+
- ".gitignore"
|
93
|
+
- ".rspec"
|
108
94
|
- Gemfile
|
109
95
|
- README.rdoc
|
110
96
|
- Rakefile
|
@@ -118,27 +104,27 @@ files:
|
|
118
104
|
- spec/samples/rails.json
|
119
105
|
- spec/samples/yaml.json
|
120
106
|
- spec/spec_helper.rb
|
121
|
-
homepage:
|
122
|
-
licenses:
|
107
|
+
homepage: https://github.com/joealba/gemline
|
108
|
+
licenses:
|
109
|
+
- MIT
|
123
110
|
metadata: {}
|
124
|
-
post_install_message:
|
111
|
+
post_install_message:
|
125
112
|
rdoc_options: []
|
126
113
|
require_paths:
|
127
114
|
- lib
|
128
115
|
required_ruby_version: !ruby/object:Gem::Requirement
|
129
116
|
requirements:
|
130
|
-
- -
|
117
|
+
- - ">="
|
131
118
|
- !ruby/object:Gem::Version
|
132
119
|
version: '0'
|
133
120
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
121
|
requirements:
|
135
|
-
- -
|
122
|
+
- - ">="
|
136
123
|
- !ruby/object:Gem::Version
|
137
124
|
version: '0'
|
138
125
|
requirements: []
|
139
|
-
|
140
|
-
|
141
|
-
signing_key:
|
126
|
+
rubygems_version: 3.1.4
|
127
|
+
signing_key:
|
142
128
|
specification_version: 4
|
143
129
|
summary: ''
|
144
130
|
test_files:
|