maven-tools 0.31.0 → 0.32.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/maven/model/model.rb +65 -4
- data/lib/maven/model/utils.rb +31 -1
- data/lib/maven/tools/execute_in_phase.rb +1 -1
- data/lib/maven/tools/gem_project.rb +1 -1
- data/lib/maven/tools/version.rb +1 -1
- metadata +66 -93
- data/lib/maven-tools.rb~ +0 -1
- data/lib/maven/jarfile.rb~ +0 -77
- data/lib/maven/maven_util.rb~ +0 -56
- data/lib/maven/model/dependencies.rb~ +0 -247
- data/lib/maven/model/model.rb~ +0 -528
- data/lib/maven/model/model_utils.rb~ +0 -832
- data/lib/maven/model/utils.rb~ +0 -322
- data/lib/maven/tools/coordinate.rb~ +0 -81
- data/lib/maven/tools/gem_project.rb~ +0 -498
- data/lib/maven/tools/gemfile_lock.rb~ +0 -67
- data/lib/maven/tools/jarfile.rb~ +0 -79
- data/lib/maven/tools/versions.rb~ +0 -13
- data/lib/maven_tools.rb~ +0 -1
@@ -1,67 +0,0 @@
|
|
1
|
-
module Maven
|
2
|
-
module Tools
|
3
|
-
class GemfileLock < Hash
|
4
|
-
|
5
|
-
class Dependency
|
6
|
-
attr_accessor :name, :version, :dependencies
|
7
|
-
def initialize(line, deps = {})
|
8
|
-
@name = line.sub(/\ .*/,'')
|
9
|
-
@version = line.sub(/.*\(/, '').sub(/\).*/, '').sub(/-java$/, '')
|
10
|
-
@dependencies = deps
|
11
|
-
end
|
12
|
-
|
13
|
-
def add(line)
|
14
|
-
dependencies[line.sub(/\ .*/,'')] = line.sub(/.*\(/, '').sub(/\).*/, '')
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def initialize(file)
|
19
|
-
current = nil
|
20
|
-
f = file.is_a?(File) ? file.path: file
|
21
|
-
if File.exists? f
|
22
|
-
File.readlines(f).each do |line|
|
23
|
-
if line =~ /^ [^ ]/
|
24
|
-
line.strip!
|
25
|
-
current = Dependency.new(line)
|
26
|
-
self[current.name] = current
|
27
|
-
elsif line =~ /^ [^ ]/
|
28
|
-
line.strip!
|
29
|
-
current.add(line) if current
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def recurse(result, dep)
|
36
|
-
result[dep] = self[dep].version if self[dep] && !result.key?(dep)
|
37
|
-
if d = self[dep]
|
38
|
-
d.dependencies.each do |name, version|
|
39
|
-
unless result.key? name
|
40
|
-
result[name] = self[name].nil?? version : self[name].version
|
41
|
-
recurse(result, name)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def dependency_hull(deps = [])
|
48
|
-
deps = deps.is_a?(Array) ? deps : [deps]
|
49
|
-
result = {}
|
50
|
-
deps.each do |dep|
|
51
|
-
recurse(result, dep)
|
52
|
-
end
|
53
|
-
result
|
54
|
-
end
|
55
|
-
|
56
|
-
def hull
|
57
|
-
dependency_hull(keys)
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
if $0 == __FILE__
|
64
|
-
lockfile = Maven::Tools::GemfileLock.new(File.new(ARGV[0] || 'Gemfile.lock'))
|
65
|
-
p lockfile
|
66
|
-
p lockfile.dependency_hull("rails")
|
67
|
-
end
|
data/lib/maven/tools/jarfile.rb~
DELETED
@@ -1,79 +0,0 @@
|
|
1
|
-
require 'maven/tools/coordinate'
|
2
|
-
module Maven
|
3
|
-
module Tools
|
4
|
-
|
5
|
-
class Jarfile
|
6
|
-
include Coordinate
|
7
|
-
|
8
|
-
def initialize(file = 'Jarfile')
|
9
|
-
@file = file
|
10
|
-
@lockfile = file + ".lock"
|
11
|
-
end
|
12
|
-
|
13
|
-
def mtime
|
14
|
-
File.mtime(@file)
|
15
|
-
end
|
16
|
-
|
17
|
-
def exists?
|
18
|
-
File.exists?(@file)
|
19
|
-
end
|
20
|
-
|
21
|
-
def mtime_lock
|
22
|
-
File.mtime(@lockfile)
|
23
|
-
end
|
24
|
-
|
25
|
-
def exists_lock?
|
26
|
-
File.exists?(@lockfile)
|
27
|
-
end
|
28
|
-
|
29
|
-
def load_lockfile
|
30
|
-
_locked = []
|
31
|
-
if exists_lock?
|
32
|
-
File.read(@lockfile).each_line do |line|
|
33
|
-
line.strip!
|
34
|
-
if line.size > 0 && !(line =~ /^\s*#/)
|
35
|
-
_locked << line
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
_locked
|
40
|
-
end
|
41
|
-
|
42
|
-
def locked
|
43
|
-
@locked ||= load_lockfile
|
44
|
-
end
|
45
|
-
|
46
|
-
def locked?(coordinate)
|
47
|
-
coord = coordinate.sub(/^([^:]+:[^:]+):.+/) { $1 }
|
48
|
-
locked.detect { |l| l.sub(/^([^:]+:[^:]+):.+/) { $1 } == coord } != nil
|
49
|
-
end
|
50
|
-
|
51
|
-
def populate_unlocked(aether)
|
52
|
-
File.read(@file).each_line do |line|
|
53
|
-
if coord = to_coordinate(line)
|
54
|
-
unless locked?(coord)
|
55
|
-
aether.add_artifact(coord)
|
56
|
-
end
|
57
|
-
elsif line =~ /^\s*(repository|source)\s/
|
58
|
-
name, url = line.sub(/.*(repository|source)\s+/, '').gsub(/['":]/,'').split(/,/)
|
59
|
-
url = name unless url
|
60
|
-
aether.add_repository(name, url)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def populate_locked(aether)
|
66
|
-
locked.each { |l| aether.add_artifact(l) }
|
67
|
-
end
|
68
|
-
|
69
|
-
def generate_lockfile(dependency_coordinates)
|
70
|
-
File.open(@lockfile, 'w') do |f|
|
71
|
-
dependency_coordinates.each do |d|
|
72
|
-
f.puts d.to_s
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
end
|
79
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
module Maven
|
2
|
-
module Tools
|
3
|
-
VERSIONS = {
|
4
|
-
:jetty_plugin => "@jetty.version@",
|
5
|
-
:jruby_rack => "@jruby.rack.version@",
|
6
|
-
:war_plugin => "@war.version@",
|
7
|
-
:jar_plugin => "@jar.version@",
|
8
|
-
:jruby_plugins => "@project.version@",
|
9
|
-
:bundler_version => "@bundler.version@",
|
10
|
-
:jruby_version => defined?(JRUBY_VERSION) ? JRUBY_VERSION : "@jruby.version@"
|
11
|
-
}.freeze
|
12
|
-
end
|
13
|
-
end
|
data/lib/maven_tools.rb~
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require 'maven_tools/jarfile'
|