Sha256: d9ffcf24882fc9d372d871be498e0a104bab19ac51bcd488d4b5a0764bc61a37

Contents?: true

Size: 1.09 KB

Versions: 11

Compression:

Stored size: 1.09 KB

Contents

require 'puppet_blacksmith'

require 'modulesync/source_code'

module ModuleSync
  # Provide methods to manipulate puppet module code
  class PuppetModule < SourceCode
    def update_changelog(version, message)
      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 "#{message}\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

    def bump(message, 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, message) if changelog
      repository.git.commit("Release version #{new}")
      repository.git.push
      new
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
modulesync-3.2.0 lib/modulesync/puppet_module.rb
modulesync-3.1.0 lib/modulesync/puppet_module.rb
modulesync-2.7.0 lib/modulesync/puppet_module.rb
modulesync-2.6.0 lib/modulesync/puppet_module.rb
modulesync-2.5.0 lib/modulesync/puppet_module.rb
modulesync-2.4.0 lib/modulesync/puppet_module.rb
modulesync-2.3.1 lib/modulesync/puppet_module.rb
modulesync-2.3.0 lib/modulesync/puppet_module.rb
modulesync-2.2.0 lib/modulesync/puppet_module.rb
modulesync-2.1.1 lib/modulesync/puppet_module.rb
modulesync-2.1.0 lib/modulesync/puppet_module.rb