iron_hammer 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -10,8 +10,9 @@ $hoe = Hoe.spec 'iron_hammer' do
10
10
  self.developer 'Mozair Alves do Carmo Junior', 'macskeptic@gmail.com'
11
11
  self.post_install_message = File.read('PostInstall.txt')
12
12
  self.rubyforge_name = self.name
13
- self.extra_deps = [['rubyzip2','>= 2.0.1']]
14
- self.version = '0.3.4'
13
+ self.extra_deps = [['rubyzip2','>= 2.0.1'],
14
+ ['builder', '>= 2.1.2']]
15
+ self.version = '0.3.5'
15
16
  end
16
17
 
17
18
  require 'newgem/tasks'
data/lib/iron_hammer.rb CHANGED
@@ -32,6 +32,7 @@ require 'iron_hammer/solutions/solution'
32
32
  require 'iron_hammer/solutions/solution_file'
33
33
  require 'iron_hammer/utils/dot_net_environment'
34
34
  require 'iron_hammer/utils/file_system'
35
+ require 'iron_hammer/utils/ivy_builder'
35
36
  require 'iron_hammer/utils/windows'
36
37
  require 'iron_hammer/utils/zipper'
37
38
  require 'iron_hammer/version'
@@ -0,0 +1,21 @@
1
+ module IronHammer
2
+ module Projects
3
+ class Dependency
4
+ attr_accessor :name
5
+ attr_accessor :version
6
+
7
+ def initialize params = {}
8
+ @name = params[:name] || raise(ArgumentError.new('you must specify a name'))
9
+ @version = params[:version]
10
+ end
11
+
12
+ def == other
13
+ @name == other.name && @version == other.version
14
+ end
15
+
16
+ def to_s
17
+ "[Dependency name=#{@name} version=#{@version}]"
18
+ end
19
+ end
20
+ end
21
+ end
@@ -5,11 +5,13 @@ module IronHammer
5
5
  class GenericProject
6
6
  attr_accessor :name
7
7
  attr_accessor :path
8
+ attr_accessor :csproj
8
9
 
9
10
  def initialize params={}
10
11
  @name = params[:name] ||
11
12
  raise(ArgumentError.new 'must provide a project name')
12
13
  @path = params[:path] || @name
14
+ @csproj = params[:csproj] || "#{@name}.csproj"
13
15
  end
14
16
 
15
17
  def path_to_binaries params={}
@@ -20,6 +22,10 @@ module IronHammer
20
22
  []
21
23
  end
22
24
 
25
+ def dependencies
26
+ @dependencies ||= ProjectFile.dependencies_of(File.read [@path, @csproj].patheticalize)
27
+ end
28
+
23
29
  def package params={}
24
30
  package_root(params)
25
31
  Package.new :root => package_root, :deliverables => deliverables(params)
@@ -23,5 +23,29 @@ namespace :iron do
23
23
  sh @hammer.test *@anvil.test_projects
24
24
  end
25
25
  end
26
+
27
+ namespace :ivy do
28
+ desc 'Generates ivy-<project_name>.xml for all dll projects of the solution'
29
+ task :generate => [:initialize] do
30
+ @anvil.dll_projects.each do |project|
31
+ builder = IvyBuilder.new project
32
+ builder.write_to "ivy-#{project.name}.xml"
33
+ end
34
+ end
35
+
36
+ task :retrieve => [:generate] do
37
+ @anvil.dll_projects.each do |project|
38
+ ivy = "ivy-#{project.name}.xml"
39
+ sh "java -jar #{IVY_JAR} -ivy #{ivy} -settings #{IVY_SETTINGS} -retrieve Libraries/[artifact].[ext]"
40
+ end
41
+ end
42
+
43
+ task :publish => [:generate] do
44
+ @anvil.dll_projects.each do |project|
45
+ ivy = "ivy-#{project.name}.xml"
46
+ sh "java -jar #{IVY_JAR} -ivy #{ivy} -settings #{IVY_SETTINGS} -publish default -publishpattern delivery/[artifact].[ext] -revision 1.0.0 -overwrite true"
47
+ end
48
+ end
49
+ end
26
50
  end
27
51
 
@@ -0,0 +1,32 @@
1
+ require 'builder'
2
+ module IronHammer
3
+ module Utils
4
+ class IvyBuilder
5
+
6
+ def initialize project
7
+ @project = project
8
+ @organisation = ORGANISATION || "org"
9
+ end
10
+
11
+ def to_s
12
+ xml = Builder::XmlMarkup.new(:indent => 2)
13
+ xml.tag! 'ivy-module', :version => '2.0' do
14
+ xml.info :organisation => @organisation, :module => @project.name
15
+ xml.publications do
16
+ xml.artifact :name => @project.name, :type => 'dll'
17
+ end if @project.is_a? DllProject
18
+
19
+ xml.dependencies do
20
+ @project.dependencies.each do |dependency|
21
+ xml.dependency :org => @organisation, :name => dependency.name, :rev => dependency.version
22
+ end
23
+ end unless @project.dependencies.empty?
24
+ end
25
+ end
26
+
27
+ def write_to file
28
+ File.open(file, "w") { |f| f.write to_s }
29
+ end
30
+ end
31
+ end
32
+ 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
4
+ version: 0.3.5
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-01-27 00:00:00 -02:00
12
+ date: 2010-01-28 00:00:00 -02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -22,6 +22,16 @@ dependencies:
22
22
  - !ruby/object:Gem::Version
23
23
  version: 2.0.1
24
24
  version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: builder
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 2.1.2
34
+ version:
25
35
  - !ruby/object:Gem::Dependency
26
36
  name: rubyforge
27
37
  type: :development
@@ -77,6 +87,7 @@ files:
77
87
  - lib/iron_hammer/projects/asp_net_mvc_project.rb
78
88
  - lib/iron_hammer/projects/asp_net_project.rb
79
89
  - lib/iron_hammer/projects/dll_project.rb
90
+ - lib/iron_hammer/projects/dependency.rb
80
91
  - lib/iron_hammer/projects/generic_project.rb
81
92
  - lib/iron_hammer/projects/project_file.rb
82
93
  - lib/iron_hammer/projects/project_types.rb
@@ -86,6 +97,7 @@ files:
86
97
  - lib/iron_hammer/tasks.rb
87
98
  - lib/iron_hammer/utils/dot_net_environment.rb
88
99
  - lib/iron_hammer/utils/file_system.rb
100
+ - lib/iron_hammer/utils/ivy_builder.rb
89
101
  - lib/iron_hammer/utils/windows.rb
90
102
  - lib/iron_hammer/utils/zipper.rb
91
103
  - lib/iron_hammer/version.rb