Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
## v0.1.2
- Bumping version to v0.1.2
- add fstab module and specs
- add service.restart, return 'self' in service methods
- use custom runtime error subclass for command failures

## v0.1.1
- Bumping version to 0.1.1
- add special distro types (generic/test)
- parse numeric partition sizes from parted output
- tidy up new features, round out specs testing them
- features to round out set
- add system representation
- add logical volume skeleton
- add disk/partition representations & specs
- start adding specs for services
- add service representation
- add distro representation
- Improved test coverage of common
- Add proxy support to subscribe, refactor proxy details into a method.
- Add register command with proxy and satellite options and tests.
- Create an array from the options instead of a hash.
- Requiring all of active_support core_extensions
- ActiveSupport v4 drops support for ruby 1.9.2

## v0.1.0
- Building v0.1.0
- Made sanitize a private method
- Fixed default options to expect positive case.
- Cleanup of commands
- Refactored sanitizing
- Added active_support for blank? method
- Allow common methods to be called without namespacing.
- Extending Yum to get the latest available version for package(s)
- Add more options to Subscription Manager registration
- Add a common method to sanitize user input for the command line.
- Add common write command for use in writing config files.
- Add parsing of Yum repo files with tests and sample data.
- Add gem to parse files with ini type contents
- Adding Hash store_path
- Extend Yum.update to allow an optional list of packages as arguments.
- Add test and support for using yum's repotrack tool.
- Add test and support for using yum's createrepo tool.
- Added tests and support for RPM.
- Adding dependency for other core extensions.
- Fix issue related to command output filling up the IO pipe.
- Removing JRuby, Rubinius and MRI 1.8 because of Kernel.spawn support.
- Fix misnamed .travis.yml file
- Adding Version Badge

## v0.0.1
- Adding Gemnasium support
- Adding Coveralls support
- Adding CodeClimate support
- Adding travis-ci support
- Adding example for Red Hat Subscription Manager hosted
- '.registered?' should return false rather than raise if not available.
- Adding support and tests for SubscriptionManager
- Extending Common.run with option ':return_output'
- Added support to mock command output sourced from a data file for tests
- Adding tests for Yum commands
- Adding tests for linux_admin
- Updating Yum methods to leverage changes in Common module
- Extending common and adding tests
- Cleaner way to get the exitstatus of the shell process.
- Yum commands should return true-false or raise an exception
- Adding high level method to check system registration status
- Adding tests for RHN functionality.
- Adding support for RHN and method to check registeration status
- Adding support for Yum (check and apply updates)
- Adding a module for shared methods.
- Adding rspec for testing.
- Gem Framework added.
4 changes: 3 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ require "bundler/gem_tasks"
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new('spec')
task :test => :spec
task :default => :spec
task :default => :spec

Dir[File.join(File.dirname(__FILE__),'tasks/*.rake')].each { |f| load f }
129 changes: 129 additions & 0 deletions tasks/release.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
Rake::Task[:release].enhance [:prepare_for_release]

require 'active_support/core_ext'

CHANGELOG_FILE = "CHANGELOG.md".freeze
GEM_DIRECTORY = File.dirname(__FILE__).split("/")[-2].freeze
GEM_CONSTANT = GEM_DIRECTORY.classify.constantize
GEM_VERSION_FILE = "./lib/#{GEM_DIRECTORY}/version.rb"

task :prepare_for_release do
puts "Preparing for release of #{GEM_CONSTANT}"

puts "Old Version: #{old_release_tag}"
puts "New Version: #{new_release_tag}"
update_version_file

prepend_to_changelog
puts "\nChangelog updated, please review and save changes. Press enter to continue..."
STDIN.gets

confirm_all_changes

commit_changes
end


def file_modified_since_release?(file)
# Check for committed changes
`git diff --quiet #{old_release_tag}...HEAD #{file}`
return true if $?.exitstatus == 1

# Check for uncommitted changes
`git diff --quiet #{file}`
return true if $?.exitstatus == 1

false
end

def commits_since_last_release
`git log --no-merges --format=" - %s" #{old_release_tag}...HEAD`
end

def update_version_file
return if file_modified_since_release?(GEM_VERSION_FILE)
updated_contents = read_version_file.collect {|line| line.include?("VERSION") ? line.split("=").first.rstrip + " = \"#{new_gem_version}\"" : line}
File.write(GEM_VERSION_FILE, updated_contents.join("\n"))
puts "\nVersion File Updated"
end

def new_release_tag
"v#{new_gem_version}"
end

def new_gem_version
@new_gem_version ||= begin
return version_from_version_file if file_modified_since_release?(GEM_VERSION_FILE)

old_version = Hash[[:major, :minor, :build].zip(version_from_version_file.split("."))]
old_version.each_with_object({}) do |(k, v), h|
h[k] = if h[release_type]; 0
elsif k == release_type; (old_version[release_type].to_i + 1).to_s
else old_version[k]
end
end.values.join(".")
end
end

def release_type
@release_type ||= begin
puts <<-EOQ

Please select release type:
1) Build (0.0.x)
2) Minor (0.x.0)
3) Major (x.0.0)
EOQ

case STDIN.gets.chomp.to_i
when 1; :build
when 2; :minor
when 3; :major
else exit 1
end
end
end

def version_from_version_file
read_version_file.select { |l| l.include?("VERSION")}.first.split("=").last.tr("\"", "").strip
end

def read_version_file
@read_version_file ||= File.read(GEM_VERSION_FILE).split("\n")
end

def old_release_tag
@old_release_tag ||= begin
`git tag -l v*`.split("\n").last
end
end

def prepend_to_changelog
#TODO: prepend missing releases also?
changes = ["## #{new_release_tag}", commits_since_last_release, File.read(CHANGELOG_FILE)].join("\n")
File.write(CHANGELOG_FILE, changes)
end

def confirm_all_changes
puts `git diff`
puts <<-EOQ

Please confirm the changes above...
1) Accept all changes
2) Reload changes
3) Exit - aborting commit
EOQ

case STDIN.gets.chomp.to_i
when 1; return
when 2; confirm_all_changes
else exit 1
end
end

def commit_changes
`git add -u`
`git commit -m "Bumping version to #{new_release_tag}"`
puts "\nChanges committed. Press enter to release #{GEM_CONSTANT} #{new_release_tag}"
STDIN.gets
end