iron_hammer 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/iron_hammer/projects/dependency.rb +5 -1
- data/lib/iron_hammer/tasks/ivy.rb +1 -0
- data/lib/iron_hammer/utils/ivy_builder.rb +19 -5
- metadata +2 -2
data/Rakefile
CHANGED
@@ -4,11 +4,13 @@ module IronHammer
|
|
4
4
|
attr_accessor :name
|
5
5
|
attr_accessor :version
|
6
6
|
attr_accessor :extension
|
7
|
+
attr_accessor :specific
|
7
8
|
|
8
9
|
def initialize params = {}
|
9
10
|
@name = params[:name] || raise(ArgumentError.new('you must specify a name'))
|
10
11
|
@version = params[:version]
|
11
12
|
@extension = params[:extension] || 'dll'
|
13
|
+
@specific = params[:specific] || false
|
12
14
|
end
|
13
15
|
|
14
16
|
def == other
|
@@ -26,7 +28,9 @@ module IronHammer
|
|
26
28
|
version = match[1] if match
|
27
29
|
raise "Cannot parse version on include: #{includes}" unless version
|
28
30
|
extension = get_extension reference
|
29
|
-
|
31
|
+
specific_el = reference.elements['SpecificVersion']
|
32
|
+
specific = (specific_el && specific_el.text == 'true') || false
|
33
|
+
Dependency.new :name => name, :version => version, :extension => extension, :specific => specific
|
30
34
|
end
|
31
35
|
|
32
36
|
def self.from_project project
|
@@ -38,7 +38,8 @@ module IronHammer
|
|
38
38
|
|
39
39
|
xml.dependencies do
|
40
40
|
dependencies.each do |dependency|
|
41
|
-
rev = dependency.version
|
41
|
+
rev = dependency.version
|
42
|
+
rev = rev.gsub VERSION_PATTERN, VERSION_REPLACE[@config.retrieve_version] unless dependency.specific
|
42
43
|
xml.dependency :org => @config.organisation, :name => dependency.name, :rev => rev do
|
43
44
|
xml.artifact :type => dependency.extension, :name => dependency.name
|
44
45
|
end
|
@@ -51,7 +52,7 @@ module IronHammer
|
|
51
52
|
"java -jar #{@config.ivy_jar}
|
52
53
|
-ivy #{ivy_file}
|
53
54
|
-settings #{@config.ivy_settings}
|
54
|
-
-retrieve Libraries/[
|
55
|
+
-retrieve Libraries/[artifact]-[revision].[ext]".gsub(/\s+/, ' ')
|
55
56
|
end
|
56
57
|
|
57
58
|
def publish ivy_file
|
@@ -74,19 +75,29 @@ module IronHammer
|
|
74
75
|
references = doc.get_elements(ProjectFile::REFERENCE_PATH)
|
75
76
|
references.each do |reference|
|
76
77
|
artifact = artifact_for reference
|
77
|
-
artifact.scan(/Libraries\/(.*)
|
78
|
+
artifact.scan(/Libraries\/(.*)-([\d\.]*)\.(.*)/) do |name, version, extension|
|
78
79
|
includes = reference.attribute('Include').value
|
79
80
|
includes.gsub!(/Version=(.*?)(,|$)/, "Version=#{version}\\2")
|
80
81
|
reference.add_attribute('Include', includes)
|
82
|
+
|
83
|
+
artifact = "Libraries\\#{name}.#{extension}"
|
81
84
|
end
|
82
85
|
reference.elements['SpecificVersion'] = REXML::Element.new('SpecificVersion').add_text('false')
|
83
86
|
reference.elements['HintPath'] = REXML::Element.new('HintPath').
|
84
|
-
add_text([relative, "#{artifact
|
87
|
+
add_text([relative, "#{artifact}"].flatten.patheticalize)
|
85
88
|
end
|
86
89
|
|
87
90
|
FileSystem.write! :path => @project.path, :name => @project.csproj, :content => doc.to_s
|
88
91
|
end
|
89
92
|
|
93
|
+
def self.rename_artifacts
|
94
|
+
Dir["Libraries/*.{dll,exe}"].each do |file|
|
95
|
+
file.scan(/Libraries\/(.*)-([\d\.]*)\.(.*)/) do |name, version, extension|
|
96
|
+
FileUtils.mv(file, "Libraries\\#{name}.#{extension}")
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
90
101
|
def relative
|
91
102
|
['..'] * @project.path.split(/\/|\\/).size
|
92
103
|
end
|
@@ -94,7 +105,10 @@ module IronHammer
|
|
94
105
|
private
|
95
106
|
def artifact_for reference
|
96
107
|
dependency = Dependency.from_reference reference
|
97
|
-
|
108
|
+
pattern = "Libraries/#{dependency.name}-*.{dll,exe}"
|
109
|
+
files = Dir[pattern]
|
110
|
+
raise "No file found with name like: #{pattern}" if files.empty?
|
111
|
+
files.last
|
98
112
|
end
|
99
113
|
end
|
100
114
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iron_hammer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mozair Alves do Carmo Junior
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2010-02-
|
13
|
+
date: 2010-02-22 00:00:00 -03:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|