github_changelog_generator 1.1.2 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,81 +1,88 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'optparse'
3
+ require_relative 'version'
3
4
 
4
- class Parser
5
- def self.parse_options
6
- 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:* ' }
5
+ module GitHubChangelogGenerator
6
+ class Parser
7
+ def self.parse_options
8
+ 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:* '}
7
9
 
8
- parser = OptionParser.new { |opts|
9
- opts.banner = 'Usage: changelog_generator [options]'
10
- opts.on('-u', '--user [USER]', 'Username of the owner of target GitHub repo') do |last|
11
- options[:user] = last
12
- end
13
- opts.on('-p', '--project [PROJECT]', 'Name of project on GitHub') do |last|
14
- options[:project] = last
15
- end
16
- opts.on('-t', '--token [TOKEN]', 'To make more than 50 requests this script required your OAuth token for GitHub. You can generate it on https://github.com/settings/applications') do |last|
17
- options[:token] = last
18
- end
19
- opts.on('-h', '--help', 'Displays Help') do
20
- puts opts
10
+ parser = OptionParser.new { |opts|
11
+ opts.banner = 'Usage: changelog_generator [options]'
12
+ opts.on('-u', '--user [USER]', 'Username of the owner of target GitHub repo') do |last|
13
+ options[:user] = last
14
+ end
15
+ opts.on('-p', '--project [PROJECT]', 'Name of project on GitHub') do |last|
16
+ options[:project] = last
17
+ end
18
+ opts.on('-t', '--token [TOKEN]', 'To make more than 50 requests this script required your OAuth token for GitHub. You can generate here: https://github.com/settings/tokens/new') do |last|
19
+ options[:token] = last
20
+ end
21
+ opts.on('-h', '--help', 'Displays Help') do
22
+ puts opts
23
+ exit
24
+ end
25
+ opts.on('--[no-]verbose', 'Run verbosely. Default is true') do |v|
26
+ options[:verbose] = v
27
+ end
28
+ opts.on('--[no-]issues', 'Include closed issues to changelog. Default is true') do |v|
29
+ options[:issues] = v
30
+ end
31
+ opts.on('--[no-]issues-without-labels', 'Include closed issues without any labels to changelog. Default is true') do |v|
32
+ options[:add_issues_wo_labels] = v
33
+ end
34
+ opts.on('--[no-]pull-requests', 'Include pull-requests to changelog. Default is true') do |v|
35
+ options[:pulls] = v
36
+ end
37
+ opts.on('-l', '--last-changes', 'Generate log between last 2 tags only') do |last|
38
+ options[:last] = last
39
+ end
40
+ opts.on('-f', '--date-format [FORMAT]', 'Date format. Default is %d/%m/%y') do |last|
41
+ options[:format] = last
42
+ end
43
+ opts.on('-o', '--output [NAME]', 'Output file. Default is CHANGELOG.md') do |last|
44
+ options[:output] = last
45
+ end
46
+ 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|
47
+ options[:labels] = list
48
+ end
49
+ opts.on('-v', '--version', 'Print version number') do |v|
50
+ puts "Version: #{GitHubChangelogGenerator::VERSION}"
51
+ exit
52
+ end
53
+ }
54
+
55
+ parser.parse!
56
+
57
+ #udefined case with 1 parameter:
58
+ if ARGV[0] && !ARGV[1]
59
+ puts parser.banner
21
60
  exit
22
61
  end
23
- opts.on('-v', '--[no-]verbose', 'Run verbosely. Default is true') do |v|
24
- options[:verbose] = v
25
- end
26
- opts.on('--[no-]issues', 'Include closed issues to changelog. Default is true') do |v|
27
- options[:issues] = v
28
- end
29
- opts.on('--[no-]issues-without-labels', 'Include closed issues without any labels to changelog. Default is true') do |v|
30
- options[:add_issues_wo_labels] = v
31
- end
32
- opts.on('--[no-]pull-requests', 'Include pull-requests to changelog. Default is true') do |v|
33
- options[:pulls] = v
34
- end
35
- opts.on('-l', '--last-changes', 'Generate log between last 2 tags only') do |last|
36
- options[:last] = last
37
- end
38
- opts.on('-f', '--date-format [FORMAT]', 'Date format. Default is %d/%m/%y') do |last|
39
- options[:format] = last
40
- end
41
- opts.on('-o', '--output [NAME]', 'Output file. Default is CHANGELOG.md') do |last|
42
- options[:output] = last
43
- end
44
- 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|
45
- options[:labels] = list
46
- end
47
- }
48
62
 
49
- parser.parse!
63
+ if !options[:user] && !options[:project]
64
+ remote = `git remote -vv`.split("\n")
65
+ match = /.*(?:[:\/])((?:-|\w|\.)*)\/((?:-|\w|\.)*)\.git.*/.match(remote[0])
50
66
 
51
- #udefined case with 1 parameter:
52
- if ARGV[0] && !ARGV[1]
53
- puts parser.banner
54
- exit
55
- end
67
+ if match && match[1] && match[2]
68
+ puts "Detected user:#{match[1]}, project:#{match[2]}"
69
+ options[:user], options[:project] = match[1], match[2]
70
+ end
71
+ end
56
72
 
57
- if !options[:user] && !options[:project]
58
- remote = `git remote -vv`.split("\n")
59
- match = /.*(?:[:\/])((?:-|\w|\.)*)\/((?:-|\w|\.)*)\.git.*/.match(remote[0])
60
73
 
61
- if match && match[1] && match[2]
62
- puts "Detected user:#{match[1]}, project:#{match[2]}"
63
- options[:user], options[:project] = match[1], match[2]
74
+ if !options[:user] || !options[:project]
75
+ puts parser.banner
76
+ exit
64
77
  end
65
- end
66
-
67
78
 
68
- if !options[:user] || !options[:project]
69
- puts parser.banner
70
- exit
71
- end
79
+ if ARGV[1]
80
+ options[:tag1] = ARGV[0]
81
+ options[:tag2] = ARGV[1]
72
82
 
73
- if ARGV[1]
74
- options[:tag1] = ARGV[0]
75
- options[:tag2] = ARGV[1]
83
+ end
76
84
 
85
+ options
77
86
  end
78
-
79
- options
80
87
  end
81
88
  end
@@ -0,0 +1,3 @@
1
+ module GitHubChangelogGenerator
2
+ VERSION = '1.1.4'
3
+ end
metadata CHANGED
@@ -1,29 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github_changelog_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Petr Korolev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-10 00:00:00.000000000 Z
11
+ date: 2014-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: httparty
14
+ name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.13'
20
- type: :runtime
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
21
35
  prerelease: false
22
36
  version_requirements: !ruby/object:Gem::Requirement
23
37
  requirements:
24
38
  - - "~>"
25
39
  - !ruby/object:Gem::Version
26
- version: '0.13'
40
+ version: '10.0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: github_api
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -38,6 +52,20 @@ dependencies:
38
52
  - - "~>"
39
53
  - !ruby/object:Gem::Version
40
54
  version: '0.12'
55
+ - !ruby/object:Gem::Dependency
56
+ name: colorize
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.7'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.7'
41
69
  description: Script, that automatically generate change-log from your tags and pull-requests
42
70
  email: sky4winder+github_changelog_generator@gmail.com
43
71
  executables:
@@ -45,9 +73,17 @@ executables:
45
73
  extensions: []
46
74
  extra_rdoc_files: []
47
75
  files:
76
+ - ".gitignore"
77
+ - CHANGELOG.md
78
+ - Gemfile
79
+ - Gemfile.lock
80
+ - README.md
48
81
  - bin/github_changelog_generator
82
+ - bump_gemfile.rb
83
+ - github_changelog_generator.gemspec
49
84
  - lib/github_changelog_generator.rb
50
85
  - lib/github_changelog_generator/parser.rb
86
+ - lib/github_changelog_generator/version.rb
51
87
  homepage: https://github.com/skywinder/Github-Changelog-Generator
52
88
  licenses:
53
89
  - MIT
@@ -68,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
68
104
  version: '0'
69
105
  requirements: []
70
106
  rubyforge_project:
71
- rubygems_version: 2.2.2
107
+ rubygems_version: 2.4.3
72
108
  signing_key:
73
109
  specification_version: 4
74
110
  summary: Script, that automatically generate change-log from your tags and pull-requests.