Class: ModuleSync::PuppetModule
- Inherits:
-
SourceCode
- Object
- SourceCode
- ModuleSync::PuppetModule
- Defined in:
- lib/modulesync/puppet_module.rb
Overview
Provide methods to manipulate puppet module code
Instance Attribute Summary
Attributes inherited from SourceCode
Instance Method Summary collapse
Methods inherited from SourceCode
#git_service, #git_service_configuration, #initialize, #open_pull_request, #path, #repository, #repository_name, #repository_namespace, #repository_path, #repository_remote, #working_directory
Constructor Details
This class inherits a constructor from ModuleSync::SourceCode
Instance Method Details
#bump(message, changelog = false) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/modulesync/puppet_module.rb', line 26 def bump(, changelog = false) m = Blacksmith::Modulefile.new path('metadata.json') new = m.bump! puts "Bumped to version #{new}" repository.git.add('metadata.json') update_changelog(new, ) if changelog repository.git.commit("Release version #{new}") repository.git.push new end |
#update_changelog(version, message) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/modulesync/puppet_module.rb', line 8 def update_changelog(version, ) changelog = path('CHANGELOG.md') if File.exist?(changelog) puts "Updating #{changelog} for version #{version}" changes = File.readlines(changelog) File.open(changelog, 'w') do |f| date = Time.now.strftime('%Y-%m-%d') f.puts "## #{date} - Release #{version}\n\n" f.puts "#{}\n\n" # Add old lines again f.puts changes end repository.git.add('CHANGELOG.md') else puts 'No CHANGELOG.md file found, not updating.' end end |