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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6c3a4d05fed84fad04596e6750bd38861f18be66
4
- data.tar.gz: c92474a158eaa6098f30c13c8649d194174f7547
3
+ metadata.gz: 2b03e013b9322bd0faafabde124037f99ea9ca05
4
+ data.tar.gz: 9f94b158384ffa4485b7c2672310d1f89730f77f
5
5
  SHA512:
6
- metadata.gz: 552503025a15c5c49d340fd26e384c6a55661c1d4a8c23fcc76bb4f9d10063a5121501c3a86a1fa2586bf11b1d02d17f627442f344e137fb234841dd8c98aa2a
7
- data.tar.gz: bb9124427ca1b1deff8fea4ca5fd7bcaac2282ec8759d7a7dbfdac03361edcc3cb1015f708c8b506d93c1459de3508e5bccfae61c7052afc7036f4889b0f78d8
6
+ metadata.gz: 3ed581159fee0c15c4838b8b69d050a54b64e6dbad32033c08eac334c0f64aa377341abe419c86703daacdc52f59518588a6290c827ca05e0d6bcd668528d38c
7
+ data.tar.gz: c7ace8ed50f1b1ae183712c45efda57819490f8d054a935dae9eb5b394fd264cc1cc4f3ef2bbbd1c57a81b494b16cca65c8b7cc10f9317b83cfdbc5cb20e7583
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Gondler
2
- VERSION = '0.3.1'
2
+ VERSION = '0.4.0'
3
3
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gondler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sho Kusano