pivotal_tracker_pr 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -3
- data/lib/pivotal_tracker_pr/cli.rb +14 -9
- data/lib/pivotal_tracker_pr/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 764f1f12dcd28ae8959347fa7259b1590c93ca63
|
4
|
+
data.tar.gz: dc0e19819bd06dacaf9338554fef4c3838586a4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31e42d12282c81134980118fd7810f4e9b6dc9f221a22afa77772cbd0f3da645e170ea312fee34c6f168655594d6723fc9ee1395fad1e507e1a508aa8716922a
|
7
|
+
data.tar.gz: 22ca5992720e37cb9855337d1abc169d183fd2a69b67b13e7dab9b57dc2cf21bb423481d408c891d672c51f0e13d57169cecb3b564c577d916444de6cac73d69
|
data/README.md
CHANGED
@@ -1,24 +1,34 @@
|
|
1
1
|
# PivotalTrackerPr
|
2
2
|
- `PivotalTracker`のストリーIDとストリー名を取得し、カレントブランチの`PullRequest`を作成する
|
3
3
|
|
4
|
-
##
|
4
|
+
## インストール
|
5
5
|
|
6
6
|
```ruby
|
7
7
|
$ gem install pivotal_tracker_pr
|
8
8
|
```
|
9
9
|
|
10
|
-
##
|
10
|
+
## 使い方
|
11
11
|
- 下記の環境変数を設定しておく
|
12
12
|
- `PT_TOKEN`:`PivotalTracker`のアクセストークン
|
13
13
|
- `PT_PROJECT_ID`:`PivotalTracker`のプロジェクトID
|
14
14
|
- ブランチを作成するとき、`PivotalTracker`のストリーIDを含めるように命名する
|
15
15
|
- `git commit; git push`の後、`PullRequest`を作ろうとするタイミングで、`pivotal_tracker_pr create`を実行する
|
16
16
|
|
17
|
-
|
17
|
+
### PullRequest内容
|
18
|
+
- デフォルト内容
|
19
|
+
|
18
20
|
|コマンド実行後|githubで作成した内容|
|
19
21
|
|--------------|--------------------|
|
20
22
|
|![PullRequest command](https://raw.github.com/wiki/blueplanet/pivotal_tracker_pr/images/pt_pr_cmd.png)|![PullRequest github](https://raw.github.com/wiki/blueplanet/pivotal_tracker_pr/images/pt_pr_github.png)|
|
21
23
|
|
24
|
+
- カスタマイズしたい場合は、`.git/PULLREQ_MSG_TEMPLATE`ファイルに内容を書き出しておけば使われます。
|
25
|
+
- 下記の文字列が置換される
|
26
|
+
|
27
|
+
|置換文字列|置換後の内容|
|
28
|
+
|--------------|--------------------|
|
29
|
+
|{{STORY_ID}}|ストリーのID|
|
30
|
+
|{{STORY_NAME}}|ストリー内容|
|
31
|
+
|{{STORY_LINK}}|ストリーのリンク|
|
22
32
|
|
23
33
|
## TODO
|
24
34
|
- [ ] PullRequestのテンプレートをERBに切り出す
|
@@ -61,11 +61,12 @@ module PivotalTrackerPr
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def write_pull_request_template(story_id, story_name)
|
64
|
-
message_context =
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
64
|
+
message_context =
|
65
|
+
if File.exists?(message_template_path)
|
66
|
+
message_from_template(story_id, story_name)
|
67
|
+
else
|
68
|
+
default_message
|
69
|
+
end
|
69
70
|
|
70
71
|
open(pull_request_message, 'w') { |file| file.puts message_context }
|
71
72
|
end
|
@@ -76,7 +77,7 @@ module PivotalTrackerPr
|
|
76
77
|
|
77
78
|
def message_from_template(story_id, story_name)
|
78
79
|
template_content = File.open(message_template_path).read
|
79
|
-
template_content.gsub('{{STORY_ID}}', story_id).gsub('{{STORY_NAME}}')
|
80
|
+
template_content.gsub('{{STORY_ID}}', story_id).gsub('{{STORY_NAME}}', story_name).gsub('{{STORY_LINK}}', story_link(story_id))
|
80
81
|
end
|
81
82
|
|
82
83
|
def pull_request_message
|
@@ -85,10 +86,14 @@ module PivotalTrackerPr
|
|
85
86
|
|
86
87
|
def default_message(story_id, story_name)
|
87
88
|
<<~EOF
|
88
|
-
|
89
|
-
|
90
|
-
|
89
|
+
[fixed ##{story_id}]#{story_name}
|
90
|
+
|
91
|
+
#{story_link story_id}
|
91
92
|
EOF
|
92
93
|
end
|
94
|
+
|
95
|
+
def story_link(story_id)
|
96
|
+
"https://www.pivotaltracker.com/story/show/#{story_id}"
|
97
|
+
end
|
93
98
|
end
|
94
99
|
end
|