gondler 0.0.2 → 0.0.3
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/README.md +2 -0
- data/Rakefile +5 -0
- data/lib/gondler/cli.rb +25 -12
- data/lib/gondler/gomfile.rb +11 -0
- data/lib/gondler/version.rb +1 -1
- data/spec/gondler/gomfile_spec.rb +14 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f45c6f030b16dcf668b852a6ad8cf38aa3dcd8c
|
4
|
+
data.tar.gz: c59c85cf4b94f661080eff0f6f52f92e78424680
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fe061e44abb41e2a0b8ba230b0b4a376b4990edf8d10509ecc0ae04b8c8f2c5c0a62b3c72c4f4e04d9c6b65fbdcaa2ae2ba5d1f3e20703a764cfb3effa84222
|
7
|
+
data.tar.gz: c22619b469e1528f31fc3edb3d6d12c3c4b9810d6ac1f2e0e3e2547d83d257e74f2e20863563dc0198031d88789a693dd9747eaeb46f64f7a1eb2cc37560a2e1
|
data/README.md
CHANGED
data/Rakefile
CHANGED
data/lib/gondler/cli.rb
CHANGED
@@ -11,18 +11,13 @@ module Gondler
|
|
11
11
|
def initialize(*args)
|
12
12
|
super
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
path = Pathname.new(options[:path])
|
17
|
-
path = Pathname.pwd + path unless path.absolute?
|
18
|
-
Gondler.env.path = path
|
19
|
-
ENV['PATH'] = "#{path + 'bin'}:#{ENV['PATH']}"
|
14
|
+
set_environments
|
20
15
|
end
|
21
16
|
|
22
17
|
desc 'install', 'Install the dependecies specified in your Gomfile'
|
23
18
|
method_option :without, type: :array, default: []
|
24
19
|
def install
|
25
|
-
|
20
|
+
gomfile.packages.each do |package|
|
26
21
|
puts "Install #{package}"
|
27
22
|
package.resolve
|
28
23
|
end
|
@@ -59,16 +54,14 @@ module Gondler
|
|
59
54
|
Gondler.withouts = options[:without]
|
60
55
|
|
61
56
|
puts 'Packages included by the gondler:'
|
62
|
-
|
57
|
+
gomfile.packages.each do |package|
|
63
58
|
puts " * #{package}"
|
64
59
|
end
|
65
60
|
end
|
66
61
|
|
67
62
|
desc 'repl', 'REPL in the context of Gondler'
|
68
63
|
def repl
|
69
|
-
while buf = Readline.readline('> ', true)
|
70
|
-
Kernel.system(buf)
|
71
|
-
end
|
64
|
+
Kernel.system(buf) while buf = Readline.readline('> ', true)
|
72
65
|
end
|
73
66
|
|
74
67
|
desc 'version', 'Print Gondler version'
|
@@ -76,10 +69,18 @@ module Gondler
|
|
76
69
|
puts Gondler::VERSION
|
77
70
|
end
|
78
71
|
|
72
|
+
desc 'env', 'Print Gondler environments'
|
73
|
+
def env
|
74
|
+
system('go env')
|
75
|
+
end
|
76
|
+
|
77
|
+
private
|
78
|
+
|
79
79
|
def method_missing(*args)
|
80
80
|
if executable?(args.first)
|
81
81
|
invoke(:exec, args)
|
82
82
|
elsif executable?("gondler-#{args.first}")
|
83
|
+
args[0] = "gondler-#{args.first}"
|
83
84
|
invoke(:exec, args)
|
84
85
|
else
|
85
86
|
STDERR.puts(%Q{Could not find command "#{args.first}"})
|
@@ -87,10 +88,22 @@ module Gondler
|
|
87
88
|
end
|
88
89
|
end
|
89
90
|
|
90
|
-
|
91
|
+
def set_environments
|
92
|
+
path = Pathname.new(options[:path])
|
93
|
+
path = Pathname.pwd + path unless path.absolute?
|
94
|
+
Gondler.env.path = path
|
95
|
+
ENV['PATH'] = "#{path + 'bin'}:#{ENV['PATH']}"
|
96
|
+
end
|
91
97
|
|
92
98
|
def executable?(name)
|
93
99
|
system("hash #{name} 1> /dev/null 2>&1")
|
94
100
|
end
|
101
|
+
|
102
|
+
def gomfile
|
103
|
+
@gomfile ||= Gondler::Gomfile.new(options[:gomfile])
|
104
|
+
rescue Gomfile::NotFound => e
|
105
|
+
say(e.message, :red)
|
106
|
+
exit(1)
|
107
|
+
end
|
95
108
|
end
|
96
109
|
end
|
data/lib/gondler/gomfile.rb
CHANGED
@@ -3,6 +3,7 @@ require 'gondler/package'
|
|
3
3
|
module Gondler
|
4
4
|
class Gomfile
|
5
5
|
def initialize(path)
|
6
|
+
raise NotFound, path unless File.exist?(path)
|
6
7
|
@packages = []
|
7
8
|
|
8
9
|
load(path)
|
@@ -35,5 +36,15 @@ module Gondler
|
|
35
36
|
ensure
|
36
37
|
@now_os = nil
|
37
38
|
end
|
39
|
+
|
40
|
+
class NotFound < StandardError
|
41
|
+
def initialize(gomfile)
|
42
|
+
@gomfile = gomfile
|
43
|
+
end
|
44
|
+
|
45
|
+
def message
|
46
|
+
"Gondler require gomfile. Your gomfile is not found: #{@gomfile}"
|
47
|
+
end
|
48
|
+
end
|
38
49
|
end
|
39
50
|
end
|
data/lib/gondler/version.rb
CHANGED
@@ -13,6 +13,20 @@ describe Gondler::Gomfile do
|
|
13
13
|
let(:content) { '' }
|
14
14
|
after { file.close! }
|
15
15
|
|
16
|
+
describe '#initialize' do
|
17
|
+
let(:path) { 'Gomfile' }
|
18
|
+
|
19
|
+
subject(:init) { described_class.new(path) }
|
20
|
+
|
21
|
+
context 'without Gomfile' do
|
22
|
+
let(:path) { '' }
|
23
|
+
|
24
|
+
it 'raises Gondler::Gomfile::NotFound' do
|
25
|
+
expect { init }.to raise_error(Gondler::Gomfile::NotFound)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
16
30
|
describe '#gom' do
|
17
31
|
let(:content) do
|
18
32
|
<<-CONTENT
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gondler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sho Kusano
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -87,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
87
|
version: '0'
|
88
88
|
requirements: []
|
89
89
|
rubyforge_project:
|
90
|
-
rubygems_version: 2.
|
90
|
+
rubygems_version: 2.0.2
|
91
91
|
signing_key:
|
92
92
|
specification_version: 4
|
93
93
|
summary: bundler for golang
|