mvn-get 0.0.2 → 0.0.3

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: bf08376d58d584a6ef6551ffa2da90f334666615
4
- data.tar.gz: f09af3012fc3dd9226f44a1e549d0279ce9c323e
3
+ metadata.gz: 05dfa24826165feb2d1041a6ca65f1386495e46b
4
+ data.tar.gz: c607c48f12a969f852d2cd5545750206ddf6a4b0
5
5
  SHA512:
6
- metadata.gz: dc06f40b4f80de28326829bf5b0096059b67ef974010f42f316b804b7eff81da23b3a551400fc32d797b847fdf8a6d2c05370d165a95142193c7c540cbe7efea
7
- data.tar.gz: 40f4fc1e067f3964fbe2d2f4bd614b643b681783f244f182c9211a382bcc898bc8983b4b63d1a4a62c2039d7831ef0315b2c754d698d83316da221c2adad0225
6
+ metadata.gz: b010e03b2368d581dc6d7879117e28041d201602e0407cd7d5a8d2e3fb330efded86d40d5fd8b88986cddbc1f1d83282e88cab3392f1ad4583a3fcef2cfb57d0
7
+ data.tar.gz: 4d8dc18b2eb4ae97442eeb0aeb28bae511dd4f6c8056f5cf7905eec8cfa4201a15b248b5080c57c914669957b24a140ff685b45d653cc3e8d015ee178e9556b9
@@ -60,6 +60,7 @@ class CommandLine < Thor
60
60
  x.download
61
61
  }
62
62
  end
63
+ puts "Complete!"
63
64
  end
64
65
  end
65
66
 
@@ -13,7 +13,7 @@ module MavenCentral
13
13
  module_function
14
14
 
15
15
  def version
16
- "0.0.2"
16
+ "0.0.3"
17
17
  end
18
18
 
19
19
  def extract_url_from_dict(d, filetype="pom")
@@ -50,8 +50,6 @@ module MavenCentral
50
50
  "#{MAVEN_CENTRAL_SEARCH}?q=#{keyword}&wt=json"
51
51
  end
52
52
 
53
- # puts url
54
-
55
53
  result = {}
56
54
  body = JSON.parse(MavenCentral.request(url))
57
55
  result["candidates"] = body["response"]["docs"].map{|x| x["id"] }
@@ -81,7 +79,7 @@ class MavenCentralRepo
81
79
 
82
80
  @id = id
83
81
  d = MavenCentral.id2dict(@id)
84
- raise "not a correct id.\n please use 'groupId:artifactId' or 'groupId:artifactId:version'" if d.nil?
82
+ raise "not a correct id. please use 'groupId:artifactId' or 'groupId:artifactId:version'" if d.nil?
85
83
 
86
84
  # use lastest version by default
87
85
  if d["version"] == nil || d["version"].strip == ""
@@ -92,22 +90,15 @@ class MavenCentralRepo
92
90
  @groupId, @artifactId, @version = d["groupId"], d["artifactId"], d["version"]
93
91
 
94
92
  pom_url = MavenCentral.extract_url_from_dict(d)
95
- # puts pom_url
96
-
97
93
  body = MavenCentral.request(pom_url)
98
94
  @pom = Hash.from_xml( body )
99
95
  end
100
96
 
101
- # def dependencies_url
102
- # dependencies.map{|x| MavenCentral.extract_url_from_id(x, "pom") }
103
- # end
104
-
105
97
  def dependencies(ignore_test_lib = true)
106
98
  return [] if @pom["project"]["dependencies"].nil? or
107
99
  (@pom["project"]["dependencies"].class == String and @pom["project"]["dependencies"].strip == "")
108
100
  [@pom["project"]["dependencies"]["dependency"]].flatten.map{|x|
109
101
  next if ignore_test_lib and x["scope"] and x["scope"].strip == "test"
110
- # puts "dep #{@id}\n#{x}"
111
102
  if x["version"] =~ /\s*[$]{\s*project[.]version\s*}\s*/
112
103
  x["version"] = @version
113
104
  end
@@ -128,7 +119,6 @@ class MavenCentralRepo
128
119
  deps = dependencies(ignore_test_lib)
129
120
  while not deps.empty?
130
121
  d = deps.shift
131
- # puts "deps #{d}"
132
122
  if not res.map{|x| x.id }.include?(d)
133
123
  r = MavenCentralRepo.new(d)
134
124
  if not res.include?(r)
@@ -144,21 +134,15 @@ class MavenCentralRepo
144
134
  end
145
135
  end
146
136
 
147
- # if only_select_lastest_version
148
- # res = res.group_by{|x| "#{x.groupId}:#{x.artifactId}" }.map{|k, v| v.reduce{|s, x| if s.version > x.version then s else x end } }.flatten
149
- # end
137
+ if only_select_lastest_version
138
+ res = res.group_by{|x| "#{x.groupId}:#{x.artifactId}" }.map{|k, v| v.reduce{|s, x| if s.version <=> x.version then x else s end } }.flatten
139
+ end
150
140
 
151
141
  res.sort!
152
142
  @_recursive_dependencies ||= {}
153
143
  @_recursive_dependencies[ignore_test_lib] ||= {}
154
144
  @_recursive_dependencies[ignore_test_lib][only_select_lastest_version] = res
155
145
  return res
156
- # dependencies.map{|x|
157
- # repo = MavenCentralRepo.new(x)
158
- # puts "--- #{@id} ---"
159
- # puts repo.dependencies
160
- # [repo, repo.recursive_dependencies]
161
- # }.flatten
162
146
  end
163
147
 
164
148
  def inspect
@@ -182,25 +166,8 @@ class MavenCentralRepo
182
166
 
183
167
  end
184
168
 
185
- # id = "org.mockito:mockito-core:2.0.7-beta"
186
-
187
- # id = "com.mashape.unirest:unirest-java:1.4.5"
169
+ # id = 'com.mashape.unirest:unirest-java:1.4.5'
188
170
  # r = MavenCentralRepo.new(id)
189
- # r.recursive_dependencies.each {|x| x.download }
190
- # puts r.dependencies
191
-
192
- # puts MavenCentral.search("org.technbolts:junit:1.0.1")
193
-
194
-
195
-
196
- # puts r.recursive_dependencies
197
- # puts r.dependencies_url
198
- # puts r.dependencies
199
-
200
-
201
-
202
- # require 'irb'
203
- # IRB.start
204
171
 
205
172
 
206
173
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mvn-get
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - HondaDai