iron_hammer 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Rakefile CHANGED
@@ -14,7 +14,7 @@ $hoe = Hoe.spec 'iron_hammer' do
14
14
  self.rubyforge_name = self.name
15
15
  self.extra_deps = [['rubyzip2','>= 2.0.1'],
16
16
  ['builder', '>= 2.1.2']]
17
- self.version = '1.0.1'
17
+ self.version = '1.0.2'
18
18
  end
19
19
 
20
20
  require 'newgem/tasks'
@@ -20,29 +20,38 @@ module IronHammer
20
20
  ) unless entries.nil? || entries.empty?
21
21
  end
22
22
 
23
- def projects
23
+ def projects
24
24
  @projects ||= (@solution.file.projects.collect do |p|
25
25
  ProjectFile.load_from(root_path = @solution.path, project_path = p[:path], csproj = p[:csproj]).type.new(p)
26
26
  end)
27
27
  end
28
-
28
+
29
29
  def dll_projects
30
30
  @dll_projects ||= projects.select {|p| p.is_a? DllProject}
31
31
  end
32
-
32
+
33
33
  def test_projects
34
34
  @test_projects ||= projects.select {|p| p.is_a? TestProject}
35
35
  end
36
-
36
+
37
+ def integration_test_projects
38
+ test_projects.select {|p| p.name.include? 'Integration'}
39
+ end
40
+
41
+ def unit_test_projects
42
+ test_projects - integration_test_projects
43
+ end
44
+
37
45
  def load_projects_from_solution #deprecated!
38
46
  Kernel::warn '[DEPRECATION] `load_projects_from_solution` is deprecated and now it is a no-op. ' +
39
47
  'Please, just use `projects` instead - they will be loaded in a lazy fashion ;)'
40
48
  end
41
49
 
42
- private
50
+ private
43
51
  def initialize params={}
44
52
  @solution = params[:solution]
45
53
  @projects = params[:projects]
46
54
  end
47
55
  end unless defined? Anvil
48
56
  end
57
+
@@ -3,16 +3,21 @@ require 'iron_hammer/deliverables/deliverable'
3
3
  module IronHammer
4
4
  module DefaultBinariesBehavior
5
5
  BIN_PATTERN = '*.{dll,exe}'
6
-
6
+
7
7
  def binaries params={}
8
8
  path = path_to_binaries(params)
9
9
  Dir[File.join(path, BIN_PATTERN)].collect do |file|
10
10
  IronHammer::Deliverables::Deliverable.new(
11
- :path_on_package => '',
12
- :actual_path => path,
11
+ :path_on_package => '',
12
+ :actual_path => path,
13
13
  :actual_name => file.split('/').last
14
14
  )
15
15
  end
16
16
  end
17
+
18
+ def binary_types
19
+ ['dll', 'exe']
20
+ end
17
21
  end unless defined? DefaultBinariesBehavior
18
22
  end
23
+
@@ -22,8 +22,9 @@ module IronHammer
22
22
  def self.from_reference reference
23
23
  includes = reference.attribute(:Include).value
24
24
  name = includes.split(', ')[0]
25
- match = includes.match /Version=(.+?),/
25
+ match = includes.match /Version=(.+?)(,|$)/
26
26
  version = match[1] if match
27
+ raise "Cannot parse version on include: #{includes}" unless version
27
28
  extension = get_extension reference
28
29
  Dependency.new :name => name, :version => version, :extension => extension
29
30
  end
@@ -8,6 +8,7 @@ module IronHammer
8
8
  super(params)
9
9
  @binaries_path = params[:binaries_path]
10
10
  @version = params[:version] || '1.0.0.0'
11
+ @extension = params[:extension] || 'dll'
11
12
  end
12
13
 
13
14
  def dependencies
@@ -18,6 +19,10 @@ module IronHammer
18
19
  name
19
20
  end
20
21
 
22
+ def binary_types
23
+ [@extension]
24
+ end
25
+
21
26
  def version
22
27
  @version
23
28
  end
@@ -24,16 +24,24 @@ namespace :iron do
24
24
  end
25
25
 
26
26
  namespace :test do
27
+
27
28
  desc 'Runs the unit tests'
28
29
  task :unit => [:build] do
29
- command = @hammer.test *@anvil.test_projects
30
- puts "There are no tests to run" unless command
30
+ command = @hammer.test *@anvil.unit_test_projects
31
+ puts "There are no unit tests to run" unless command
32
+ sh command if command
33
+ end
34
+
35
+ desc 'Runs the integration tests'
36
+ task :integration => [:build] do
37
+ command = @hammer.test *@anvil.integration_test_projects
38
+ puts "There are no integration tests to run" unless command
31
39
  sh command if command
32
40
  end
33
41
  end
34
42
 
35
43
  namespace :analyze do
36
- desc 'Analyze the code using fxcop'
44
+ desc 'Analyzes the code using fxcop'
37
45
  task :fxcop do
38
46
  sh @hammer.analyze *@anvil.projects do |ok, response|
39
47
  puts response
@@ -42,28 +50,35 @@ namespace :iron do
42
50
  end
43
51
 
44
52
  namespace :ivy do
45
- desc 'Publish project dependencies into ivy repository'
53
+ desc 'Publishes project dependencies into ivy repository'
46
54
  task :setup, [:binaries_path] do |t, args|
55
+ all_dependencies = []
47
56
  @anvil.projects.each do |project|
48
57
  project.dependencies.each do |dependency|
58
+ all_dependencies << dependency unless all_dependencies.include? dependency
59
+ end
60
+ end
49
61
 
50
- sh "java -jar #{IVY_JAR} -settings #{IVY_SETTINGS} -dependency #{ORGANISATION} #{dependency.name} #{dependency.version}" do |ok, res|
51
- if !ok
52
- dependency_project = DependencyProject.new(
53
- :name => dependency.name,
54
- :binaries_path => args.binaries_path,
55
- :version => dependency.version)
62
+ files = Dir.new(args.binaries_path).entries
63
+ candidates = all_dependencies.select {|x| files.include? "#{x.name}.#{x.extension}"}
56
64
 
57
- puts "Dependency #{dependency.name}"
65
+ candidates.each do |dependency|
66
+ sh "java -jar #{IVY_JAR} -settings #{IVY_SETTINGS} -dependency #{ORGANISATION} #{dependency.name} #{dependency.version}" do |ok, res|
67
+ unless res.exitstatus == 0
68
+ dependency_project = DependencyProject.new(
69
+ :name => dependency.name,
70
+ :binaries_path => args.binaries_path,
71
+ :version => dependency.version,
72
+ :extension => dependency.extension)
58
73
 
59
- builder = IvyBuilder.new dependency_project
74
+ puts "Dependency #{dependency.name}"
60
75
 
61
- builder.write_to "ivy-#{dependency.name}.xml"
76
+ builder = IvyBuilder.new dependency_project
62
77
 
63
- sh builder.publish "ivy-#{dependency.name}.xml"
64
- end
65
- end
78
+ builder.write_to "ivy-#{dependency.name}.xml"
66
79
 
80
+ sh builder.publish "ivy-#{dependency.name}.xml"
81
+ end
67
82
  end
68
83
  end
69
84
  end
@@ -101,7 +116,7 @@ namespace :iron do
101
116
  end
102
117
  end
103
118
 
104
- desc 'Publish project assemblies to ivy repository (only dll projects)'
119
+ desc 'Publishes project assemblies to ivy repository (only dll projects)'
105
120
  task :publish => [:generate] do
106
121
  @anvil.dll_projects.each do |project|
107
122
  xml = "ivy-#{project.name}.xml"
@@ -18,8 +18,9 @@ module IronHammer
18
18
  name = @project.assembly_name
19
19
  xml.info :organisation => @organisation, :module => name
20
20
  xml.publications do
21
- xml.artifact :name => name, :type => 'dll'
22
- xml.artifact :name => name, :type => 'exe'
21
+ @project.binary_types.each do |btype|
22
+ xml.artifact :name => name, :type => btype
23
+ end
23
24
  end if @project.is_a? DllProject
24
25
 
25
26
  xml.dependencies do
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.1
4
+ version: 1.0.2
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-08 00:00:00 -02:00
13
+ date: 2010-02-09 00:00:00 -02:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency