brewgem 0.0.3 → 0.0.4
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 +4 -4
- data/lib/brewgem/cli.rb +3 -3
- data/lib/brewgem/version.rb +1 -1
- data/lib/brewgem.rb +16 -12
- data/lib/core/string.rb +30 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2029d25d2c8e8d61e3a1030e7a5644b5703242f9
|
|
4
|
+
data.tar.gz: 7dbd98a4455e4932982a6b121c44e1c80f28adb7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dd0cc85b65de7553801b78617c4fe0ce16b208ceb2076c8569bbda37727ab1530c4b1937838940d9dac13fd29144b105ad3055fa14f3a304c05355ae88716d9f
|
|
7
|
+
data.tar.gz: 9e4ad7024470390c317698a6541cf274b28d049efb78f82d81c6038bb83a204f1d21aaf6cef4231764bebcf0f568ff468e7c57743b17ca76f98cae9b313d487b
|
data/lib/brewgem/cli.rb
CHANGED
|
@@ -14,19 +14,19 @@ module BrewGem
|
|
|
14
14
|
method_option :github, type: 'string'
|
|
15
15
|
method_option :verbose, :type => :boolean
|
|
16
16
|
def install(gem_name = nil, version = nil)
|
|
17
|
-
BrewGem.install(gem_name, version
|
|
17
|
+
BrewGem.install(options.merge(name: gem_name, version: version))
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
desc 'update <gem-name>', COMMANDS[:update]
|
|
21
21
|
method_option :verbose, :type => :boolean
|
|
22
22
|
def update(gem_name)
|
|
23
|
-
BrewGem.update(gem_name)
|
|
23
|
+
BrewGem.update(name: gem_name)
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
desc 'uninstall <gem-name>', COMMANDS[:uninstall]
|
|
27
27
|
method_option :verbose, :type => :boolean
|
|
28
28
|
def uninstall(gem_name)
|
|
29
|
-
BrewGem.uninstall(gem_name)
|
|
29
|
+
BrewGem.uninstall(name: gem_name)
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
end
|
data/lib/brewgem/version.rb
CHANGED
data/lib/brewgem.rb
CHANGED
|
@@ -3,16 +3,16 @@ require 'tempfile'
|
|
|
3
3
|
|
|
4
4
|
module BrewGem
|
|
5
5
|
class << self
|
|
6
|
-
def install(
|
|
7
|
-
perform(:install,
|
|
6
|
+
def install(options)
|
|
7
|
+
perform(:install, options)
|
|
8
8
|
end
|
|
9
9
|
|
|
10
|
-
def update(
|
|
11
|
-
perform(:update,
|
|
10
|
+
def update(options)
|
|
11
|
+
perform(:update, options)
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
def uninstall(
|
|
15
|
-
perform(:uninstall,
|
|
14
|
+
def uninstall(options)
|
|
15
|
+
perform(:uninstall, options)
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def require_all_under(dir, recursive: true)
|
|
@@ -25,7 +25,9 @@ module BrewGem
|
|
|
25
25
|
private
|
|
26
26
|
# TODO: Refactor into several methods, and for that need to
|
|
27
27
|
# run ERB from hash bindings instead of local method bindings
|
|
28
|
-
def perform(command,
|
|
28
|
+
def perform(command, options = {})
|
|
29
|
+
name, version = options.values_at(:name, :version)
|
|
30
|
+
|
|
29
31
|
ENV['HOMEBREW_VERBOSE']='true' if options[:verbose]
|
|
30
32
|
if options[:local]
|
|
31
33
|
local_path = File.expand_path(options[:local])
|
|
@@ -42,10 +44,11 @@ module BrewGem
|
|
|
42
44
|
run "gem build #{gemspec_name}"
|
|
43
45
|
end
|
|
44
46
|
|
|
45
|
-
|
|
47
|
+
gem_path = `ls #{File.join(local_path, '*')}.gem`.chomp
|
|
46
48
|
|
|
47
49
|
# recursively call self to install from local gem
|
|
48
|
-
|
|
50
|
+
install(local: gem_path)
|
|
51
|
+
return
|
|
49
52
|
end
|
|
50
53
|
elsif options[:github]
|
|
51
54
|
# clone from github and build gem
|
|
@@ -54,7 +57,8 @@ module BrewGem
|
|
|
54
57
|
target_dir_name = File.join(Dir.tmpdir, "build-#{name}-#{rand(100000000)}")
|
|
55
58
|
run "git clone #{github_gem_path} #{target_dir_name}"
|
|
56
59
|
# recursively call self to install from local dir
|
|
57
|
-
|
|
60
|
+
install(local: target_dir_name)
|
|
61
|
+
return
|
|
58
62
|
else
|
|
59
63
|
# install from rubygems
|
|
60
64
|
gems = `gem list --remote "^#{name}$"`.lines
|
|
@@ -75,7 +79,7 @@ module BrewGem
|
|
|
75
79
|
f.puts template.result(binding)
|
|
76
80
|
end
|
|
77
81
|
|
|
78
|
-
|
|
82
|
+
run "brew #{command} #{filename}"
|
|
79
83
|
ensure
|
|
80
84
|
File.unlink filename
|
|
81
85
|
end
|
|
@@ -87,7 +91,7 @@ module BrewGem
|
|
|
87
91
|
break unless run single_command
|
|
88
92
|
end
|
|
89
93
|
else
|
|
90
|
-
puts "Executing \"#{command}\"..."
|
|
94
|
+
puts "[brewgem] Executing \"#{command}\"...".purple
|
|
91
95
|
if options[:takeover]
|
|
92
96
|
exec command # take over the process
|
|
93
97
|
else
|
data/lib/core/string.rb
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
class String
|
|
2
|
+
# Terminal colorization (light-weight version of "colorize" gem)
|
|
3
|
+
def colorize(color_code)
|
|
4
|
+
"\e[#{color_code}m#{self}\e[0m"
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def red
|
|
8
|
+
colorize(31)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def green
|
|
12
|
+
colorize(32)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def yellow
|
|
16
|
+
colorize(33)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def blue
|
|
20
|
+
colorize(34)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def purple
|
|
24
|
+
colorize(35)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def light_blue
|
|
28
|
+
colorize(36)
|
|
29
|
+
end
|
|
30
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: brewgem
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Joshua Peek
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2015-12-
|
|
13
|
+
date: 2015-12-19 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: thor
|
|
@@ -59,6 +59,7 @@ files:
|
|
|
59
59
|
- lib/brewgem.rb
|
|
60
60
|
- lib/brewgem/cli.rb
|
|
61
61
|
- lib/brewgem/version.rb
|
|
62
|
+
- lib/core/string.rb
|
|
62
63
|
homepage: https://github.com/gtmax/brewgem
|
|
63
64
|
licenses:
|
|
64
65
|
- MIT
|