gondler 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gondler/gomfile.rb +8 -0
- data/lib/gondler/version.rb +1 -1
- data/spec/gondler/gomfile_spec.rb +37 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b03e013b9322bd0faafabde124037f99ea9ca05
|
4
|
+
data.tar.gz: 9f94b158384ffa4485b7c2672310d1f89730f77f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ed581159fee0c15c4838b8b69d050a54b64e6dbad32033c08eac334c0f64aa377341abe419c86703daacdc52f59518588a6290c827ca05e0d6bcd668528d38c
|
7
|
+
data.tar.gz: c7ace8ed50f1b1ae183712c45efda57819490f8d054a935dae9eb5b394fd264cc1cc4f3ef2bbbd1c57a81b494b16cca65c8b7cc10f9317b83cfdbc5cb20e7583
|
data/lib/gondler/gomfile.rb
CHANGED
@@ -65,6 +65,14 @@ module Gondler
|
|
65
65
|
@now_os = nil
|
66
66
|
end
|
67
67
|
|
68
|
+
def autodetect
|
69
|
+
deps = `go list -f '{{join .Deps "\\n"}}' ./...`.strip.split(/\n+/)
|
70
|
+
|
71
|
+
deps.each do |dep|
|
72
|
+
gom(dep) unless dep.include?('.')
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
68
76
|
class NotFound < StandardError
|
69
77
|
def initialize(gomfile)
|
70
78
|
@gomfile = gomfile
|
data/lib/gondler/version.rb
CHANGED
@@ -97,4 +97,41 @@ describe Gondler::Gomfile do
|
|
97
97
|
end
|
98
98
|
end
|
99
99
|
end
|
100
|
+
|
101
|
+
describe '#autodetect' do
|
102
|
+
subject(:packages) { gomfile.packages }
|
103
|
+
|
104
|
+
it "returns empty" do
|
105
|
+
expect(packages).to be_empty
|
106
|
+
end
|
107
|
+
|
108
|
+
context 'with autodetect' do
|
109
|
+
around do |e|
|
110
|
+
Dir.chdir(tmpdir) do
|
111
|
+
e.run
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
before do
|
116
|
+
open(File.join(tmpdir, "example.go"), 'w') do |f|
|
117
|
+
f.write(<<-EOF)
|
118
|
+
package example
|
119
|
+
|
120
|
+
import (
|
121
|
+
"github.com/golang/glog"
|
122
|
+
)
|
123
|
+
|
124
|
+
func main() {
|
125
|
+
}
|
126
|
+
EOF
|
127
|
+
end
|
128
|
+
|
129
|
+
gomfile.autodetect
|
130
|
+
end
|
131
|
+
|
132
|
+
it "returns not empty" do
|
133
|
+
expect(packages).to_not be_empty
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
100
137
|
end
|