Move version to separate file

This commit is contained in:
Petr Korolev 2014-11-17 17:54:13 +02:00
parent fab1e28e3e
commit 07e0ec0cfb
4 changed files with 397 additions and 385 deletions

View File

@ -1,6 +1,6 @@
Gem::Specification.new do |s| Gem::Specification.new do |s|
s.name = "github_changelog_generator" s.name = "github_changelog_generator"
s.version = "1.1.2" s.version = GitHubChangelogGenerator::VERSION
s.default_executable = "github_changelog_generator" s.default_executable = "github_changelog_generator"
s.required_ruby_version = '>= 1.9.3' s.required_ruby_version = '>= 1.9.3'

View File

@ -6,7 +6,7 @@ require 'httparty'
require 'colorize' require 'colorize'
require_relative 'github_changelog_generator/parser' require_relative 'github_changelog_generator/parser'
module GitHubChangelogGenerator
class ChangelogGenerator class ChangelogGenerator
attr_accessor :options, :all_tags, :github attr_accessor :options, :all_tags, :github
@ -374,3 +374,5 @@ if __FILE__ == $0
changelog_generator = ChangelogGenerator.new changelog_generator = ChangelogGenerator.new
changelog_generator.compund_changelog changelog_generator.compund_changelog
end end
end

View File

@ -1,6 +1,8 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
require 'optparse' require 'optparse'
require_relative 'version'
module GitHubChangelogGenerator
class Parser class Parser
def self.parse_options def self.parse_options
options = {:tag1 => nil, :tag2 => nil, :format => '%d/%m/%y', :output => 'CHANGELOG.md', :labels => %w(bug enhancement), :pulls => true, :issues => true, :verbose => true, :add_issues_wo_labels => true, :merge_prefix => '*Merged pull-request:* '} options = {:tag1 => nil, :tag2 => nil, :format => '%d/%m/%y', :output => 'CHANGELOG.md', :labels => %w(bug enhancement), :pulls => true, :issues => true, :verbose => true, :add_issues_wo_labels => true, :merge_prefix => '*Merged pull-request:* '}
@ -20,7 +22,7 @@ class Parser
puts opts puts opts
exit exit
end end
opts.on('-v', '--[no-]verbose', 'Run verbosely. Default is true') do |v| opts.on('--[no-]verbose', 'Run verbosely. Default is true') do |v|
options[:verbose] = v options[:verbose] = v
end end
opts.on('--[no-]issues', 'Include closed issues to changelog. Default is true') do |v| opts.on('--[no-]issues', 'Include closed issues to changelog. Default is true') do |v|
@ -44,6 +46,10 @@ class Parser
opts.on('--labels x,y,z', Array, 'List of labels. Issues with that labels will be included to changelog. Default is \'bug,enhancement\'') do |list| opts.on('--labels x,y,z', Array, 'List of labels. Issues with that labels will be included to changelog. Default is \'bug,enhancement\'') do |list|
options[:labels] = list options[:labels] = list
end end
opts.on('-v', '--version', 'Print version number') do |v|
puts "Version: #{GitHubChangelogGenerator::VERSION}"
exit
end
} }
parser.parse! parser.parse!
@ -79,3 +85,4 @@ class Parser
options options
end end
end end
end

View File

@ -0,0 +1,3 @@
module GitHubChangelogGenerator
VERSION = '1.1.2'
end