iron_hammer 1.0.5 → 1.0.6
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/tasks/ivy.rb +5 -5
- data/lib/iron_hammer/tasks/version.rb +26 -19
- data/lib/iron_hammer/utils/ivy_builder.rb +19 -13
- data/lib/iron_hammer/utils/ivy_configuration.rb +32 -0
- data/lib/iron_hammer.rb +1 -0
- metadata +2 -1
data/Rakefile
CHANGED
@@ -34,7 +34,7 @@ namespace :iron do
|
|
34
34
|
|
35
35
|
puts "Dependency #{dependency.name}"
|
36
36
|
|
37
|
-
builder =
|
37
|
+
builder = IvyConfiguration.builder_for dependency_project
|
38
38
|
|
39
39
|
builder.write_to "ivy-#{dependency.name}.xml"
|
40
40
|
|
@@ -48,21 +48,21 @@ namespace :iron do
|
|
48
48
|
task :generate do
|
49
49
|
puts "Generating ivy files for projects"
|
50
50
|
@anvil.projects.each do |project|
|
51
|
-
builder =
|
51
|
+
builder = IvyConfiguration.builder_for project
|
52
52
|
builder.write_to "ivy-#{project.name}.xml"
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
56
|
desc 'Retrieves all project dependencies from ivy repository and modify project csproj to reference them'
|
57
57
|
task :retrieve do
|
58
|
-
builder =
|
58
|
+
builder = IvyConfiguration.builder_for(SolutionProject.new(@anvil.solution.name, all_dependencies))
|
59
59
|
xml = "ivy-#{@anvil.solution.name}.xml"
|
60
60
|
builder.write_to xml
|
61
61
|
|
62
62
|
sh builder.retrieve xml
|
63
63
|
|
64
64
|
@anvil.projects.each do |project|
|
65
|
-
builder =
|
65
|
+
builder = IvyConfiguration.builder_for project
|
66
66
|
|
67
67
|
builder.modify_csproj
|
68
68
|
end
|
@@ -72,7 +72,7 @@ namespace :iron do
|
|
72
72
|
task :publish => [:generate] do
|
73
73
|
@anvil.dll_projects.topological_sort.each do |project|
|
74
74
|
xml = "ivy-#{project.name}.xml"
|
75
|
-
builder =
|
75
|
+
builder = IvyConfiguration.builder_for project
|
76
76
|
|
77
77
|
FileSystem.write! :name => xml, :path => '.',
|
78
78
|
:content => builder.generate_xml(project.dependencies_with_projects @anvil.projects)
|
@@ -25,7 +25,7 @@ class ProjectVersion
|
|
25
25
|
|
26
26
|
def self.greatest_from projects
|
27
27
|
greatest = parse '1.0.0.0'
|
28
|
-
|
28
|
+
projects.each do |project|
|
29
29
|
current = parse project.version
|
30
30
|
greatest = current if current > greatest
|
31
31
|
end
|
@@ -42,10 +42,10 @@ namespace :iron do
|
|
42
42
|
desc 'back to 1.0.0.*'
|
43
43
|
task :reset do
|
44
44
|
@anvil.projects.each do |project|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
45
|
+
new_version = ProjectVersion.parse project.version
|
46
|
+
new_version.major = 1
|
47
|
+
new_version.minor = 0
|
48
|
+
new_version.revision = 0
|
49
49
|
project.version = v.to_s
|
50
50
|
end
|
51
51
|
end
|
@@ -65,8 +65,8 @@ namespace :iron do
|
|
65
65
|
desc 'updates version of AssemblyInfo based on BUILD_NUMBER environment variable'
|
66
66
|
task :update_build do
|
67
67
|
@anvil.projects.each do |project|
|
68
|
-
|
69
|
-
project.version =
|
68
|
+
new_version = project.version
|
69
|
+
project.version = new_version.gsub /\.\d+$/, ".#{build_number}"
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
@@ -77,34 +77,41 @@ namespace :iron do
|
|
77
77
|
namespace :bump do
|
78
78
|
desc 'bumps the major version'
|
79
79
|
task :major do
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
80
|
+
new_version = ProjectVersion.greatest_from @anvil.projects
|
81
|
+
new_version.major += 1
|
82
|
+
new_version.minor = 0
|
83
|
+
new_version.revision = 0
|
84
84
|
|
85
85
|
@anvil.projects.each do |project|
|
86
|
-
project
|
86
|
+
change_version project, new_version
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
90
|
+
def change_version project, version
|
91
|
+
from = project.version
|
92
|
+
to = version.to_s
|
93
|
+
puts "Changing version of #{project.name} from #{from} to #{to}"
|
94
|
+
project.version = version.to_s
|
95
|
+
end
|
96
|
+
|
90
97
|
desc 'bumps the minor version'
|
91
98
|
task :minor do
|
92
|
-
|
93
|
-
|
94
|
-
|
99
|
+
new_version = ProjectVersion.greatest_from @anvil.projects
|
100
|
+
new_version.minor += 1
|
101
|
+
new_version.revision = 0
|
95
102
|
|
96
103
|
@anvil.projects.each do |project|
|
97
|
-
project
|
104
|
+
change_version project, new_version
|
98
105
|
end
|
99
106
|
end
|
100
107
|
|
101
108
|
desc 'bumps the revision version'
|
102
109
|
task :revision do
|
103
|
-
|
104
|
-
|
110
|
+
new_version = ProjectVersion.greatest_from @anvil.projects
|
111
|
+
new_version.revision += 1
|
105
112
|
|
106
113
|
@anvil.projects.each do |project|
|
107
|
-
project
|
114
|
+
change_version project, new_version
|
108
115
|
end
|
109
116
|
end
|
110
117
|
end
|
@@ -4,12 +4,18 @@ require 'rexml/document'
|
|
4
4
|
module IronHammer
|
5
5
|
module Utils
|
6
6
|
class IvyBuilder
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
7
|
+
VERSION_PATTERN = /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/
|
8
|
+
VERSION_REPLACE = {
|
9
|
+
'latest' => '+',
|
10
|
+
'latest.major' => '+',
|
11
|
+
'latest.minor' => '\\1.+',
|
12
|
+
'latest.revision' => '\\1.\\2.+',
|
13
|
+
'latest.build' => '\\1.\\2.\\3.+',
|
14
|
+
'specific' => '\\1.\\2.\\3.\\4'
|
15
|
+
}
|
16
|
+
def initialize params={}
|
17
|
+
@project = params[:project] || raise('You must specify a project')
|
18
|
+
@config = params[:config] || raise('You must specify a config')
|
13
19
|
end
|
14
20
|
|
15
21
|
def to_s
|
@@ -20,7 +26,7 @@ module IronHammer
|
|
20
26
|
xml = Builder::XmlMarkup.new(:indent => 2)
|
21
27
|
xml.tag! 'ivy-module', :version => '2.0' do
|
22
28
|
name = @project.assembly_name
|
23
|
-
xml.info :organisation => @organisation, :module => name
|
29
|
+
xml.info :organisation => @config.organisation, :module => name
|
24
30
|
xml.publications do
|
25
31
|
@project.artifacts.each do |artifact|
|
26
32
|
names = artifact.split '.'
|
@@ -32,8 +38,8 @@ module IronHammer
|
|
32
38
|
|
33
39
|
xml.dependencies do
|
34
40
|
dependencies.each do |dependency|
|
35
|
-
rev = dependency.version.gsub
|
36
|
-
xml.dependency :org => @organisation, :name => dependency.name, :rev => rev do
|
41
|
+
rev = dependency.version.gsub VERSION_PATTERN, VERSION_REPLACE[@config.retrieve_version]
|
42
|
+
xml.dependency :org => @config.organisation, :name => dependency.name, :rev => rev do
|
37
43
|
xml.artifact :type => dependency.extension, :name => dependency.name
|
38
44
|
end
|
39
45
|
end
|
@@ -42,16 +48,16 @@ module IronHammer
|
|
42
48
|
end
|
43
49
|
|
44
50
|
def retrieve ivy_file
|
45
|
-
"java -jar #{@ivy_jar}
|
51
|
+
"java -jar #{@config.ivy_jar}
|
46
52
|
-ivy #{ivy_file}
|
47
|
-
-settings #{@ivy_settings}
|
53
|
+
-settings #{@config.ivy_settings}
|
48
54
|
-retrieve Libraries/[artifact]-[revision].[ext]".gsub(/\s+/, ' ')
|
49
55
|
end
|
50
56
|
|
51
57
|
def publish ivy_file
|
52
|
-
"java -jar #{@ivy_jar}
|
58
|
+
"java -jar #{@config.ivy_jar}
|
53
59
|
-ivy #{ivy_file}
|
54
|
-
-settings #{@ivy_settings}
|
60
|
+
-settings #{@config.ivy_settings}
|
55
61
|
-publish default
|
56
62
|
-publishpattern #{@project.path_to_binaries}/[artifact].[ext]
|
57
63
|
-revision #{@project.version}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
|
2
|
+
module IronHammer
|
3
|
+
module Utils
|
4
|
+
class IvyConfiguration
|
5
|
+
attr_accessor :organisation
|
6
|
+
attr_accessor :ivy_jar
|
7
|
+
attr_accessor :ivy_settings
|
8
|
+
attr_accessor :retrieve_version
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
def self.builder_for project
|
13
|
+
IvyBuilder.new :config => instance, :project => project
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
def self.instance
|
18
|
+
@@instance ||= IvyConfiguration.new
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
def initialize
|
23
|
+
@organisation = defined?(ORGANISATION)? ORGANISATION : 'org'
|
24
|
+
@ivy_jar = defined?(IVY_JAR)? IVY_JAR : 'ivy.jar'
|
25
|
+
@ivy_settings = defined?(IVY_SETTINGS)? IVY_SETTINGS : 'ivysettings.xml'
|
26
|
+
@retrieve_version = ENV['retrieve_version'] || 'latest.build'
|
27
|
+
end
|
28
|
+
|
29
|
+
end unless defined? IvyConfiguration
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
data/lib/iron_hammer.rb
CHANGED
@@ -40,6 +40,7 @@ require 'iron_hammer/utils/code_analyzers_environment'
|
|
40
40
|
require 'iron_hammer/utils/dot_net_environment'
|
41
41
|
require 'iron_hammer/utils/file_system'
|
42
42
|
require 'iron_hammer/utils/ivy_builder'
|
43
|
+
require 'iron_hammer/utils/ivy_configuration'
|
43
44
|
require 'iron_hammer/utils/windows'
|
44
45
|
require 'iron_hammer/utils/zipper'
|
45
46
|
require 'iron_hammer/version'
|
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.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mozair Alves do Carmo Junior
|
@@ -111,6 +111,7 @@ files:
|
|
111
111
|
- lib/iron_hammer/utils/dot_net_environment.rb
|
112
112
|
- lib/iron_hammer/utils/file_system.rb
|
113
113
|
- lib/iron_hammer/utils/ivy_builder.rb
|
114
|
+
- lib/iron_hammer/utils/ivy_configuration.rb
|
114
115
|
- lib/iron_hammer/utils/topological_sort.rb
|
115
116
|
- lib/iron_hammer/utils/windows.rb
|
116
117
|
- lib/iron_hammer/utils/zipper.rb
|