pivotoolz 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +51 -0
- data/LICENSE.txt +21 -0
- data/README.md +144 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/deliver-deployed-stories +10 -0
- data/exe/deliver-story +36 -0
- data/exe/get-story-info-from-id +30 -0
- data/exe/merge +29 -0
- data/exe/post-slack-message +24 -0
- data/exe/stories-deployed +22 -0
- data/exe/story-ids-deployed +24 -0
- data/exe/tag-it +17 -0
- data/lib/pivotoolz.rb +5 -0
- data/lib/pivotoolz/version.rb +3 -0
- data/pivotoolz.gemspec +38 -0
- metadata +132 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: aa29aaa29d023de131d5d30f72546d8932426390
|
4
|
+
data.tar.gz: 68ef16bf42bab12f8db92d0a8d953dc5a7d20ded
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 88beb076fadf9cf742cdc3f41d5f012e7e497358eb9302a629039e9cf51091637fb9a32ce790bdfb1aae8a152f45de4348659bc30e994930b89d85acba3082b6
|
7
|
+
data.tar.gz: 4b6ff5b8cc673dbee17244623038a0fe605064825172178ca057d249c2bbc94ea1fee3b015059207cdee1588c19b0a79d3a290457e81656bff8a73cf601033bb
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at pair+sufyanadam@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
pivotoolz (0.1.1)
|
5
|
+
rest-client (~> 2.0.2)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
diff-lcs (1.3)
|
11
|
+
domain_name (0.5.20170404)
|
12
|
+
unf (>= 0.0.5, < 1.0.0)
|
13
|
+
http-cookie (1.0.3)
|
14
|
+
domain_name (~> 0.5)
|
15
|
+
mime-types (3.1)
|
16
|
+
mime-types-data (~> 3.2015)
|
17
|
+
mime-types-data (3.2016.0521)
|
18
|
+
netrc (0.11.0)
|
19
|
+
rake (10.4.2)
|
20
|
+
rest-client (2.0.2)
|
21
|
+
http-cookie (>= 1.0.2, < 2.0)
|
22
|
+
mime-types (>= 1.16, < 4.0)
|
23
|
+
netrc (~> 0.8)
|
24
|
+
rspec (3.6.0)
|
25
|
+
rspec-core (~> 3.6.0)
|
26
|
+
rspec-expectations (~> 3.6.0)
|
27
|
+
rspec-mocks (~> 3.6.0)
|
28
|
+
rspec-core (3.6.0)
|
29
|
+
rspec-support (~> 3.6.0)
|
30
|
+
rspec-expectations (3.6.0)
|
31
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
+
rspec-support (~> 3.6.0)
|
33
|
+
rspec-mocks (3.6.0)
|
34
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
35
|
+
rspec-support (~> 3.6.0)
|
36
|
+
rspec-support (3.6.0)
|
37
|
+
unf (0.1.4)
|
38
|
+
unf_ext
|
39
|
+
unf_ext (0.0.7.4)
|
40
|
+
|
41
|
+
PLATFORMS
|
42
|
+
ruby
|
43
|
+
|
44
|
+
DEPENDENCIES
|
45
|
+
bundler (~> 1.16)
|
46
|
+
pivotoolz!
|
47
|
+
rake (~> 10.0)
|
48
|
+
rspec (~> 3.0)
|
49
|
+
|
50
|
+
BUNDLED WITH
|
51
|
+
1.16.1
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Sufyan Adam
|
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,144 @@
|
|
1
|
+
# Pivotoolz
|
2
|
+
|
3
|
+
Ever forget to deliver a story while waiting for your continuous
|
4
|
+
deployment build to go green and deployment to finish? Never let
|
5
|
+
another story slip through the cracks into production again with
|
6
|
+
Pivotoolz! Ever wish stories would deliver themselves on successful
|
7
|
+
deployment? This gem is for you!
|
8
|
+
|
9
|
+
Pivotoolz is a set of tools to automate your development process when
|
10
|
+
using Pivotal Tracker for managing your backlog. Save yourself time
|
11
|
+
and increase your productivity. Use the tools individually or compose
|
12
|
+
them together to automate anything related to pivotal tracker stories.
|
13
|
+
|
14
|
+
## Installation
|
15
|
+
|
16
|
+
Add this line to your application's Gemfile:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
gem 'pivotoolz'
|
20
|
+
```
|
21
|
+
|
22
|
+
And then execute:
|
23
|
+
|
24
|
+
$ bundle
|
25
|
+
|
26
|
+
Or install it yourself as:
|
27
|
+
|
28
|
+
$ gem install pivotoolz
|
29
|
+
|
30
|
+
## Usage
|
31
|
+
|
32
|
+
Pivotoolz is a collection of tiny programs that can be used individually
|
33
|
+
or composed together for more powerful features. The manner of usage of
|
34
|
+
each is described below:
|
35
|
+
|
36
|
+
### `deliver-deployed-stories`
|
37
|
+
|
38
|
+
Deliver all stories that have been deployed to the given
|
39
|
+
environment since the previous and last deployment.
|
40
|
+
|
41
|
+
Example:
|
42
|
+
`bundle exec deliver-deployed-stories ENVIRONMENT`
|
43
|
+
|
44
|
+
Where `ENVIRONMENT` is the environment you consider to be where stories
|
45
|
+
can be accepted/rejected.
|
46
|
+
|
47
|
+
Example:
|
48
|
+
Let's say we have an `acceptance` environment where we deploy our app to
|
49
|
+
test out stories. As long as we label our deployed git SHAs with tags
|
50
|
+
(using `tag-it`), we can automatically deliver any finished stories
|
51
|
+
that went out in the last deployment by simply running the command:
|
52
|
+
|
53
|
+
`bundle exec deliver-deployed-stories acceptance`
|
54
|
+
|
55
|
+
### `deliver-story`
|
56
|
+
|
57
|
+
Deliver a given story provided in JSON format. The minimum JSON attributes
|
58
|
+
required are `id` and `current_state`
|
59
|
+
|
60
|
+
Typically used with output from `get-story-info-from-id` piped in.
|
61
|
+
|
62
|
+
Example:
|
63
|
+
`bundle exec get-story-info-from-id STORY_ID | bundle exec deliver-story`
|
64
|
+
OR
|
65
|
+
`bundle exec deliver-story '{"id": 123, "current_state": "finished"}'`
|
66
|
+
|
67
|
+
If `current_state` is not `finished`, the story will not be delivered.
|
68
|
+
|
69
|
+
### `stories-deployed`
|
70
|
+
|
71
|
+
Returns a list of all stories deployed to a given environment.
|
72
|
+
|
73
|
+
Output is of the form:
|
74
|
+
|
75
|
+
STORY_TITLE:
|
76
|
+
LINK_TO_STORY
|
77
|
+
|
78
|
+
STORY_TITLE:
|
79
|
+
LINK_TO_STORY
|
80
|
+
|
81
|
+
Example:
|
82
|
+
```
|
83
|
+
bundle exec stories-deployed production
|
84
|
+
# Output:
|
85
|
+
|
86
|
+
Update README:
|
87
|
+
https://www.pivotaltracker.com/story/show/123
|
88
|
+
|
89
|
+
Update dependencies
|
90
|
+
https://www.pivotaltracker.com/story/show/456
|
91
|
+
|
92
|
+
```
|
93
|
+
|
94
|
+
Use with `post-slack-message` to post a message in a slack deployment channel
|
95
|
+
with the list of stories that just got deployed.
|
96
|
+
|
97
|
+
### `post-slack-message`
|
98
|
+
|
99
|
+
Post a message to a slack channel. You will need to [setup
|
100
|
+
a webhook integration](https://api.slack.com/incoming-webhooks) on slack first.
|
101
|
+
Once you have done so, copy your Webhook URL into
|
102
|
+
an environment variable `SLACK_WEBHOOK_URL`.
|
103
|
+
If the `SLACK_WEBHOOK_URL` has been defined correctly, you will
|
104
|
+
be able to post a message in slack to any channel as follows:
|
105
|
+
`bundle exec post-slack-message CHANNEL "MESSAGE_TEXT"`
|
106
|
+
Where CHANNEL is of the form "#channel" or "@user".
|
107
|
+
|
108
|
+
You can also pipe a message to the `post-slack-message` program. For
|
109
|
+
example:
|
110
|
+
`{ echo Stories deployed to production:; bundle exec stories-deployed production; } | bundle exec post-slack-message '#production-deploys'`
|
111
|
+
|
112
|
+
### `story-ids-deployed`
|
113
|
+
|
114
|
+
Returns a newline delimited list of all story ids deployed
|
115
|
+
to the given environment.
|
116
|
+
|
117
|
+
Example:
|
118
|
+
```
|
119
|
+
bundle exec story-ids-deployed production
|
120
|
+
|
121
|
+
# Output:
|
122
|
+
123
|
123
|
+
456
|
124
|
+
|
125
|
+
```
|
126
|
+
|
127
|
+
|
128
|
+
## Development
|
129
|
+
|
130
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
131
|
+
|
132
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
133
|
+
|
134
|
+
## Contributing
|
135
|
+
|
136
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/sufyanadam/pivotoolz. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
137
|
+
|
138
|
+
## License
|
139
|
+
|
140
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
141
|
+
|
142
|
+
## Code of Conduct
|
143
|
+
|
144
|
+
Everyone interacting in the Pivotoolz project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/sufyanadam/pivotoolz/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "pivotoolz"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
environment_tag = ARGV[0]&.strip
|
4
|
+
|
5
|
+
if environment_tag.nil? || environment_tag.empty?
|
6
|
+
puts "Usage: deliver-deployed-stories ENVIRONMENT"
|
7
|
+
exit 1
|
8
|
+
end
|
9
|
+
|
10
|
+
puts `story-ids-deployed #{environment_tag} | get-story-info-from-id | deliver-story`
|
data/exe/deliver-story
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require('json')
|
4
|
+
require('ostruct')
|
5
|
+
require('rest-client')
|
6
|
+
|
7
|
+
stream = ARGV.any? ? ARGV : ARGF
|
8
|
+
if stream == ARGF && $stdin.tty?
|
9
|
+
puts "Usage: deliver-story STORY_INFO_JSON"
|
10
|
+
puts "Examples:\n deliver-story '{\"id\":123,\"current_state\":\"started\"}'"
|
11
|
+
puts %Q[ echo '{"id":123,"current_state":"started"}' | deliver-story]
|
12
|
+
exit 1
|
13
|
+
end
|
14
|
+
|
15
|
+
stream.each do |story_hash|
|
16
|
+
story = OpenStruct.new(JSON.parse(story_hash))
|
17
|
+
story_state = story.current_state
|
18
|
+
if story_state != 'finished'
|
19
|
+
puts "Story #{story.id} is not finished, not delivering"
|
20
|
+
next
|
21
|
+
end
|
22
|
+
|
23
|
+
story_url = "https://www.pivotaltracker.com/services/v5/stories/#{story.id}"
|
24
|
+
begin
|
25
|
+
response = RestClient::Request.execute(
|
26
|
+
method: :put,
|
27
|
+
url: story_url,
|
28
|
+
payload: {current_state: 'delivered'},
|
29
|
+
headers: {'X-TrackerToken' => ENV['PIVOTAL_TRACKER_API_TOKEN']}
|
30
|
+
)
|
31
|
+
|
32
|
+
puts response
|
33
|
+
rescue RestClient::Exception => e
|
34
|
+
puts "Error delivering story #{story.id}, #{e.message}:\n#{e.backtrace.join("\n")}"
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'open-uri'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
def get_story_info(story_id)
|
7
|
+
return nil if story_id.empty?
|
8
|
+
|
9
|
+
begin
|
10
|
+
open("https://www.pivotaltracker.com/services/v5/stories/#{story_id}", 'X-TrackerToken' => ENV['PIVOTAL_TRACKER_API_TOKEN']).read
|
11
|
+
rescue StandardError => e
|
12
|
+
JSON.generate({error: "could not get story info for story #{story_id}: #{e.message}\nstory info may be available at https://www.pivotaltracker.com/story/show/#{story_id}"})
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
stream = ARGV.any? ? ARGV : ARGF
|
17
|
+
|
18
|
+
if stream == ARGF && $stdin.tty?
|
19
|
+
puts "Usage:\nget-story-info-from-id STORY_ID\n"
|
20
|
+
puts " OR\n"
|
21
|
+
puts "echo STORY_ID | get-story-info-from-id"
|
22
|
+
exit 1
|
23
|
+
end
|
24
|
+
|
25
|
+
infos = stream.reduce([]) do |reduced, story_id|
|
26
|
+
next reduced unless story_id && story_id =~ /\d+/
|
27
|
+
reduced << get_story_info(story_id.strip)
|
28
|
+
end
|
29
|
+
|
30
|
+
puts infos.join("\n")
|
data/exe/merge
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
target_branch = ARGV[0]&.strip
|
4
|
+
|
5
|
+
if target_branch.nil? || target_branch.empty?
|
6
|
+
puts "You must provide a target branch name!"
|
7
|
+
exit 1
|
8
|
+
end
|
9
|
+
|
10
|
+
current_branch = `git rev-parse --abbrev-ref HEAD`.strip
|
11
|
+
branch_to_merge = current_branch
|
12
|
+
|
13
|
+
puts "Running git pull origin #{current_branch} --rebase\n\n"
|
14
|
+
|
15
|
+
`git checkout #{target_branch}`
|
16
|
+
`git pull origin #{target_branch} --rebase`
|
17
|
+
|
18
|
+
puts "\nRebasing #{target_branch} into #{branch_to_merge}\n\n"
|
19
|
+
`git checkout #{branch_to_merge}`
|
20
|
+
`git rebase #{target_branch}`
|
21
|
+
|
22
|
+
puts "\nForce pushing #{branch_to_merge}\n\n"
|
23
|
+
`git push origin #{branch_to_merge} -f`
|
24
|
+
|
25
|
+
puts "\nCompleting the merge of #{branch_to_merge} into #{target_branch}\n\n"
|
26
|
+
`git checkout #{target_branch}`
|
27
|
+
`git merge #{branch_to_merge} --no-ff --no-edit`
|
28
|
+
|
29
|
+
puts "\nMerge complete, you must run git push origin #{target_branch} manually to complete the merge\n"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rest-client'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
URL = ENV['SLACK_WEBHOOK_URL']
|
7
|
+
|
8
|
+
channel = ARGV.shift
|
9
|
+
content = ARGV.empty? ? ARGF.read : StringIO.new(ARGV.join("\n")).read
|
10
|
+
exit 0 if content.empty?
|
11
|
+
|
12
|
+
begin
|
13
|
+
RestClient.post(
|
14
|
+
URL,
|
15
|
+
payload: {
|
16
|
+
username: ENV['SLACKBOT_USERNAME'] || 'slackbot',
|
17
|
+
channel: channel,
|
18
|
+
text: content,
|
19
|
+
icon_emoji: ":ghost:"
|
20
|
+
}.to_json
|
21
|
+
)
|
22
|
+
rescue RestClient::Exceptions => e
|
23
|
+
puts "Error posting to slack #{e.message}:\n#{e.backtrace}"
|
24
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
require 'ostruct'
|
5
|
+
|
6
|
+
environment_tag = ARGV[0]&.strip
|
7
|
+
|
8
|
+
if environment_tag.nil? || environment_tag.empty?
|
9
|
+
puts "Usage: stories-deployed ENVIRONMENT"
|
10
|
+
exit 1
|
11
|
+
end
|
12
|
+
|
13
|
+
deployed_story_infos = `story-ids-deployed #{environment_tag} | get-story-info-from-id`
|
14
|
+
|
15
|
+
stories_deployed = deployed_story_infos.split("\n").compact.reduce([]) do |reduced, story_info|
|
16
|
+
story = OpenStruct.new(JSON.parse(story_info))
|
17
|
+
|
18
|
+
reduced << "#{story.error}"
|
19
|
+
reduced << "#{story.name}:\n#{story.url}"
|
20
|
+
end
|
21
|
+
|
22
|
+
puts stories_deployed
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
environment_tag = ARGV[0]&.strip
|
4
|
+
|
5
|
+
if environment_tag.nil? || environment_tag.empty?
|
6
|
+
puts "Usage: story-ids-deployed ENVIRONMENT"
|
7
|
+
exit 1
|
8
|
+
end
|
9
|
+
|
10
|
+
commit_range = `git tag -l #{environment_tag}* | tail -n 2 | tr '\n' ' ' | sed -e 's/ /../'`
|
11
|
+
|
12
|
+
if commit_range.nil? || commit_range.empty?
|
13
|
+
puts "Empty commit range! Are there any commits tagged with #{environment_tag}?"
|
14
|
+
exit 1
|
15
|
+
end
|
16
|
+
|
17
|
+
commit_message_bodies = `git log --pretty=%b #{commit_range}`.strip
|
18
|
+
story_ids = commit_message_bodies.
|
19
|
+
scan(/\[Finishes\s*#(\d+)|,\s*#(\d+)\]|Fixes\s*#(\d+)|,\s*#(\d+)|#(\d+)\]/).
|
20
|
+
flatten.
|
21
|
+
compact.
|
22
|
+
uniq
|
23
|
+
|
24
|
+
puts story_ids.join("\n")
|
data/exe/tag-it
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
tag = ARGV[0]
|
4
|
+
|
5
|
+
if tag
|
6
|
+
timestamp = `date -u +'%Y%m%d%H%M%S'`
|
7
|
+
full_tag = "#{tag}/#{timestamp}"
|
8
|
+
tag_exists = `git log HEAD --no-walk -1 --pretty='%h%d'`.include? "tag: #{tag}"
|
9
|
+
|
10
|
+
if tag_exists
|
11
|
+
puts "Already tagged #{tag}!"
|
12
|
+
exit 0
|
13
|
+
end
|
14
|
+
|
15
|
+
`git tag #{full_tag}`
|
16
|
+
`git push origin #{full_tag}`
|
17
|
+
end
|
data/lib/pivotoolz.rb
ADDED
data/pivotoolz.gemspec
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "pivotoolz/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "pivotoolz"
|
8
|
+
spec.version = Pivotoolz::VERSION
|
9
|
+
spec.authors = ["Sufyan Adam"]
|
10
|
+
spec.email = ["sufyan@sealmail.net"]
|
11
|
+
|
12
|
+
spec.summary = %q{Tools to save you time when working with Pivotal Tracker stories}
|
13
|
+
spec.description = %q{Auto-deliver your finished stories upon successful deployment, find out which stories went out in the last deployment}
|
14
|
+
spec.homepage = "https://github.com/sufyanadam/pivotoolz"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
23
|
+
"public gem pushes."
|
24
|
+
end
|
25
|
+
|
26
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
27
|
+
f.match(%r{^(test|spec|features)/})
|
28
|
+
end
|
29
|
+
spec.bindir = "exe"
|
30
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
|
+
spec.require_paths = ["lib"]
|
32
|
+
|
33
|
+
spec.add_dependency 'rest-client', "~> 2.0.2"
|
34
|
+
|
35
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
36
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
37
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
38
|
+
end
|
metadata
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pivotoolz
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sufyan Adam
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-03-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rest-client
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.0.2
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.0.2
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.16'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.16'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.0'
|
69
|
+
description: Auto-deliver your finished stories upon successful deployment, find out
|
70
|
+
which stories went out in the last deployment
|
71
|
+
email:
|
72
|
+
- sufyan@sealmail.net
|
73
|
+
executables:
|
74
|
+
- deliver-deployed-stories
|
75
|
+
- deliver-story
|
76
|
+
- get-story-info-from-id
|
77
|
+
- merge
|
78
|
+
- post-slack-message
|
79
|
+
- stories-deployed
|
80
|
+
- story-ids-deployed
|
81
|
+
- tag-it
|
82
|
+
extensions: []
|
83
|
+
extra_rdoc_files: []
|
84
|
+
files:
|
85
|
+
- ".gitignore"
|
86
|
+
- ".rspec"
|
87
|
+
- ".travis.yml"
|
88
|
+
- CODE_OF_CONDUCT.md
|
89
|
+
- Gemfile
|
90
|
+
- Gemfile.lock
|
91
|
+
- LICENSE.txt
|
92
|
+
- README.md
|
93
|
+
- Rakefile
|
94
|
+
- bin/console
|
95
|
+
- bin/setup
|
96
|
+
- exe/deliver-deployed-stories
|
97
|
+
- exe/deliver-story
|
98
|
+
- exe/get-story-info-from-id
|
99
|
+
- exe/merge
|
100
|
+
- exe/post-slack-message
|
101
|
+
- exe/stories-deployed
|
102
|
+
- exe/story-ids-deployed
|
103
|
+
- exe/tag-it
|
104
|
+
- lib/pivotoolz.rb
|
105
|
+
- lib/pivotoolz/version.rb
|
106
|
+
- pivotoolz.gemspec
|
107
|
+
homepage: https://github.com/sufyanadam/pivotoolz
|
108
|
+
licenses:
|
109
|
+
- MIT
|
110
|
+
metadata:
|
111
|
+
allowed_push_host: https://rubygems.org
|
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.6.11
|
129
|
+
signing_key:
|
130
|
+
specification_version: 4
|
131
|
+
summary: Tools to save you time when working with Pivotal Tracker stories
|
132
|
+
test_files: []
|