jenkins_pivotal_release_notes 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +37 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gaurdfile +8 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +47 -0
- data/Rakefile +1 -0
- data/bin/jenkins_pivotal_release_notes +8 -0
- data/jenkins_pivotal_release_notes.gemspec +28 -0
- data/lib/jenkins_pivotal_release_notes.rb +6 -0
- data/lib/jenkins_pivotal_release_notes/agent.rb +110 -0
- data/lib/jenkins_pivotal_release_notes/cli.rb +36 -0
- data/lib/jenkins_pivotal_release_notes/version.rb +3 -0
- data/spec/jenkins_pivotal_release_notes_spec.rb +11 -0
- data/spec/spec_helper.rb +2 -0
- metadata +134 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2be5f50c4a61255eb8ca3d37330de8bb4fe760e3
|
4
|
+
data.tar.gz: b28c5f17223fab1b94322e698c76d7e10e75576d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5e6dabcceb2d65e4d5b04dc6ef8748fbc714592595c1fbf5698b2510da9b3175b9d9ac7ad3c28884adeb7c4bd34e93ba25a76d21b7898ba2d7e4f82c26d5679f
|
7
|
+
data.tar.gz: e831e4d4ec79ce68be7e9e5502c381b82ce4e5f2f36c08bd873ee9702ea14dac0c11b496e419ba73c07c34d7f791676bf83d244bb1f7dfbcac840c01ef04db9f
|
data/.gitignore
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
*.swp
|
4
|
+
.DS_Store
|
5
|
+
/.config
|
6
|
+
/coverage/
|
7
|
+
/InstalledFiles
|
8
|
+
/pkg/
|
9
|
+
/spec/reports/
|
10
|
+
/test/tmp/
|
11
|
+
/test/version_tmp/
|
12
|
+
/tmp/
|
13
|
+
|
14
|
+
## Specific to RubyMotion:
|
15
|
+
.dat*
|
16
|
+
.repl_history
|
17
|
+
build/
|
18
|
+
|
19
|
+
## Documentation cache and generated files:
|
20
|
+
/.yardoc/
|
21
|
+
/_yardoc/
|
22
|
+
/doc/
|
23
|
+
/rdoc/
|
24
|
+
|
25
|
+
## Environment normalisation:
|
26
|
+
/.bundle/
|
27
|
+
/vendor/bundle
|
28
|
+
/lib/bundler/man/
|
29
|
+
|
30
|
+
# for a library or gem, you might want to ignore these files since the code is
|
31
|
+
# intended to run in multiple environments; otherwise, check them in:
|
32
|
+
# Gemfile.lock
|
33
|
+
# .ruby-version
|
34
|
+
# .ruby-gemset
|
35
|
+
|
36
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
37
|
+
.rvmrc
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gaurdfile
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Kenny Chapman
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# Jenkins + Pivotal Release Notes
|
2
|
+
|
3
|
+
Generates release notes from Pivotal Tracker
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'jenkins_pivotal_release_notes'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install jenkins_pivotal_release_notes
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
In Jenkins, add a post build step like:
|
24
|
+
|
25
|
+
```
|
26
|
+
jenkins_pivotal --token a1b2c3 --project 1234 --date 05/01/2015 --file /Users/username/release_notes.txt
|
27
|
+
```
|
28
|
+
|
29
|
+
Help output is as follows.
|
30
|
+
|
31
|
+
```
|
32
|
+
Usage: bin/jenkins_pivotal_release_notes [options...]
|
33
|
+
-t, --token Tracker API token.
|
34
|
+
-p, --project Tracker Project ID.
|
35
|
+
-d, --date Story fetch date
|
36
|
+
-f, --file Saved file path
|
37
|
+
-v, --version Display version information.
|
38
|
+
-h, --help Display this help message.
|
39
|
+
```
|
40
|
+
|
41
|
+
## Contributing
|
42
|
+
|
43
|
+
1. Fork it ( https://github.com/[my-github-username]/jenkins_pivotal_release_notes/fork )
|
44
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
45
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
46
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
47
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'jenkins_pivotal_release_notes/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "jenkins_pivotal_release_notes"
|
8
|
+
spec.version = JenkinsPivotalReleaseNotes::VERSION
|
9
|
+
spec.authors = ["Kenny Chapman"]
|
10
|
+
spec.email = ["lkchapman@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Pivotal Tracker release notes -> Jenkins}
|
13
|
+
spec.description = %q{Pivotal Tracker release notes -> Jenkins}
|
14
|
+
spec.homepage = "https://github.com/chap19150/jenkins_pivotal_release_notes"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files`.split($/)
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_dependency "slop", "~> 3.4"
|
23
|
+
spec.add_dependency "tracker_api", "~> 0.2.0"
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.9"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
+
spec.add_development_dependency "rspec"
|
28
|
+
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
require 'tracker_api'
|
2
|
+
|
3
|
+
module JenkinsPivotalReleaseNotes
|
4
|
+
class Agent
|
5
|
+
attr_reader :token, :project, :date, :file
|
6
|
+
|
7
|
+
def initialize(options)
|
8
|
+
@token = options[:token]
|
9
|
+
@project = options[:project].to_i
|
10
|
+
@date = options[:date]
|
11
|
+
@file = options[:file]
|
12
|
+
end
|
13
|
+
|
14
|
+
def run!
|
15
|
+
puts date
|
16
|
+
puts file
|
17
|
+
output = ""
|
18
|
+
client = TrackerApi::Client.new(token: token)
|
19
|
+
currentProject = client.project(project)
|
20
|
+
featureStories = currentProject.stories(filter: 'accepted_since:' + date + ' type:Feature')
|
21
|
+
inProgressStories = currentProject.stories(filter: 'state:started state:finished state:delivered type:Feature')
|
22
|
+
bugStories = currentProject.stories(filter: '-state:delivered -state:accepted type:Bug')
|
23
|
+
output.concat(currentProject.name + " Release Notes\n\n")
|
24
|
+
if featureStories.size > 0
|
25
|
+
output.concat("NEWLY COMPLETED FEATURES\n")
|
26
|
+
output.concat("========================\n")
|
27
|
+
for story in featureStories
|
28
|
+
output.concat(story.name + "\n")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
if inProgressStories.size > 0
|
33
|
+
output.concat("IN PROGRESS FEATURES\n")
|
34
|
+
output.concat("====================\n")
|
35
|
+
for story in inProgressStories
|
36
|
+
output.concat(story.name + "\n")
|
37
|
+
end
|
38
|
+
output.concat("\n")
|
39
|
+
end
|
40
|
+
|
41
|
+
if bugStories.size > 0
|
42
|
+
output.concat("KNOWN BUGS\n")
|
43
|
+
output.concat("==========\n")
|
44
|
+
for story in bugStories
|
45
|
+
output.concat(story.name + "\n")
|
46
|
+
end
|
47
|
+
output.concat("\n")
|
48
|
+
end
|
49
|
+
|
50
|
+
File.write(file, output)
|
51
|
+
end
|
52
|
+
|
53
|
+
def changelog_paths
|
54
|
+
# TODO this should be extracted into ChangelogGatherer or something
|
55
|
+
if ENV['CHANGELOG_PATH']
|
56
|
+
return [ ENV['CHANGELOG_PATH'] ]
|
57
|
+
end
|
58
|
+
|
59
|
+
start_from = 1
|
60
|
+
default_changelog = File.join env_variables['JENKINS_HOME'],
|
61
|
+
'jobs', env_variables['JOB_NAME'],
|
62
|
+
'builds', env_variables['BUILD_NUMBER'],
|
63
|
+
'changelog.xml'
|
64
|
+
|
65
|
+
# If it's the first build, there's nothing to gather.
|
66
|
+
if env_variables['BUILD_NUMBER'] == '1'
|
67
|
+
return [ default_changelog ]
|
68
|
+
end
|
69
|
+
|
70
|
+
last_success = File.join env_variables['JENKINS_HOME'],
|
71
|
+
'jobs', env_variables['JOB_NAME'],
|
72
|
+
'builds', 'lastSuccessfulBuild'
|
73
|
+
|
74
|
+
last_success_num = File.readlink last_success
|
75
|
+
if last_success_num != '-1'
|
76
|
+
# If the lastSuccessfulBuild was the previous build then the
|
77
|
+
# changelog will already be adequate.
|
78
|
+
if last_success_num.to_i == env_variables['BUILD_NUMBER'].to_i - 1
|
79
|
+
return [ default_changelog ]
|
80
|
+
else
|
81
|
+
start_from = last_success_num.to_i + 1
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
start_from.upto(env_variables['BUILD_NUMBER'].to_i).map do |i|
|
86
|
+
File.join env_variables['JENKINS_HOME'],
|
87
|
+
'jobs', env_variables['JOB_NAME'],
|
88
|
+
'builds', i.to_s,
|
89
|
+
'changelog.xml'
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
private
|
94
|
+
|
95
|
+
def env_variables
|
96
|
+
ENV
|
97
|
+
end
|
98
|
+
|
99
|
+
def changelog_path
|
100
|
+
if ENV['CHANGELOG_PATH']
|
101
|
+
return ENV['CHANGELOG_PATH']
|
102
|
+
end
|
103
|
+
|
104
|
+
File.join ENV['JENKINS_HOME'],
|
105
|
+
'jobs', ENV['JOB_NAME'],
|
106
|
+
'builds', ENV['BUILD_NUMBER'],
|
107
|
+
'changelog.xml'
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'slop'
|
2
|
+
|
3
|
+
module JenkinsPivotalReleaseNotes
|
4
|
+
class Cli
|
5
|
+
attr_reader :options
|
6
|
+
|
7
|
+
def initialize(items = ARGV)
|
8
|
+
@options = Slop.parse(items, help: true) do
|
9
|
+
banner "Usage: #{$0} [options...]"
|
10
|
+
|
11
|
+
on 't', 'token=', 'Tracker API token.'
|
12
|
+
on 'p', 'project=', 'Tracker Project ID.', as: :integer
|
13
|
+
on 'd', 'date=', 'Story fetch date'
|
14
|
+
on 'f', 'file=', 'Saved file path'
|
15
|
+
on 'v', 'version', 'Display version information.' do
|
16
|
+
puts "#{$0} #{JenkinsPivotal::VERSION}"
|
17
|
+
exit 0
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def run!
|
23
|
+
unless options.token? && options.project?
|
24
|
+
puts @options
|
25
|
+
exit 1
|
26
|
+
end
|
27
|
+
|
28
|
+
Agent.new(
|
29
|
+
token: options[:token],
|
30
|
+
project: options[:project],
|
31
|
+
date: options[:date],
|
32
|
+
file: options[:file],
|
33
|
+
).run!
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jenkins_pivotal_release_notes
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kenny Chapman
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-05-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: slop
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.4'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.4'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: tracker_api
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.2.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.2.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.9'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.9'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: Pivotal Tracker release notes -> Jenkins
|
84
|
+
email:
|
85
|
+
- lkchapman@gmail.com
|
86
|
+
executables:
|
87
|
+
- jenkins_pivotal_release_notes
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- ".gitignore"
|
92
|
+
- ".rspec"
|
93
|
+
- ".travis.yml"
|
94
|
+
- CODE_OF_CONDUCT.md
|
95
|
+
- Gaurdfile
|
96
|
+
- Gemfile
|
97
|
+
- LICENSE.txt
|
98
|
+
- README.md
|
99
|
+
- Rakefile
|
100
|
+
- bin/jenkins_pivotal_release_notes
|
101
|
+
- jenkins_pivotal_release_notes.gemspec
|
102
|
+
- lib/jenkins_pivotal_release_notes.rb
|
103
|
+
- lib/jenkins_pivotal_release_notes/agent.rb
|
104
|
+
- lib/jenkins_pivotal_release_notes/cli.rb
|
105
|
+
- lib/jenkins_pivotal_release_notes/version.rb
|
106
|
+
- spec/jenkins_pivotal_release_notes_spec.rb
|
107
|
+
- spec/spec_helper.rb
|
108
|
+
homepage: https://github.com/chap19150/jenkins_pivotal_release_notes
|
109
|
+
licenses:
|
110
|
+
- MIT
|
111
|
+
metadata: {}
|
112
|
+
post_install_message:
|
113
|
+
rdoc_options: []
|
114
|
+
require_paths:
|
115
|
+
- lib
|
116
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
requirements: []
|
127
|
+
rubyforge_project:
|
128
|
+
rubygems_version: 2.4.5
|
129
|
+
signing_key:
|
130
|
+
specification_version: 4
|
131
|
+
summary: Pivotal Tracker release notes -> Jenkins
|
132
|
+
test_files:
|
133
|
+
- spec/jenkins_pivotal_release_notes_spec.rb
|
134
|
+
- spec/spec_helper.rb
|