pivotal_tracker_pr 0.2.1 → 0.3.0
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 +4 -4
- data/lib/pivotal_tracker_pr/cli.rb +27 -8
- data/lib/pivotal_tracker_pr/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b31214a83e3747a65c01fc9bdce4d4ea2399eeaa
|
|
4
|
+
data.tar.gz: 07176180c76bc00aa6913482b1ca4269673ed41f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b8a2f590cbe8025bdc1c4e494448ca54577bc80d22983e186e81f86539c82ca2386135d4441155f218d3d62b0e2a6477aa6cd10aee439e4a3777c1946bd82987
|
|
7
|
+
data.tar.gz: 7984823b003c0254d33b4f86202202f5075c66c640b3e2e2821e05b1b0da05717bfeafa909a0527f8841b9e1c346088d667e04b640386186cb76484c2763aae0
|
|
@@ -4,7 +4,8 @@ require 'net/http'
|
|
|
4
4
|
require 'thor'
|
|
5
5
|
|
|
6
6
|
module PivotalTrackerPr
|
|
7
|
-
|
|
7
|
+
PULL_REQUEST_MESSAGE = 'PULLREQ_EDITMSG'.freeze
|
|
8
|
+
MESSAGE_TEMPLATE = 'PULLREQ_MSG_TEMPLATE'.freeze
|
|
8
9
|
|
|
9
10
|
class CLI < Thor
|
|
10
11
|
desc 'create', 'Generate pull request use story id / story name.'
|
|
@@ -21,7 +22,6 @@ module PivotalTrackerPr
|
|
|
21
22
|
write_pull_request_template story_id, story_name
|
|
22
23
|
end
|
|
23
24
|
|
|
24
|
-
say 'Done.'
|
|
25
25
|
system 'hub pull-request --browse'
|
|
26
26
|
end
|
|
27
27
|
|
|
@@ -61,15 +61,34 @@ module PivotalTrackerPr
|
|
|
61
61
|
end
|
|
62
62
|
|
|
63
63
|
def write_pull_request_template(story_id, story_name)
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
message_context = if File.exists?(message_template_path)
|
|
65
|
+
message_from_template(story_id, story_name)
|
|
66
|
+
else
|
|
67
|
+
default_message
|
|
68
68
|
end
|
|
69
|
+
|
|
70
|
+
open(pull_request_message, 'w') { |file| file.puts message_context }
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def message_template_path
|
|
74
|
+
File.join(Dir.pwd, '.git', MESSAGE_TEMPLATE)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def message_from_template(story_id, story_name)
|
|
78
|
+
template_content = File.open(message_template_path).read
|
|
79
|
+
template_content.gsub('{{STORY_ID}}', story_id).gsub('{{STORY_NAME}}')
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def pull_request_message
|
|
83
|
+
File.join(Dir.pwd, '.git', PULL_REQUEST_MESSAGE)
|
|
69
84
|
end
|
|
70
85
|
|
|
71
|
-
def
|
|
72
|
-
|
|
86
|
+
def default_message(story_id, story_name)
|
|
87
|
+
<<~EOF
|
|
88
|
+
"[fixed ##{story_id}]#{story_name}"
|
|
89
|
+
"\n"
|
|
90
|
+
"https://www.pivotaltracker.com/story/show/#{story_id}"
|
|
91
|
+
EOF
|
|
73
92
|
end
|
|
74
93
|
end
|
|
75
94
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pivotal_tracker_pr
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- blueplanet
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-06-
|
|
11
|
+
date: 2016-06-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|