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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a85fd9e4df53ccc764ea93c75383999a6a6731b4
4
- data.tar.gz: 6d2713c79a1fccc559c660c92706a8c8dfc84d3a
3
+ metadata.gz: dc28a7bacd92b9bd2e5abdef760d348fc711540c
4
+ data.tar.gz: fb8856f86cd8e9988481f407b667f22209307563
5
5
  SHA512:
6
- metadata.gz: 1bef64c1b569079d0954b1d311b6148211e15b6351c67bd8ec4446961fe3daa159a544a6d6b1ff6449492b1ac9943c20c1706f04bfbee41c0e064c80af50fa19
7
- data.tar.gz: d99a95dae2167ab00aaa75217d0d682fd0be5a314fd4b43794113e60cf7b8f27da8c1abb81111b0d7844dcfcd4026c51297b7d5ffc9d324982fcf92623ac884a
6
+ metadata.gz: 0e0d0694c082fc9f51f47f30baa3d1f1572ecbf20d773564c1e8fd22fb9f31f421fd60c76f695502082c258193716689e904cc762cb5f1eefea214a62233073e
7
+ data.tar.gz: d1a2a0aef52861f68563d3fec4fca64e46b5f794a09669cfdc49fbfc0336f763e61ad1d0676291a9f218834bf4bbcf27e237902129adb2947c209447743a1606
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ /lib/CHANGELOG.md
data/CHANGELOG.md ADDED
@@ -0,0 +1,61 @@
1
+ # Changelog
2
+
3
+ ## [1.1.3] (https://github.com/skywinder/Github-Changelog-Generator/tree/1.1.3)
4
+ #### 18/11/14
5
+ - *Merged pull-request:* Sort tags by date [\#23](https://github.com/skywinder/Github-Changelog-Generator/pull/23)
6
+
7
+ - *Implemented enhancement:* Implement ability to retrieve GitHub token from some shell variable (to not put it to script directly) [\#19](https://github.com/skywinder/Github-Changelog-Generator/issues/19)
8
+
9
+ - *Fixed bug:* Script fills changelog only for first 30 tags. [\#20](https://github.com/skywinder/Github-Changelog-Generator/issues/20)
10
+
11
+ ## [1.1.2] (https://github.com/skywinder/Github-Changelog-Generator/tree/1.1.2)
12
+ #### 12/11/14
13
+ - *Merged pull-request:* Fix bug with dot signs in project name [\#18](https://github.com/skywinder/Github-Changelog-Generator/pull/18)
14
+
15
+ - *Merged pull-request:* Fix bug with dot signs in user name [\#17](https://github.com/skywinder/Github-Changelog-Generator/pull/17)
16
+
17
+ ## [1.1.1] (https://github.com/skywinder/Github-Changelog-Generator/tree/1.1.1)
18
+ #### 10/11/14
19
+ - *Merged pull-request:* Remove duplicates of issues and pull-requests with same number [\#15](https://github.com/skywinder/Github-Changelog-Generator/pull/15)
20
+
21
+ - *Merged pull-request:* Sort issues by tags [\#14](https://github.com/skywinder/Github-Changelog-Generator/pull/14)
22
+
23
+ - *Merged pull-request:* Add ability to add or exclude issues without any labels [\#13](https://github.com/skywinder/Github-Changelog-Generator/pull/13)
24
+
25
+ ## [1.1.0] (https://github.com/skywinder/Github-Changelog-Generator/tree/1.1.0)
26
+ #### 10/11/14
27
+ - *Implemented enhancement:* Detect username and project form origin [\#11](https://github.com/skywinder/Github-Changelog-Generator/issues/11)
28
+
29
+ - *Fixed bug:* Markdown formating in the last line wrong [\#9](https://github.com/skywinder/Github-Changelog-Generator/issues/9)
30
+
31
+ - *Fixed bug:* Bug with wrong credentials in 1.0.1 [\#12](https://github.com/skywinder/Github-Changelog-Generator/issues/12)
32
+
33
+ ## [1.0.1] (https://github.com/skywinder/Github-Changelog-Generator/tree/1.0.1)
34
+ #### 10/11/14
35
+ - *Merged pull-request:* Implement support of different tags. [\#8](https://github.com/skywinder/Github-Changelog-Generator/pull/8)
36
+
37
+ ## [1.0.0] (https://github.com/skywinder/Github-Changelog-Generator/tree/1.0.0)
38
+ #### 07/11/14
39
+ - *Merged pull-request:* Add support for issues in CHANGELOG [\#7](https://github.com/skywinder/Github-Changelog-Generator/pull/7)
40
+
41
+ - *Merged pull-request:* Fix parsing date of pull request [\#3](https://github.com/skywinder/Github-Changelog-Generator/pull/3)
42
+
43
+ - *Implemented enhancement:* Implement option to specify output filename [\#4](https://github.com/skywinder/Github-Changelog-Generator/issues/4)
44
+
45
+ - *Implemented enhancement:* Add support for fixed issues and implemented enchanments. [\#6](https://github.com/skywinder/Github-Changelog-Generator/issues/6)
46
+
47
+ - *Fixed bug:* Last tag not appeared in changelog [\#5](https://github.com/skywinder/Github-Changelog-Generator/issues/5)
48
+
49
+ ## [0.1.0] (https://github.com/skywinder/Github-Changelog-Generator/tree/0.1.0)
50
+ #### 07/11/14
51
+ - *Merged pull-request:* Add changelog generation for last tag [\#2](https://github.com/skywinder/Github-Changelog-Generator/pull/2)
52
+
53
+ - *Merged pull-request:* Add option (-o --output) to specify name of the output file. [\#1](https://github.com/skywinder/Github-Changelog-Generator/pull/1)
54
+
55
+ ## [0.0.2] (https://github.com/skywinder/Github-Changelog-Generator/tree/0.0.2)
56
+ #### 06/11/14
57
+ ## [0.0.1] (https://github.com/skywinder/Github-Changelog-Generator/tree/0.0.1)
58
+ #### 06/11/14
59
+
60
+
61
+ \* *This changelog was generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+ gem 'github_api'
3
+ gem 'colorize'
data/Gemfile.lock ADDED
@@ -0,0 +1,40 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ addressable (2.3.6)
5
+ colorize (0.7.3)
6
+ descendants_tracker (0.0.4)
7
+ thread_safe (~> 0.3, >= 0.3.1)
8
+ faraday (0.9.0)
9
+ multipart-post (>= 1.2, < 3)
10
+ github_api (0.12.2)
11
+ addressable (~> 2.3)
12
+ descendants_tracker (~> 0.0.4)
13
+ faraday (~> 0.8, < 0.10)
14
+ hashie (>= 3.3)
15
+ multi_json (>= 1.7.5, < 2.0)
16
+ nokogiri (~> 1.6.3)
17
+ oauth2
18
+ hashie (3.3.1)
19
+ jwt (1.0.0)
20
+ mini_portile (0.6.1)
21
+ multi_json (1.10.1)
22
+ multi_xml (0.5.5)
23
+ multipart-post (2.0.0)
24
+ nokogiri (1.6.4)
25
+ mini_portile (~> 0.6.0)
26
+ oauth2 (1.0.0)
27
+ faraday (>= 0.8, < 0.10)
28
+ jwt (~> 1.0)
29
+ multi_json (~> 1.3)
30
+ multi_xml (~> 0.5)
31
+ rack (~> 1.2)
32
+ rack (1.5.2)
33
+ thread_safe (0.3.4)
34
+
35
+ PLATFORMS
36
+ ruby
37
+
38
+ DEPENDENCIES
39
+ colorize
40
+ github_api
data/README.md ADDED
@@ -0,0 +1,85 @@
1
+ GitHub Changelog Generator
2
+ ==================
3
+
4
+ [![Gem Version](https://badge.fury.io/rb/github_changelog_generator.svg)](http://badge.fury.io/rb/github_changelog_generator)
5
+
6
+ Changelog generation has never been so easy.
7
+
8
+ This script automatically generate change-log from your tags and merged pull-requests.
9
+
10
+ ## Installation:
11
+ [sudo] gem install github_changelog_generator
12
+
13
+ ## Usage
14
+ **It's really simple**:
15
+
16
+ - `cd` to your Project folder with configured git and just type:
17
+
18
+ github_changelog_generator
19
+
20
+ - from anywhere:
21
+
22
+ github_changelog_generator -u github-username -p github-project
23
+
24
+ As output you will get `CHANGELOG.md` file with *pretty Markdown-formatted* changelog.
25
+
26
+ ## Params:
27
+ Type `github_changelog_generator --help` for detailed usage.
28
+
29
+ Usage: changelog_generator [options]
30
+ -u, --user [USER] Username of the owner of target GitHub repo
31
+ -p, --project [PROJECT] Name of project on GitHub
32
+ -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
33
+ -h, --help Displays Help
34
+ -v, --[no-]verbose Run verbosely. Default is true
35
+ --[no-]issues Include closed issues to changelog. Default is true
36
+ --[no-]issues-without-labels Include closed issues without any labels to changelog. Default is true
37
+ --[no-]pull-requests Include pull-requests to changelog. Default is true
38
+ -l, --last-changes Generate log between last 2 tags only
39
+ -f, --date-format [FORMAT] Date format. Default is %d/%m/%y
40
+ -o, --output [NAME] Output file. Default is CHANGELOG.md
41
+ --labels x,y,z List of labels. Issues with that labels will be included to changelog. Default is 'bug,enhancement'
42
+
43
+ ## Examples:
44
+
45
+ - Look at changelog for **[CHANGELOG.md](https://github.com/skywinder/Github-Changelog-Generator/blob/master/CHANGELOG.md)** for this project
46
+ - This changelog: [ActionSheetPicker-3.0/CHANGELOG.md](https://github.com/skywinder/ActionSheetPicker-3.0/blob/master/CHANGELOG.md) was generated by command:
47
+
48
+ github_changelog_generator -u skywinder -p ActionSheetPicker-3.0
49
+
50
+
51
+ ## FAQ:
52
+ Since GitHub allow to make only 50 requests without authentication it's recommended to run this script with token
53
+
54
+ **You can easily [generate it here](https://github.com/settings/applications)**.
55
+
56
+ And:
57
+
58
+ - Run with key `-t [your-16-digit-token]` that
59
+ - Or set environment variable `CHANGELOG_GITHUB_TOKEN` and specify there your token.
60
+
61
+ i.e. add to your `~/.bash_profile` or `~/.zshrc` or any other place to load ENV variables string `export CHANGELOG_GITHUB_TOKEN="your-40-digit-github-token"'`
62
+
63
+ So, if you got error like this:
64
+ >! /Library/Ruby/Gems/2.0.0/gems/github_api-0.12.2/lib/github_api/response/raise_error.rb:14:in `on_complete'
65
+
66
+ It's time to create this token or wait for 1 hour before GitHub reset the counter for your IP.
67
+
68
+ ## Am I missed some essential feature?
69
+
70
+ **Nothing is impossible!** Open an [issue](https://github.com/skywinder/Github-Changelog-Generator/issues/new) and let's make generator better together!
71
+
72
+ *Bug reports, feature requests, patches, well-wishes are always welcome!*
73
+
74
+ ## Contributing
75
+
76
+ 1. Create an issue to discuss about your idea
77
+ 2. [Fork it] (https://github.com/skywinder/Github-Changelog-Generator/fork)
78
+ 3. Create your feature branch (`git checkout -b my-new-feature`)
79
+ 4. Commit your changes (`git commit -am 'Add some feature'`)
80
+ 5. Push to the branch (`git push origin my-new-feature`)
81
+ 6. Create a new Pull Request
82
+
83
+ ## License
84
+
85
+ Github Changelog Generator is released under the [MIT License](http://www.opensource.org/licenses/MIT).
@@ -1,5 +1,4 @@
1
- #!/usr/bin/env ruby
1
+ #! /usr/bin/env ruby
2
2
 
3
3
  require 'github_changelog_generator'
4
-
5
- ChangelogGenerator.new.compund_changelog
4
+ GitHubChangelogGenerator::ChangelogGenerator.new.compund_changelog
data/bump_gemfile.rb ADDED
@@ -0,0 +1,227 @@
1
+ #!/usr/bin/env ruby
2
+ require 'optparse'
3
+
4
+ SPEC_TYPE = 'gemspec'
5
+
6
+ :major
7
+ :minor
8
+ :patch
9
+
10
+ @options = {:dry_run => false, :bump_number => :patch}
11
+
12
+ OptionParser.new { |opts|
13
+ opts.banner = 'Usage: bump.rb [options]'
14
+
15
+ opts.on('-d', '--dry-run', 'Dry run') do |v|
16
+ @options[:dry_run] = v
17
+ end
18
+ opts.on('-a', '--major', 'Bump major version') do |v|
19
+ @options[:bump_number] = :major
20
+ end
21
+ opts.on('-m', '--minor', 'Bump minor version') do |v|
22
+ @options[:bump_number] = :minor
23
+ end
24
+ opts.on('-p', '--patch', 'Bump patch version') do |v|
25
+ @options[:bump_number] = :patch
26
+ end
27
+ opts.on('-r', '--revert', 'Revert last bump') do |v|
28
+ @options[:revert] = v
29
+ end
30
+ }.parse!
31
+
32
+ p @options
33
+
34
+ def check_repo_is_clean_or_dry_run
35
+ value =%x[#{'git status --porcelain'}]
36
+
37
+ if value.empty?
38
+ puts 'Repo is clean -> continue'
39
+ else
40
+ if @options[:dry_run]
41
+ puts 'Repo not clean, "Dry run" enabled -> continue'
42
+ else
43
+ puts 'Repository not clean -> exit'
44
+ exit
45
+ end
46
+ end
47
+ end
48
+
49
+
50
+ def find_spec_file
51
+ list_of_specs = execute_line("find . -name '*.#{SPEC_TYPE}'")
52
+ arr = list_of_specs.split("\n")
53
+
54
+ spec_file = ''
55
+
56
+ case arr.count
57
+ when 0
58
+ puts "No #{SPEC_TYPE} files found. -> Exit."
59
+ exit
60
+ when 1
61
+ spec_file = arr[0]
62
+ else
63
+ puts 'Which spec should be used?'
64
+ arr.each_with_index { |file, index| puts "#{index+1}. #{file}" }
65
+ input_index = Integer(gets.chomp)
66
+ spec_file = arr[input_index-1]
67
+ end
68
+
69
+ if spec_file == nil
70
+ puts "Can't find specified spec file -> exit"
71
+ exit
72
+ end
73
+
74
+ spec_file.sub('./', '')
75
+
76
+ end
77
+
78
+ def find_current_gem_file
79
+ list_of_specs = execute_line("find . -name '*.gem'")
80
+ arr = list_of_specs.split("\n")
81
+
82
+ spec_file = ''
83
+
84
+ case arr.count
85
+ when 0
86
+ puts "No #{SPEC_TYPE} files found. -> Exit."
87
+ exit
88
+ when 1
89
+ spec_file = arr[0]
90
+ else
91
+ puts 'Which spec should be used?'
92
+ arr.each_with_index { |file, index| puts "#{index+1}. #{file}" }
93
+ input_index = Integer(gets.chomp)
94
+ spec_file = arr[input_index-1]
95
+ end
96
+
97
+ if spec_file == nil
98
+ puts "Can't find specified spec file -> exit"
99
+ exit
100
+ end
101
+
102
+ spec_file.sub('./', '')
103
+
104
+ end
105
+
106
+ def find_version_in_podspec(podspec)
107
+ readme = File.read(podspec)
108
+
109
+ #try to find version in format 1.22.333
110
+ re = /(\d+)\.(\d+)\.(\d+)/m
111
+
112
+ match_result = re.match(readme)
113
+
114
+ unless match_result
115
+ puts 'Not found any versions'
116
+ exit
117
+ end
118
+
119
+ puts "Found version #{match_result[0]}"
120
+ return match_result[0], match_result.captures
121
+ end
122
+
123
+ def bump_version(versions_array)
124
+ bumped_result = versions_array.dup
125
+ bumped_result.map! { |x| x.to_i }
126
+
127
+ case @options[:bump_number]
128
+ when :major
129
+ bumped_result[0] += 1
130
+ bumped_result[1] = 0
131
+ bumped_result[2] = 0
132
+ when :minor
133
+ bumped_result[1] += 1
134
+ bumped_result[2] = 0
135
+ when :patch
136
+ bumped_result[2] += 1
137
+ else
138
+ raise('unknown bump_number')
139
+ end
140
+
141
+
142
+ bumped_version = bumped_result.join('.')
143
+ puts "Bump version: #{versions_array.join('.')} -> #{bumped_version}"
144
+ bumped_version
145
+ end
146
+
147
+ def execute_line(line)
148
+ output = `#{line}`
149
+ check_exit_status(output)
150
+
151
+ output
152
+ end
153
+
154
+ def execute_line_if_not_dry_run(line)
155
+ if @options[:dry_run]
156
+ puts "Dry run: #{line}"
157
+ nil
158
+ else
159
+ puts line
160
+ value = %x[#{line}]
161
+ puts value
162
+ check_exit_status(value)
163
+ value
164
+ end
165
+ end
166
+
167
+ def check_exit_status(output)
168
+ if $?.exitstatus != 0
169
+ puts "Output:\n#{output}\nExit status = #{$?.exitstatus} ->Terminate script."
170
+ exit
171
+ end
172
+ end
173
+
174
+ def run_bumping_script
175
+
176
+ check_repo_is_clean_or_dry_run
177
+ spec_file = find_spec_file
178
+ result, versions_array = find_version_in_podspec(spec_file)
179
+ bumped_version = bump_version(versions_array)
180
+
181
+ unless @options[:dry_run]
182
+ puts 'Are you sure? Press Y to continue:'
183
+ str = gets.chomp
184
+ if str != 'Y'
185
+ puts '-> exit'
186
+ exit
187
+ end
188
+ end
189
+
190
+ execute_line_if_not_dry_run("sed -i \"\" \"s/#{result}/#{bumped_version}/\" README.md")
191
+ execute_line_if_not_dry_run("sed -i \"\" \"s/#{result}/#{bumped_version}/\" #{spec_file}")
192
+ execute_line_if_not_dry_run("git commit --all -m \"Update #{$SPEC_TYPE} to version #{bumped_version}\"")
193
+ execute_line_if_not_dry_run("git tag #{bumped_version}")
194
+ execute_line_if_not_dry_run('git push')
195
+ execute_line_if_not_dry_run('git push --tags')
196
+ execute_line_if_not_dry_run("gem build #{spec_file}")
197
+
198
+ gem = find_current_gem_file
199
+ execute_line_if_not_dry_run("gem push #{gem}")
200
+ # execute_line_if_not_dry_run("pod trunk push #{spec_file}")
201
+
202
+ end
203
+
204
+ def revert_last_bump
205
+ spec_file = find_spec_file
206
+ result, _ = find_version_in_podspec(spec_file)
207
+
208
+ puts "DELETE tag #{result} and HARD reset HEAD~1?\nPress Y to continue:"
209
+ str = gets.chomp
210
+ if str != 'Y'
211
+ puts '-> exit'
212
+ exit
213
+ end
214
+ execute_line_if_not_dry_run("git tag -d #{result}")
215
+ execute_line_if_not_dry_run('git reset --hard HEAD~1')
216
+ execute_line_if_not_dry_run("git push --delete origin #{result}")
217
+ end
218
+
219
+ if __FILE__ == $0
220
+
221
+ if @options[:revert]
222
+ revert_last_bump
223
+ else
224
+ run_bumping_script
225
+ end
226
+
227
+ end