iron_hammer 0.3.8 → 0.3.9
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.rb +2 -0
- data/lib/iron_hammer/projects/dependency_project.rb +31 -0
- data/lib/iron_hammer/projects/generic_project.rb +18 -9
- data/lib/iron_hammer/projects/project_file.rb +13 -8
- data/lib/iron_hammer/projects/test_project.rb +7 -4
- data/lib/iron_hammer/tasks.rb +26 -4
- data/lib/iron_hammer/utils/ivy_builder.rb +11 -9
- metadata +3 -2
data/Rakefile
CHANGED
data/lib/iron_hammer.rb
CHANGED
@@ -23,6 +23,7 @@ require 'iron_hammer/package'
|
|
23
23
|
require 'iron_hammer/projects/asp_net_mvc_project'
|
24
24
|
require 'iron_hammer/projects/asp_net_project'
|
25
25
|
require 'iron_hammer/projects/dependency'
|
26
|
+
require 'iron_hammer/projects/dependency_project'
|
26
27
|
require 'iron_hammer/projects/dll_project'
|
27
28
|
require 'iron_hammer/projects/generic_project'
|
28
29
|
require 'iron_hammer/projects/project_file'
|
@@ -42,3 +43,4 @@ include IronHammer::Projects
|
|
42
43
|
include IronHammer::Solutions
|
43
44
|
include IronHammer::Utils
|
44
45
|
include IronHammer::Deliverables
|
46
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'iron_hammer/projects/dll_project'
|
2
|
+
|
3
|
+
module IronHammer
|
4
|
+
module Projects
|
5
|
+
class DependencyProject < DllProject
|
6
|
+
|
7
|
+
def initialize params
|
8
|
+
super(params)
|
9
|
+
@binaries_path = params[:binaries_path]
|
10
|
+
@version = params[:version] || '1.0.0.0'
|
11
|
+
end
|
12
|
+
|
13
|
+
def dependencies
|
14
|
+
[]
|
15
|
+
end
|
16
|
+
|
17
|
+
def assembly_name
|
18
|
+
name
|
19
|
+
end
|
20
|
+
|
21
|
+
def version
|
22
|
+
@version
|
23
|
+
end
|
24
|
+
|
25
|
+
def path_to_binaries
|
26
|
+
@binaries_path
|
27
|
+
end
|
28
|
+
end unless defined? DependencyProject
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
@@ -6,48 +6,57 @@ module IronHammer
|
|
6
6
|
attr_accessor :name
|
7
7
|
attr_accessor :path
|
8
8
|
attr_accessor :csproj
|
9
|
-
|
9
|
+
|
10
10
|
def initialize params={}
|
11
|
-
@name = params[:name] ||
|
11
|
+
@name = params[:name] ||
|
12
12
|
raise(ArgumentError.new 'must provide a project name')
|
13
13
|
@path = params[:path] || @name
|
14
14
|
@csproj = params[:csproj] || "#{@name}.csproj"
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
def path_to_binaries params={}
|
18
18
|
''
|
19
19
|
end
|
20
20
|
|
21
|
+
def version
|
22
|
+
'1.0.0.0'
|
23
|
+
end
|
24
|
+
|
21
25
|
def deliverables params={}
|
22
26
|
[]
|
23
27
|
end
|
24
|
-
|
28
|
+
|
29
|
+
def assembly_name
|
30
|
+
@assembly_name ||= file.assembly_name
|
31
|
+
end
|
32
|
+
|
25
33
|
def dependencies
|
26
34
|
@dependencies ||= file.dependencies
|
27
35
|
end
|
28
|
-
|
36
|
+
|
29
37
|
def package params={}
|
30
38
|
package_root(params)
|
31
39
|
Package.new :root => package_root, :deliverables => deliverables(params)
|
32
40
|
end
|
33
|
-
|
41
|
+
|
34
42
|
protected
|
35
43
|
def package_root params={}
|
36
44
|
root = params[:root] || params[:target] || params[:package_root] || IronHammer::Defaults::DELIVERY_DIRECTORY
|
37
45
|
end
|
38
|
-
|
46
|
+
|
39
47
|
def run_configuration params={}
|
40
48
|
configuration = params[:configuration]
|
41
49
|
config = (configuration && !configuration.empty? && configuration) || IronHammer::Defaults::CONFIGURATION_RUN
|
42
50
|
end
|
43
|
-
|
51
|
+
|
44
52
|
def file
|
45
53
|
@file ||= ProjectFile.load_from path_to_csproj
|
46
54
|
end
|
47
|
-
|
55
|
+
|
48
56
|
def path_to_csproj
|
49
57
|
return File.join @path, @csproj
|
50
58
|
end
|
51
59
|
end unless defined? GenericProject
|
52
60
|
end
|
53
61
|
end
|
62
|
+
|
@@ -11,44 +11,49 @@ module IronHammer
|
|
11
11
|
module Projects
|
12
12
|
class ProjectFile
|
13
13
|
attr_accessor :path
|
14
|
-
|
14
|
+
|
15
15
|
GUID_EVALUATION_ORDER = [AspNetMvcProject, AspNetProject, TestProject]
|
16
16
|
GUID_PATH = '//Project/PropertyGroup/ProjectTypeGuids'
|
17
|
+
ASSEMBLY_NAME_PATH = '//Project/PropertyGroup/AssemblyName'
|
17
18
|
REFERENCE_PATH = '//Reference[not(starts_with(@Include, "System"))]'
|
18
|
-
|
19
|
+
|
19
20
|
def self.load_from *path
|
20
21
|
ProjectFile.new path
|
21
22
|
end
|
22
|
-
|
23
|
+
|
23
24
|
def type
|
24
25
|
@type ||= ((GUID_EVALUATION_ORDER.inject(false) do |result, current|
|
25
26
|
result || (guids.include?(ProjectTypes::guid_for(current)) && current)
|
26
27
|
end) || DllProject)
|
27
28
|
end
|
28
29
|
|
30
|
+
def assembly_name
|
31
|
+
@assembly_name ||= doc.elements[ASSEMBLY_NAME_PATH].text
|
32
|
+
end
|
33
|
+
|
29
34
|
def dependencies
|
30
35
|
references.collect { |reference| Dependency.from_reference reference }
|
31
36
|
end
|
32
|
-
|
37
|
+
|
33
38
|
private
|
34
39
|
def references
|
35
40
|
doc && doc.get_elements(REFERENCE_PATH)
|
36
41
|
end
|
37
|
-
|
42
|
+
|
38
43
|
def doc
|
39
44
|
@doc ||= REXML::Document.new xml
|
40
45
|
end
|
41
|
-
|
46
|
+
|
42
47
|
def xml
|
43
48
|
@xml ||= IronHammer::Utils::FileSystem::read_file(*@path)
|
44
49
|
end
|
45
|
-
|
50
|
+
|
46
51
|
def guids
|
47
52
|
return @guids if @guids
|
48
53
|
return @guids = [] unless (elem = doc && doc.elements[GUID_PATH]) && elem.text
|
49
54
|
@guids = elem.text.split(';').collect { |e| e.upcase }
|
50
55
|
end
|
51
|
-
|
56
|
+
|
52
57
|
def initialize *path
|
53
58
|
@path = path
|
54
59
|
end
|
@@ -8,21 +8,24 @@ module IronHammer
|
|
8
8
|
attr_accessor :dll
|
9
9
|
attr_accessor :name
|
10
10
|
attr_accessor :path
|
11
|
-
|
12
|
-
def initialize params
|
13
|
-
|
11
|
+
|
12
|
+
def initialize params = {}
|
13
|
+
params[:name] ||= "#{ params[:project] || params[:solution] }.Tests"
|
14
|
+
@name = params[:name]
|
14
15
|
@dll = "#{ params[:dll] || @name}.dll"
|
15
16
|
@config = params[:config] || IronHammer::Defaults::TEST_CONFIG
|
16
17
|
@path = params[:path]
|
18
|
+
super(params)
|
17
19
|
end
|
18
20
|
|
19
21
|
def container configuration
|
20
22
|
[@name, 'bin', configuration, @dll].patheticalize
|
21
23
|
end
|
22
|
-
|
24
|
+
|
23
25
|
def results_file
|
24
26
|
['TestResults', 'TestResults.trx'].patheticalize
|
25
27
|
end
|
26
28
|
end unless defined? TestProject
|
27
29
|
end
|
28
30
|
end
|
31
|
+
|
data/lib/iron_hammer/tasks.rb
CHANGED
@@ -3,6 +3,7 @@ require 'rake/clean'
|
|
3
3
|
require 'iron_hammer'
|
4
4
|
|
5
5
|
CLEAN.include("TestResults/**")
|
6
|
+
CLEAN.include("ivy*.xml")
|
6
7
|
|
7
8
|
namespace :iron do
|
8
9
|
task :initialize do
|
@@ -24,9 +25,30 @@ namespace :iron do
|
|
24
25
|
end
|
25
26
|
|
26
27
|
namespace :ivy do
|
27
|
-
desc '
|
28
|
+
desc 'Publish project dependencies into ivy repository'
|
29
|
+
task :setup do
|
30
|
+
@anvil = Anvil.load_from '.'
|
31
|
+
@anvil.projects.each do |project|
|
32
|
+
project.dependencies.each do |dependency|
|
33
|
+
dependency_project = DependencyProject.new(
|
34
|
+
:name => dependency.name,
|
35
|
+
:binaries_path => ENV['binaries_path'],
|
36
|
+
:version => dependency.version)
|
37
|
+
|
38
|
+
puts "Dependency #{dependency.name}"
|
39
|
+
|
40
|
+
builder = IvyBuilder.new dependency_project
|
41
|
+
|
42
|
+
builder.write_to "ivy-#{dependency.name}.xml"
|
43
|
+
|
44
|
+
sh builder.publish "ivy-#{dependency.name}.xml"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
desc 'Generates ivy-<project_name>.xml for all projects of the solution'
|
28
50
|
task :generate => [:initialize] do
|
29
|
-
@anvil.
|
51
|
+
@anvil.projects.each do |project|
|
30
52
|
builder = IvyBuilder.new project
|
31
53
|
builder.write_to "ivy-#{project.name}.xml"
|
32
54
|
end
|
@@ -34,7 +56,7 @@ namespace :iron do
|
|
34
56
|
|
35
57
|
desc 'Retrieves all project dependencies from ivy repository and modify project csproj to reference them'
|
36
58
|
task :retrieve => [:generate] do
|
37
|
-
@anvil.
|
59
|
+
@anvil.projects.each do |project|
|
38
60
|
xml = "ivy-#{project.name}.xml"
|
39
61
|
builder = IvyBuilder.new project
|
40
62
|
|
@@ -44,7 +66,7 @@ namespace :iron do
|
|
44
66
|
end
|
45
67
|
end
|
46
68
|
|
47
|
-
desc 'Publish project assemblies to ivy repository'
|
69
|
+
desc 'Publish project assemblies to ivy repository (only dll projects)'
|
48
70
|
task :publish => [:generate] do
|
49
71
|
@anvil.dll_projects.each do |project|
|
50
72
|
xml = "ivy-#{project.name}.xml"
|
@@ -15,13 +15,11 @@ module IronHammer
|
|
15
15
|
def to_s
|
16
16
|
xml = Builder::XmlMarkup.new(:indent => 2)
|
17
17
|
xml.tag! 'ivy-module', :version => '2.0' do
|
18
|
-
|
18
|
+
name = @project.assembly_name
|
19
|
+
xml.info :organisation => @organisation, :module => name
|
19
20
|
xml.publications do
|
20
|
-
|
21
|
-
|
22
|
-
name = binary.actual_name.gsub(/\.[^\.]+$/, '')
|
23
|
-
xml.artifact :name => name, :type => extension
|
24
|
-
end
|
21
|
+
extension = 'dll'
|
22
|
+
xml.artifact :name => name, :type => extension
|
25
23
|
end if @project.is_a? DllProject
|
26
24
|
|
27
25
|
xml.dependencies do
|
@@ -45,7 +43,7 @@ module IronHammer
|
|
45
43
|
-settings #{@ivy_settings}
|
46
44
|
-publish default
|
47
45
|
-publishpattern #{@project.path_to_binaries}/[artifact].[ext]
|
48
|
-
-revision
|
46
|
+
-revision #{@project.version}
|
49
47
|
-overwrite true".gsub(/\s+/, ' ')
|
50
48
|
end
|
51
49
|
|
@@ -60,16 +58,20 @@ module IronHammer
|
|
60
58
|
references.each do |reference|
|
61
59
|
reference.elements['SpecificVersion'] = REXML::Element.new('SpecificVersion').add_text('false')
|
62
60
|
reference.elements['HintPath'] = REXML::Element.new('HintPath').
|
63
|
-
add_text("
|
61
|
+
add_text([relative, 'Libraries', "#{artifact_for reference}"].flatten.patheticalize)
|
64
62
|
end
|
65
63
|
|
66
64
|
FileSystem.write! :path => @project.path, :name => @project.csproj, :content => doc.to_s
|
67
65
|
end
|
68
66
|
|
67
|
+
def relative
|
68
|
+
['..'] * @project.path.split(/\/|\\/).size
|
69
|
+
end
|
70
|
+
|
69
71
|
private
|
70
72
|
def artifact_for reference
|
71
73
|
dependency = Dependency.from_reference reference
|
72
|
-
libraries_dir = Dir.new(
|
74
|
+
libraries_dir = Dir.new('Libraries')
|
73
75
|
libraries_dir.find {|f| f.match "#{dependency.name}\\.(dll|exe)"}
|
74
76
|
end
|
75
77
|
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: 0.3.
|
4
|
+
version: 0.3.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mozair Alves do Carmo Junior
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-02-
|
12
|
+
date: 2010-02-02 00:00:00 -02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -88,6 +88,7 @@ files:
|
|
88
88
|
- lib/iron_hammer/projects/asp_net_project.rb
|
89
89
|
- lib/iron_hammer/projects/dll_project.rb
|
90
90
|
- lib/iron_hammer/projects/dependency.rb
|
91
|
+
- lib/iron_hammer/projects/dependency_project.rb
|
91
92
|
- lib/iron_hammer/projects/generic_project.rb
|
92
93
|
- lib/iron_hammer/projects/project_file.rb
|
93
94
|
- lib/iron_hammer/projects/project_types.rb
|