amanuensis 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.env.sample +10 -0
- data/.gitignore +15 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +248 -0
- data/Rakefile +2 -0
- data/amanuensis.gemspec +36 -0
- data/bin/amanuensis +6 -0
- data/lib/amanuensis.rb +41 -0
- data/lib/amanuensis/builder.rb +52 -0
- data/lib/amanuensis/cli.rb +54 -0
- data/lib/amanuensis/code_manager.rb +6 -0
- data/lib/amanuensis/fake.rb +15 -0
- data/lib/amanuensis/fake/code_manager.rb +18 -0
- data/lib/amanuensis/fake/push.rb +10 -0
- data/lib/amanuensis/fake/tracker.rb +11 -0
- data/lib/amanuensis/file.rb +14 -0
- data/lib/amanuensis/file/push.rb +37 -0
- data/lib/amanuensis/generator.rb +87 -0
- data/lib/amanuensis/github.rb +24 -0
- data/lib/amanuensis/github/code_manager.rb +42 -0
- data/lib/amanuensis/github/push.rb +27 -0
- data/lib/amanuensis/github/tracker.rb +33 -0
- data/lib/amanuensis/issue.rb +4 -0
- data/lib/amanuensis/logger.rb +26 -0
- data/lib/amanuensis/mail.rb +18 -0
- data/lib/amanuensis/mail/push.rb +12 -0
- data/lib/amanuensis/pivotal.rb +17 -0
- data/lib/amanuensis/pivotal/tracker.rb +18 -0
- data/lib/amanuensis/pull.rb +4 -0
- data/lib/amanuensis/push.rb +5 -0
- data/lib/amanuensis/release.rb +4 -0
- data/lib/amanuensis/tracker.rb +7 -0
- data/lib/amanuensis/trello.rb +19 -0
- data/lib/amanuensis/trello/tracker.rb +31 -0
- data/lib/amanuensis/validatable.rb +34 -0
- data/lib/amanuensis/version.rb +26 -0
- data/spec/fixtures/vcr_cassettes/github/amanuensis_generates_a_github_changelog_and_release.yml +550 -0
- data/spec/fixtures/vcr_cassettes/pivotal/amanuensis_generates_a_changelog_from_pivotal_tracker.yml +120 -0
- data/spec/fixtures/vcr_cassettes/trello/amanuensis_generates_a_changelog_from_trello_tracker.yml +359 -0
- data/spec/integrations/file_spec.rb +19 -0
- data/spec/integrations/github_spec.rb +16 -0
- data/spec/integrations/mail_spec.rb +16 -0
- data/spec/integrations/pivotal_spec.rb +16 -0
- data/spec/integrations/trello_spec.rb +18 -0
- data/spec/spec_helper.rb +37 -0
- data/spec/unit/fake_spec.rb +13 -0
- metadata +300 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f6d31e90bdbc3a3fd422124fc0429c1b0895dd8e
|
4
|
+
data.tar.gz: ca8759f8ae3ae360e3bfba91925c4935f684f2ba
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4d4043f7916c87e5718a69fbc1d020ce4ec4318bd863b166f1b0e0a52a86dfdb0281cd20c275dd974c9fe10fe7690ece1a1c2f6db0bb6824832f1a2d0fbcac7d
|
7
|
+
data.tar.gz: dd4a6deb5bf917d7e74f1e0aa4ab54834a4f9f44bc8a5b27b1a89e4269e28810a47a09b7b213411f476aaef824b5cf60beede42ebf793527918c8e6c0314ec53
|
data/.env.sample
ADDED
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Anthony Laibe
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,248 @@
|
|
1
|
+
# Amanuensis
|
2
|
+
|
3
|
+
Amanuensis is a changelog generator which integrate with all the major code managers and trackers
|
4
|
+
|
5
|
+
Your changelog will contains closed issues and pull requests based on the
|
6
|
+
tracker you are using.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
gem 'amanuensis'
|
14
|
+
```
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
$ bundle
|
19
|
+
|
20
|
+
Or install it yourself as:
|
21
|
+
|
22
|
+
$ gem install amanuensis
|
23
|
+
|
24
|
+
## Usage via command line
|
25
|
+
|
26
|
+
Type ```amanuensis help generate``` for detailed usage.
|
27
|
+
```
|
28
|
+
Usage:
|
29
|
+
amanuensis generate
|
30
|
+
|
31
|
+
Options:
|
32
|
+
p, [--push=one two three]
|
33
|
+
# Default: [:file]
|
34
|
+
t, [--tracker=TRACKER]
|
35
|
+
# Default: github
|
36
|
+
c, [--code-manager=CODE_MANAGER]
|
37
|
+
# Default: github
|
38
|
+
u, [--version=VERSION]
|
39
|
+
# Default: patch
|
40
|
+
v, [--verbose], [--no-verbose]
|
41
|
+
g, [--github=key:value]
|
42
|
+
c, [--trello=key:value]
|
43
|
+
i, [--pivotal=key:value]
|
44
|
+
m, [--mail=key:value]
|
45
|
+
f, [--file=key:value]
|
46
|
+
|
47
|
+
Generate a changelog
|
48
|
+
```
|
49
|
+
|
50
|
+
Type ``` amanuensis generate [options]``` to generate the changelog
|
51
|
+
|
52
|
+
|
53
|
+
## Usage via ruby
|
54
|
+
|
55
|
+
Just call the method ```#generate```
|
56
|
+
```ruby
|
57
|
+
Amanuensis.generate
|
58
|
+
```
|
59
|
+
|
60
|
+
Before calling the generator you need to configure it:
|
61
|
+
```ruby
|
62
|
+
Amanuensis.push = [:github]
|
63
|
+
|
64
|
+
Amanuensis::Github.oauth_token = ENV.fetch('GITHUB_OAUTH_TOKEN')
|
65
|
+
Amanuensis::Github.repo = ENV.fetch('GITHUB_REPO')
|
66
|
+
```
|
67
|
+
|
68
|
+
Each integrations are configurable, just like ```Amanuensis```
|
69
|
+
|
70
|
+
For ```Amanuensis```, it is possible to set:
|
71
|
+
* push
|
72
|
+
* code_manager
|
73
|
+
* tracker
|
74
|
+
* version
|
75
|
+
* verbose
|
76
|
+
|
77
|
+
```ruby
|
78
|
+
Amanuensis.push = [:github, :file, :mail]
|
79
|
+
Amanuensis.tracker = :github
|
80
|
+
Amanuensis.code_manager = :github
|
81
|
+
Amanuensis.version = :major
|
82
|
+
Amanuensis.verbose = true
|
83
|
+
```
|
84
|
+
|
85
|
+
See below for all integrations available and their respective configuration
|
86
|
+
|
87
|
+
## Version
|
88
|
+
|
89
|
+
The allowed values for version are:
|
90
|
+
* major
|
91
|
+
* minor
|
92
|
+
* patch
|
93
|
+
|
94
|
+
And it works like that:
|
95
|
+
```
|
96
|
+
major.minor.patch
|
97
|
+
```
|
98
|
+
|
99
|
+
If there is not release the first version will be:
|
100
|
+
```
|
101
|
+
0.0.1
|
102
|
+
```
|
103
|
+
|
104
|
+
## Integrations
|
105
|
+
|
106
|
+
### Code managers
|
107
|
+
|
108
|
+
If you don't specify any code managers, ```github``` will be used by default
|
109
|
+
|
110
|
+
#### Github
|
111
|
+
|
112
|
+
If you use github as a code manager, a github release will be created at the end of the process
|
113
|
+
The changelog will also contains all pull requests closed since the latest release
|
114
|
+
|
115
|
+
Via command line:
|
116
|
+
```
|
117
|
+
amanuensis generator --github=oauth_token:my_token repo:alaibe/amanuensis
|
118
|
+
```
|
119
|
+
|
120
|
+
Via Ruby:
|
121
|
+
```ruby
|
122
|
+
Amanuensis::Github.oauth_token = ENV.fetch('GITHUB_OAUTH_TOKEN')
|
123
|
+
Amanuensis::Github.repo = ENV.fetch('GITHUB_REPO')
|
124
|
+
```
|
125
|
+
|
126
|
+
### Trackers
|
127
|
+
|
128
|
+
If you don't specify any traker, ```github``` will be used by default
|
129
|
+
|
130
|
+
#### Github
|
131
|
+
|
132
|
+
If github is used, the changelog will contains the closed issues since the last release
|
133
|
+
|
134
|
+
Via command line:
|
135
|
+
```
|
136
|
+
amanuensis generator --github=oauth_token:my_token repo:alaibe/amanuensis
|
137
|
+
```
|
138
|
+
|
139
|
+
Via Ruby:
|
140
|
+
```ruby
|
141
|
+
Amanuensis::Github.oauth_token = ENV.fetch('GITHUB_OAUTH_TOKEN')
|
142
|
+
Amanuensis::Github.repo = ENV.fetch('GITHUB_REPO')
|
143
|
+
```
|
144
|
+
|
145
|
+
#### Trello
|
146
|
+
|
147
|
+
If trello is used, the changelog will contains the closed cards since the last release
|
148
|
+
|
149
|
+
Via command line:
|
150
|
+
```
|
151
|
+
amanuensis generator --trello=key:my_key token:my_token board:amanuensis list:done
|
152
|
+
```
|
153
|
+
|
154
|
+
Via Ruby:
|
155
|
+
```ruby
|
156
|
+
Amanuensis::Trello.key = ENV.fetch('TRELLO_KEY')
|
157
|
+
Amanuensis::Trello.token = ENV.fetch('TRELLO_TOKEN')
|
158
|
+
Amanuensis::Trello.board = ENV.fetch('TRELLO_BOARD')
|
159
|
+
Amanuensis::Trello.list = ENV.fetch('TRELLO_LIST')
|
160
|
+
```
|
161
|
+
|
162
|
+
#### Pivotal tracker
|
163
|
+
|
164
|
+
If pivotal is used, the changelog will contains the accepted cards since the last release
|
165
|
+
|
166
|
+
Via command line:
|
167
|
+
```
|
168
|
+
amanuensis generator --pivotal=token:my_token project:amanuensis
|
169
|
+
```
|
170
|
+
|
171
|
+
Via Ruby:
|
172
|
+
```ruby
|
173
|
+
Amanuensis::Pivotal.token = ENV.fetch('PIVOTAL_TOKEN')
|
174
|
+
Amanuensis::Pivotal.project = ENV.fetch('PIVOTAL_PROJECT')
|
175
|
+
```
|
176
|
+
|
177
|
+
### Push
|
178
|
+
|
179
|
+
If you don't specify any push, ```file``` will be used by default
|
180
|
+
|
181
|
+
Push is different from others integrations as you can chain them:
|
182
|
+
```ruby
|
183
|
+
Amanuensis.push = [:github, :mail, :file]
|
184
|
+
```
|
185
|
+
|
186
|
+
This configuration will publish the changelog to your github repository, send an
|
187
|
+
e-mail with the changelog as a body and finaly produce a changelog file
|
188
|
+
|
189
|
+
##### Github
|
190
|
+
|
191
|
+
If you use github to push your changelog, it will be append to the file named Changelog.md by default
|
192
|
+
|
193
|
+
Via command line:
|
194
|
+
```
|
195
|
+
amanuensis generator --github=oauth_token:my_token repo:alaibe/amanuensis
|
196
|
+
file_name:new_changelog.md
|
197
|
+
```
|
198
|
+
|
199
|
+
Via Ruby:
|
200
|
+
```ruby
|
201
|
+
Amanuensis::Github.oauth_token = ENV.fetch('GITHUB_OAUTH_TOKEN')
|
202
|
+
Amanuensis::Github.repo = ENV.fetch('GITHUB_REPO')
|
203
|
+
Amanuensis::Github.file_name = ENV.fetch('GITHUB_FILE_NAME')
|
204
|
+
```
|
205
|
+
|
206
|
+
The option ```file_name``` is not required and is set to ```Changelog.md``` by default
|
207
|
+
|
208
|
+
##### Mail
|
209
|
+
|
210
|
+
We use the gem pony in order to send mail
|
211
|
+
See the gem readme for all the options available: https://github.com/benprew/pony
|
212
|
+
|
213
|
+
Via command line:
|
214
|
+
```
|
215
|
+
amanuensis generator --mail=to:anthony@amanuensis.com
|
216
|
+
```
|
217
|
+
|
218
|
+
Via Ruby:
|
219
|
+
```ruby
|
220
|
+
Amanuensis::Mail.pony = { to: 'anthony@amanuensis.com' }
|
221
|
+
```
|
222
|
+
|
223
|
+
##### File
|
224
|
+
|
225
|
+
If you export push your changelog with the file option, it will create a file named ```Changelog.md``` by default
|
226
|
+
|
227
|
+
```
|
228
|
+
amanuensis generator --file=file_name:new_changelog.md
|
229
|
+
```
|
230
|
+
|
231
|
+
Via Ruby:
|
232
|
+
```ruby
|
233
|
+
Amanuensis::File.file_name = 'new_changelog.md'
|
234
|
+
```
|
235
|
+
|
236
|
+
The option ```file_name``` is not required and is set to ```Changelog.md``` by default
|
237
|
+
|
238
|
+
## Ask for new integration
|
239
|
+
|
240
|
+
If you want new integration you can create an issue via github and add the label integration on it.
|
241
|
+
|
242
|
+
## Contributing
|
243
|
+
|
244
|
+
1. Fork it ( https://github.com/alaibe/amanuensis/fork )
|
245
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
246
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
247
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
248
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/amanuensis.gemspec
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'amanuensis/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "amanuensis"
|
8
|
+
spec.version = Amanuensis::VERSION
|
9
|
+
spec.authors = ["Anthony Laibe"]
|
10
|
+
spec.email = ["anthony@laibe.cc"]
|
11
|
+
spec.summary = %q{Amanuensis is a changelog generator}
|
12
|
+
spec.description = %q{Amanuensis is a changelog generator which integrate with all the major code managers and trackers}
|
13
|
+
spec.homepage = "http://alaibe.github.io/amanuensis"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "octokit", '~>3.8'
|
22
|
+
spec.add_dependency "pony", '~>1.11'
|
23
|
+
spec.add_dependency "activesupport", '~>4.2'
|
24
|
+
spec.add_dependency "interchange", '~>0.1'
|
25
|
+
spec.add_dependency "thor", '~>0.19'
|
26
|
+
spec.add_dependency "ruby-trello", '~>1.2'
|
27
|
+
spec.add_dependency "tracker_api", '~>0.2'
|
28
|
+
|
29
|
+
spec.add_development_dependency "bundler", '~>1.9'
|
30
|
+
spec.add_development_dependency "rake", '~>10.4'
|
31
|
+
spec.add_development_dependency "rspec", '~>3.2'
|
32
|
+
spec.add_development_dependency "vcr", '~>2.9'
|
33
|
+
spec.add_development_dependency "webmock", '~>1.21'
|
34
|
+
spec.add_development_dependency "dotenv", '~>2.0'
|
35
|
+
spec.add_development_dependency "pry-byebug", '~>3.1'
|
36
|
+
end
|
data/bin/amanuensis
ADDED
data/lib/amanuensis.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'interchange'
|
2
|
+
require 'thor'
|
3
|
+
require 'active_support/core_ext/object/blank'
|
4
|
+
require 'active_support/configurable'
|
5
|
+
|
6
|
+
require_relative 'amanuensis/version'
|
7
|
+
require_relative 'amanuensis/validatable'
|
8
|
+
require_relative 'amanuensis/cli'
|
9
|
+
require_relative 'amanuensis/generator'
|
10
|
+
require_relative 'amanuensis/builder'
|
11
|
+
require_relative 'amanuensis/logger'
|
12
|
+
require_relative 'amanuensis/push'
|
13
|
+
require_relative 'amanuensis/code_manager'
|
14
|
+
require_relative 'amanuensis/tracker'
|
15
|
+
require_relative 'amanuensis/issue'
|
16
|
+
require_relative 'amanuensis/pull'
|
17
|
+
require_relative 'amanuensis/release'
|
18
|
+
|
19
|
+
require_relative 'amanuensis/fake'
|
20
|
+
require_relative 'amanuensis/github'
|
21
|
+
require_relative 'amanuensis/trello'
|
22
|
+
require_relative 'amanuensis/pivotal'
|
23
|
+
require_relative 'amanuensis/mail'
|
24
|
+
require_relative 'amanuensis/file'
|
25
|
+
|
26
|
+
module Amanuensis
|
27
|
+
include ActiveSupport::Configurable
|
28
|
+
include Validatable
|
29
|
+
|
30
|
+
config_accessor(:push) { [:file] }
|
31
|
+
config_accessor(:tracker) { :github }
|
32
|
+
config_accessor(:code_manager) { :github }
|
33
|
+
config_accessor(:verbose) { false }
|
34
|
+
config_accessor(:version) { :patch }
|
35
|
+
|
36
|
+
validate_presence_of :push, :tracker, :code_manager, :version
|
37
|
+
|
38
|
+
def self.generate
|
39
|
+
Generator.new.run!
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module Amanuensis
|
2
|
+
class Builder < Struct.new(:version, :from)
|
3
|
+
|
4
|
+
def build
|
5
|
+
add_header
|
6
|
+
add_issues if issues.any?
|
7
|
+
add_pulls if pulls.any?
|
8
|
+
|
9
|
+
changelog
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def changelog
|
15
|
+
@changelog ||= ''
|
16
|
+
end
|
17
|
+
|
18
|
+
def add_header
|
19
|
+
changelog << "## #{version}-#{Time.now.strftime('%d/%m/%Y %H:%M:%S')}\n"
|
20
|
+
changelog << "\n"
|
21
|
+
end
|
22
|
+
|
23
|
+
def add_issues
|
24
|
+
changelog << "**Issues closed:**\n"
|
25
|
+
|
26
|
+
issues.each do |issue|
|
27
|
+
changelog << "* [##{issue.number}](#{issue.html_url}) #{issue.title}\n"
|
28
|
+
end
|
29
|
+
|
30
|
+
changelog << "\n"
|
31
|
+
end
|
32
|
+
|
33
|
+
def add_pulls
|
34
|
+
changelog << "**Pull requests closed:**\n"
|
35
|
+
|
36
|
+
pulls.each do |pull|
|
37
|
+
changelog << "* [##{pull.number}](#{pull.html_url}) #{pull.title}\n"
|
38
|
+
end
|
39
|
+
|
40
|
+
changelog << "\n"
|
41
|
+
end
|
42
|
+
|
43
|
+
def issues
|
44
|
+
@issues ||= Tracker.issues(from)
|
45
|
+
end
|
46
|
+
|
47
|
+
def pulls
|
48
|
+
@pulls ||= CodeManager.pulls(from)
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|