Class: Blacksmith::RakeTask
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- Blacksmith::RakeTask
- Defined in:
- lib/puppet_blacksmith/rake_tasks.rb
Instance Attribute Summary collapse
-
#build ⇒ Object
Returns the value of attribute build.
-
#commit_message_pattern ⇒ Object
Returns the value of attribute commit_message_pattern.
-
#tag_message_pattern ⇒ Object
Returns the value of attribute tag_message_pattern.
-
#tag_pattern ⇒ Object
Returns the value of attribute tag_pattern.
-
#tag_sign ⇒ Object
Returns the value of attribute tag_sign.
Instance Method Summary collapse
- #define(args, &task_block) ⇒ Object
- #git ⇒ Object
-
#initialize(*args, &task_block) ⇒ RakeTask
constructor
A new instance of RakeTask.
Constructor Details
#initialize(*args, &task_block) ⇒ RakeTask
Returns a new instance of RakeTask.
10 11 12 13 14 15 |
# File 'lib/puppet_blacksmith/rake_tasks.rb', line 10 def initialize(*args, &task_block) @build = true @task_name = args.shift || "blacksmith" @desc = args.shift || "Puppet Forge utilities" define(args, &task_block) end |
Instance Attribute Details
#build ⇒ Object
Returns the value of attribute build.
8 9 10 |
# File 'lib/puppet_blacksmith/rake_tasks.rb', line 8 def build @build end |
#commit_message_pattern ⇒ Object
Returns the value of attribute commit_message_pattern.
8 9 10 |
# File 'lib/puppet_blacksmith/rake_tasks.rb', line 8 def @commit_message_pattern end |
#tag_message_pattern ⇒ Object
Returns the value of attribute tag_message_pattern.
8 9 10 |
# File 'lib/puppet_blacksmith/rake_tasks.rb', line 8 def @tag_message_pattern end |
#tag_pattern ⇒ Object
Returns the value of attribute tag_pattern.
8 9 10 |
# File 'lib/puppet_blacksmith/rake_tasks.rb', line 8 def tag_pattern @tag_pattern end |
#tag_sign ⇒ Object
Returns the value of attribute tag_sign.
8 9 10 |
# File 'lib/puppet_blacksmith/rake_tasks.rb', line 8 def tag_sign @tag_sign end |
Instance Method Details
#define(args, &task_block) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/puppet_blacksmith/rake_tasks.rb', line 27 def define(args, &task_block) task_block.call(*[self, args].slice(0, task_block.arity)) if task_block # clear any (auto-)pre-existing task [ :bump, 'bump:major', 'bump:minor', 'bump:patch', 'bump:full', :tag, :version, 'version:next', 'version:next:major', 'version:next:minor', 'version:next:patch', :bump_commit, 'bump_commit:major', 'bump_commit:minor', 'bump_commit:patch', 'bump_commit:full', :push, :clean, :release, :dependency ].each do |t| Rake::Task.task_defined?("module:#{t}") && Rake::Task["module:#{t}"].clear end namespace :module do namespace :bump do [:major, :minor, :patch, :full].each do |level| desc "Bump module version to the next #{level.upcase} version" task level do m = Blacksmith::Modulefile.new v = m.bump!(level) puts "Bumping version from #{m.version} to #{v}" end end end desc "Bump module to specific version number" task :bump_to_version, [:new_version] do |t, targs| m = Blacksmith::Modulefile.new m.bump_to_version!(targs[:new_version]) puts "Bumping version to #{targs[:new_version]}" end desc "Bump module version to the next patch" task :bump do m = Blacksmith::Modulefile.new v = m.bump_patch! puts "Bumping version from #{m.version} to #{v}" end desc "Git tag with the current module version" task :tag do m = Blacksmith::Modulefile.new git.tag!(m.version) end namespace :version do desc "Get next module version" task :next do m = Blacksmith::Modulefile.new puts m.increase_version(m.version, 'patch') end [:major, :minor, :patch].each do |level| desc "Get the next #{level.upcase} version" task "next:#{level}".to_sym do m = Blacksmith::Modulefile.new puts m.increase_version(m.version, level) end end end desc "Get current module version" task :version do m = Blacksmith::Modulefile.new puts m.version end namespace :bump_commit do [:major, :minor, :patch, :full].each do |level| desc "Bump module version to the next #{level.upcase} version and git commit" task level => "bump:#{level}".to_sym do m = Blacksmith::Modulefile.new git.commit_modulefile!(m.version) end end end desc "Bump version and git commit" task :bump_commit => :bump do m = Blacksmith::Modulefile.new git.commit_modulefile!(m.version) end desc "Push module to the Puppet Forge" task :push => :build do m = Blacksmith::Modulefile.new forge = Blacksmith::Forge.new puts "Uploading to Puppet Forge #{m.}/#{m.name}" forge.push!(m.name, nil, m., m.version) end desc "Runs clean again" task :clean do puts "Cleaning for module build" Rake::Task["clean"].execute end desc "Release the Puppet module, doing a clean, build, bump_commit, tag, push and git push." release_dependencies = @build ? [:clean, :build, :bump_commit, :tag, :push] : [:clean, :bump_commit, :tag] task :release => release_dependencies do puts "Pushing to remote git repo" git.push! end desc "Set specific module dependency version" task :dependency, [:module_name, :version] do |t, targs| mn = targs[:module_name] mv = targs[:version] m = Blacksmith::Modulefile.new m.bump_dep! mn, mv puts "Updated module dependency #{mn} to #{mv}" end end end |
#git ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/puppet_blacksmith/rake_tasks.rb', line 17 def git git = Blacksmith::Git.new git.tag_pattern = @tag_pattern git. = @tag_message_pattern git. = @commit_message_pattern git.tag_sign = @tag_sign git end |