iron_hammer 1.0.8 → 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
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.8'
17
+ self.version = '1.0.9'
18
18
  end
19
19
 
20
20
  require 'newgem/tasks'
data/bin/bump CHANGED
@@ -2,8 +2,13 @@
2
2
 
3
3
  require 'rubygems'
4
4
  require 'rake'
5
+ require 'iron_hammer/configuration'
5
6
 
6
- folder = ENV['IRON_HAMMER_HOME'] || File.join(ENV['USERPROFILE'], '.IronHammer')
7
7
 
8
- sh "rake -f \"#{folder}\\rakefile.rb\" iron:version:bump:#{ARGV.join ' '}"
8
+ sh "rake -f \"#{IronHammer::Configuration.home}\\rakefile.rb\" iron:version:bump:#{ARGV.join ' '}" unless ARGV.empty?
9
+
10
+ if ARGV.empty?
11
+ puts "You must specify a target. Available targets (remove iron:version:bump prefix):"
12
+ sh "rake -f \"#{IronHammer::Configuration.home}\\rakefile.rb\" -T iron:version:bump"
13
+ end
9
14
 
data/bin/iron ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'rake'
5
+ require 'iron_hammer/configuration'
6
+
7
+
8
+ sh "rake -f \"#{IronHammer::Configuration.home}\\rakefile.rb\" iron:#{target}" unless ARGV.empty?
9
+
10
+ if ARGV.empty?
11
+ puts "You must specify a target. Available targets (remove iron: prefix):"
12
+ sh "rake -f \"#{IronHammer::Configuration.home}\\rakefile.rb\" -T iron"
13
+ end
14
+
data/bin/ivy CHANGED
@@ -2,44 +2,13 @@
2
2
 
3
3
  require 'rubygems'
4
4
  require 'rake'
5
+ require 'iron_hammer/configuration'
5
6
 
6
- folder = ENV['IRON_HAMMER_HOME'] || File.join(ENV['USERPROFILE'], '.IronHammer')
7
7
 
8
- unless ENV['IRON_HAMMER_HOME']
9
- puts "IRON_HAMMER_HOME environment variable not found! Generating default config on #{folder}"
10
- puts "You'll need to download apache ivy from http://ant.apache.org/ivy/download.cgi"
11
- puts "and copy ivy-x.x.x.jar to #{folder}\\ivy.jar"
12
- puts "You can also edit #{folder}\\rakefile.rb and change any settings you want"
8
+ sh "rake -f \"#{IronHammer::Configuration.home}\\rakefile.rb\" iron:ivy:#{ARGV.join ' '}" unless ARGV.empty?
13
9
 
14
- FileUtils.mkpath folder
15
- sh "setx IRON_HAMMER_HOME \"#{folder}\""
16
- File.open(File.join(folder, 'rakefile.rb'), 'w') do |f|
17
- f.write <<EOF
18
- require 'rubygems'
19
-
20
- #VISUAL_STUDIO_PATH = ENV['VISUAL_STUDIO_PATH'] || 'C:\\Program Files\\Microsoft Visual Studio 9.0\\Common7\\IDE'
21
- IVY_JAR = "#{ENV['IRON_HAMMER_HOME']}\\ivy.jar"
22
- IVY_SETTINGS = "#{ENV['IRON_HAMMER_HOME']}\\ivysettings.xml"
23
- #ORGANISATION = 'Your company'
24
-
25
- require 'iron_hammer/tasks'
26
- EOF
27
- end
28
- File.open(File.join(folder, 'ivysettings.xml'), 'w') do |f|
29
- f.write <<EOF
30
- <ivysettings>
31
- <settings defaultResolver="default" />
32
- <caches defaultCacheDir="#{folder}/Ivy/Cache"/>
33
- <resolvers>
34
- <filesystem name="default">
35
- <ivy pattern="#{folder}/Ivy/Repository/[organisation]/[module]/ivys/ivy-[revision].xml"/>
36
- <artifact pattern="#{folder}/Ivy/Repository/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
37
- </filesystem>
38
- </resolvers>
39
- </ivysettings>
40
- EOF
41
- end
10
+ if ARGV.empty?
11
+ puts "You must specify a target. Available targets (remove iron:ivy: prefix):"
12
+ sh "rake -f \"#{IronHammer::Configuration.home}\\rakefile.rb\" -T iron:ivy"
42
13
  end
43
14
 
44
- sh "rake -f \"#{folder}\\rakefile.rb\" iron:ivy:#{ARGV.join ' '}"
45
-
@@ -0,0 +1,65 @@
1
+
2
+ module IronHammer
3
+ module Configuration
4
+
5
+ def self.home
6
+ return ENV['IRON_HAMMER_HOME'] if ENV['IRON_HAMMER_HOME']
7
+ @home = File.join(ENV['USERPROFILE'], '.IronHammer')
8
+ print_message
9
+ generate_config
10
+
11
+ @home
12
+ end
13
+
14
+ private
15
+ def self.generate_config
16
+ FileUtils.mkpath @home
17
+
18
+ sh "setx IRON_HAMMER_HOME \"#{@home}\""
19
+
20
+ File.open(File.join(@home, 'rakefile.rb'), 'w') do |f|
21
+ f.write default_rakefile_rb
22
+ end
23
+
24
+ File.open(File.join(@home, 'ivysettings.xml'), 'w') do |f|
25
+ f.write default_ivysettings
26
+ end
27
+ end
28
+
29
+ def self.print_message
30
+ puts "IRON_HAMMER_HOME environment variable not found! Generating default config on #{@home}"
31
+ puts "You'll need to download apache ivy from http://ant.apache.org/ivy/download.cgi"
32
+ puts "and copy ivy-x.x.x.jar to #{@home}\\ivy.jar"
33
+ puts "You can also edit #{@home}\\rakefile.rb and change any settings you want"
34
+ end
35
+
36
+ def self.default_rakefile_rb
37
+ <<EOF
38
+ require 'rubygems'
39
+
40
+ #VISUAL_STUDIO_PATH = ENV['VISUAL_STUDIO_PATH'] || 'C:\\Program Files\\Microsoft Visual Studio 9.0\\Common7\\IDE'
41
+ IVY_JAR = "#{ENV['IRON_HAMMER_HOME']}\\ivy.jar"
42
+ IVY_SETTINGS = "#{ENV['IRON_HAMMER_HOME']}\\ivysettings.xml"
43
+ #ORGANISATION = 'Your company'
44
+
45
+ require 'iron_hammer/tasks'
46
+ EOF
47
+ end
48
+
49
+ def self.default_ivysettings
50
+ <<EOF
51
+ <ivysettings>
52
+ <settings defaultResolver="default" />
53
+ <caches defaultCacheDir="#{folder}/Ivy/Cache"/>
54
+ <resolvers>
55
+ <filesystem name="default">
56
+ <ivy pattern="#{folder}/Ivy/Repository/[organisation]/[module]/ivys/ivy-[revision].xml"/>
57
+ <artifact pattern="#{folder}/Ivy/Repository/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
58
+ </filesystem>
59
+ </resolvers>
60
+ </ivysettings>
61
+ EOF
62
+ end
63
+ end
64
+ end
65
+
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.8
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mozair Alves do Carmo Junior
@@ -70,6 +70,7 @@ email:
70
70
  executables:
71
71
  - ivy
72
72
  - bump
73
+ - iron
73
74
  extensions: []
74
75
 
75
76
  extra_rdoc_files:
@@ -80,8 +81,10 @@ files:
80
81
  - Rakefile
81
82
  - bin/ivy
82
83
  - bin/bump
84
+ - bin/iron
83
85
  - lib/iron_hammer.rb
84
86
  - lib/iron_hammer/anvil.rb
87
+ - lib/iron_hammer/configuration.rb
85
88
  - lib/iron_hammer/default_binaries_behavior.rb
86
89
  - lib/iron_hammer/default_configuration_behavior.rb
87
90
  - lib/iron_hammer/default_deliverables_behavior.rb