bun 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +5 -5
- data/bun.gemspec +5 -5
- data/lib/bun/arguments.rb +48 -46
- data/lib/bun/errors.rb +0 -1
- data/lib/bun/version.rb +1 -1
- data/lib/bun/version_fetcher.rb +34 -31
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d621884082dd78c98f0cffcf7252526256f50d25d16a7d359b4938bec037af98
|
4
|
+
data.tar.gz: d1901478267385abd1ca5dd4664388c07f30419c55c3efc733fb395c0b317612
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fea7b713f724b63378dc543e905006f9ee145283fb23435eefcddcb19e7c47b5ab0ad3d35a5ae3d2b141d85f324bc17af9109ecef5db983f81a4979b86be61f8
|
7
|
+
data.tar.gz: e5f57a7963312f8825e56b240c1e9f2ba5b2cfdd6575ff0c9af1c183b9777ce10e71529c9a509f6184622576d2f5d1be6fa36943cae4623b276b5f8ed4c8e3d7
|
data/Gemfile.lock
CHANGED
@@ -2,8 +2,9 @@ PATH
|
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
4
|
bun (1.0.0)
|
5
|
-
|
6
|
-
|
5
|
+
bundler (~> 1.16)
|
6
|
+
paint (~> 2.0)
|
7
|
+
tty-spinner (~> 0.8)
|
7
8
|
|
8
9
|
GEM
|
9
10
|
remote: https://rubygems.org/
|
@@ -38,10 +39,9 @@ PLATFORMS
|
|
38
39
|
|
39
40
|
DEPENDENCIES
|
40
41
|
bun!
|
41
|
-
|
42
|
-
pry (~> 0.11.3)
|
42
|
+
pry (~> 0.11)
|
43
43
|
rake (~> 10.0)
|
44
|
-
rspec (~> 3.7
|
44
|
+
rspec (~> 3.7)
|
45
45
|
|
46
46
|
BUNDLED WITH
|
47
47
|
1.16.1
|
data/bun.gemspec
CHANGED
@@ -19,11 +19,11 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
-
spec.add_runtime_dependency "tty-spinner", "~> 0.8
|
23
|
-
spec.add_runtime_dependency "paint", "~> 2.0
|
22
|
+
spec.add_runtime_dependency "tty-spinner", "~> 0.8"
|
23
|
+
spec.add_runtime_dependency "paint", "~> 2.0"
|
24
|
+
spec.add_runtime_dependency "bundler", "~> 1.16"
|
24
25
|
|
25
|
-
spec.add_development_dependency "bundler", "~> 1.16"
|
26
26
|
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
-
spec.add_development_dependency "rspec", "~> 3.7
|
28
|
-
spec.add_development_dependency "pry", "~> 0.11
|
27
|
+
spec.add_development_dependency "rspec", "~> 3.7"
|
28
|
+
spec.add_development_dependency "pry", "~> 0.11"
|
29
29
|
end
|
data/lib/bun/arguments.rb
CHANGED
@@ -1,66 +1,68 @@
|
|
1
1
|
require "optparse"
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
module Bun
|
4
|
+
class Arguments
|
5
|
+
def initialize(arguments)
|
6
|
+
@arguments = arguments
|
7
|
+
end
|
7
8
|
|
8
|
-
|
9
|
+
attr_accessor :optimistic, :strict, :group, :skip_install, :print
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
alias :strict? :strict
|
12
|
+
alias :optimistic? :optimistic
|
13
|
+
alias :skip_install? :skip_install
|
14
|
+
alias :print? :print
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
16
|
+
def empty?
|
17
|
+
@arguments.empty?
|
18
|
+
end
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
20
|
+
def parse
|
21
|
+
opt_parser = OptionParser.new do |opts|
|
22
|
+
opts.banner = Bun::Messages::USAGE
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
|
24
|
+
opts.on("-P", "--print", "# Just print the gem name and version and exit.") do
|
25
|
+
self.print = true
|
26
|
+
end
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
28
|
+
opts.on("-o", "--optimistic", "# Use optimistic version range >= instead of ~>.") do
|
29
|
+
self.optimistic = true
|
30
|
+
end
|
30
31
|
|
31
|
-
|
32
|
-
|
33
|
-
|
32
|
+
opts.on("-S", "--strict", "# Use strict version instead of ~> range.") do
|
33
|
+
self.strict = true
|
34
|
+
end
|
34
35
|
|
35
|
-
|
36
|
-
|
37
|
-
|
36
|
+
opts.on("-d", "--development", "# Add gem to development group.") do
|
37
|
+
self.group = :development
|
38
|
+
end
|
38
39
|
|
39
|
-
|
40
|
-
|
41
|
-
|
40
|
+
opts.on("-t", "--test", "# Add gem to test group.") do
|
41
|
+
self.group = :test
|
42
|
+
end
|
42
43
|
|
43
|
-
|
44
|
-
|
45
|
-
|
44
|
+
opts.on("-s", "--skip-install", "# Skip the install step.") do
|
45
|
+
self.skip_install = true
|
46
|
+
end
|
46
47
|
|
47
|
-
|
48
|
-
|
49
|
-
|
48
|
+
opts.on_tail("-h", "--help", "# Print these usage instructions.") do
|
49
|
+
puts opts
|
50
|
+
end
|
50
51
|
|
51
|
-
|
52
|
-
|
52
|
+
opts.on("-v", "--version", "# Show current Bun version.") do
|
53
|
+
puts Bun::VERSION
|
54
|
+
end
|
53
55
|
end
|
54
|
-
end
|
55
56
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
57
|
+
begin
|
58
|
+
opt_parser.parse(arguments)
|
59
|
+
rescue OptionParser::InvalidOption
|
60
|
+
puts opt_parser
|
61
|
+
end
|
60
62
|
end
|
61
|
-
end
|
62
63
|
|
63
|
-
|
64
|
+
private
|
64
65
|
|
65
|
-
|
66
|
+
attr :arguments
|
67
|
+
end
|
66
68
|
end
|
data/lib/bun/errors.rb
CHANGED
data/lib/bun/version.rb
CHANGED
data/lib/bun/version_fetcher.rb
CHANGED
@@ -2,45 +2,48 @@ require "json"
|
|
2
2
|
require "open-uri"
|
3
3
|
require "tty/spinner"
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
module Bun
|
6
|
+
class VersionFetcher
|
7
|
+
RUBYGEMS_SEARCH_URL = "https://rubygems.org/api/v1/search.json"
|
8
|
+
|
9
|
+
def initialize(gem, arguments)
|
10
|
+
@gem = gem
|
11
|
+
@arguments = arguments
|
12
|
+
end
|
11
13
|
|
12
|
-
|
13
|
-
|
14
|
+
def fetch_latest_version
|
15
|
+
version = nil
|
14
16
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
with_optional_spinner do
|
18
|
+
response = open("#{RUBYGEMS_SEARCH_URL}?query=#{gem}").read
|
19
|
+
json_response = JSON.parse(response)
|
20
|
+
latest_gem_attributes = json_response.
|
21
|
+
find {|attributes| attributes["name"] == gem }
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
+
unless latest_gem_attributes
|
24
|
+
raise ::Bun::Errors::GemNotFoundError.new("Aborting. Gem not found: #{gem}")
|
25
|
+
end
|
26
|
+
|
27
|
+
version = latest_gem_attributes["version"]
|
23
28
|
end
|
24
29
|
|
25
|
-
version
|
30
|
+
version
|
26
31
|
end
|
27
32
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
yield
|
38
|
-
spinner.stop("Done!")
|
33
|
+
def with_optional_spinner
|
34
|
+
if arguments.print?
|
35
|
+
yield
|
36
|
+
else
|
37
|
+
spinner = TTY::Spinner.new("[:spinner] Finding latest gem version for \"#{gem}\"...")
|
38
|
+
spinner.auto_spin
|
39
|
+
yield
|
40
|
+
spinner.stop("Done!")
|
41
|
+
end
|
39
42
|
end
|
40
|
-
end
|
41
43
|
|
42
|
-
|
44
|
+
private
|
43
45
|
|
44
|
-
|
45
|
-
|
46
|
+
attr :gem
|
47
|
+
attr :arguments
|
48
|
+
end
|
46
49
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bun
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hrvoje Šimić
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tty-spinner
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.8
|
19
|
+
version: '0.8'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.8
|
26
|
+
version: '0.8'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: paint
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.0
|
33
|
+
version: '2.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 2.0
|
40
|
+
version: '2.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -45,7 +45,7 @@ dependencies:
|
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.16'
|
48
|
-
type: :
|
48
|
+
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
@@ -72,28 +72,28 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 3.7
|
75
|
+
version: '3.7'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 3.7
|
82
|
+
version: '3.7'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: pry
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.11
|
89
|
+
version: '0.11'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.11
|
96
|
+
version: '0.11'
|
97
97
|
description:
|
98
98
|
email:
|
99
99
|
- shime@twobucks.co
|