devflow 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +33 -0
- data/bin/pr_template_builder +47 -0
- data/lib/devflow/version.rb +1 -1
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1a93feb149924a07cbc48096e88977ce751699dfb93937c90d8ec825b5c4bf0
|
4
|
+
data.tar.gz: 8a5cbd2fcf3152a56e18d3168c448ce100ce2d1d38a0cc176afb9fde84091c80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4dd282932c5cab478c2aaf94045439c5ce0e8eaee322c0972b23e185561cc2fe3db80f9337c82c884194c60f36c0778046f58083eff64af7fa5135d8f21d4a63
|
7
|
+
data.tar.gz: c8c6d915a9c04f64318ae8789f703cf96bb0ce0010403794963e184e563c21074ac653955d825bf46d444f7eef9c39a557364ba928020e634babd9b90c0c3bef
|
data/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# DevFlow
|
2
|
+
__NOTE:__ This is mainly for my fellow friends at ApoEx.
|
3
|
+
|
4
|
+
## Why?
|
5
|
+
I'm lazy. Like, super lazy. But I also really like the workflow at my current
|
6
|
+
workplace.
|
7
|
+
|
8
|
+
We plan our sprint in TargetProcess and then we name our branches to match the
|
9
|
+
UserStory in TP:
|
10
|
+
`:tp_id-some-descriptive-title`.
|
11
|
+
|
12
|
+
My shortterm memory is really bad, so I always end up going back to TP to see
|
13
|
+
find the ID for the story that I'm working on.
|
14
|
+
|
15
|
+
This gem aims to solve that.
|
16
|
+
|
17
|
+
## How?
|
18
|
+
1. Install the gem.
|
19
|
+
2. The gem reads the settings through evironment variables;
|
20
|
+
* `TP_BASE_URL`
|
21
|
+
* `TP_USER_ID`
|
22
|
+
* `TP_ACCESS_TOKEN`
|
23
|
+
3. run `df` when starting working on a new story
|
24
|
+
4. Profit?
|
25
|
+
|
26
|
+
|
27
|
+
## Bonus
|
28
|
+
Install [hub](https://github.com/github/hub) and add to your .gitconfig;
|
29
|
+
```
|
30
|
+
[alias]
|
31
|
+
p-r = "!pr_template_builder | hub -c core.commentChar=';' pull-request -oe -F -"
|
32
|
+
```
|
33
|
+
Now you can easily create PRs from the commandline!
|
@@ -0,0 +1,47 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "devflow"
|
4
|
+
|
5
|
+
DevFlow::TargetProcess.check_config!
|
6
|
+
|
7
|
+
story_url_base = "#{DevFlow::TargetProcess::BASE_URI}/entity"
|
8
|
+
story_url_pattern = /#{story_url_base}\/(\d+)/
|
9
|
+
story_regex = /^(\d+)-(.*)/
|
10
|
+
fv_regex = /^fv-(.*)/
|
11
|
+
branch = `git rev-parse --abbrev-ref HEAD`
|
12
|
+
pr_templates_paths = %w[
|
13
|
+
.github/PULL_REQUEST_TEMPLATE.md
|
14
|
+
]
|
15
|
+
|
16
|
+
def titleize(str)
|
17
|
+
str.tr("-", " ").capitalize
|
18
|
+
end
|
19
|
+
|
20
|
+
case branch
|
21
|
+
when story_regex
|
22
|
+
story_id = $1
|
23
|
+
story_url = story_url_base + "/" + story_id
|
24
|
+
title = "[#{story_id}] #{titleize($2)}"
|
25
|
+
when fv_regex
|
26
|
+
story_url = ""
|
27
|
+
title = "[FV] #{titleize($1)}"
|
28
|
+
else
|
29
|
+
story_url = ""
|
30
|
+
title = titleize(branch)
|
31
|
+
end
|
32
|
+
|
33
|
+
message = if (file = pr_templates_paths.find { |p| File.exist?(p) })
|
34
|
+
<<~MESS
|
35
|
+
#{title}
|
36
|
+
|
37
|
+
#{File.read(file).gsub(story_url_pattern, story_url)}
|
38
|
+
MESS
|
39
|
+
else
|
40
|
+
<<~MESS
|
41
|
+
#{title}
|
42
|
+
|
43
|
+
#{story_url}
|
44
|
+
MESS
|
45
|
+
end
|
46
|
+
|
47
|
+
puts message
|
data/lib/devflow/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devflow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Micke Lisinge
|
@@ -43,6 +43,7 @@ email:
|
|
43
43
|
- hi@micke.me
|
44
44
|
executables:
|
45
45
|
- df
|
46
|
+
- pr_template_builder
|
46
47
|
extensions: []
|
47
48
|
extra_rdoc_files: []
|
48
49
|
files:
|
@@ -50,7 +51,9 @@ files:
|
|
50
51
|
- Gemfile
|
51
52
|
- Gemfile.lock
|
52
53
|
- LICENSE
|
54
|
+
- README.md
|
53
55
|
- bin/df
|
56
|
+
- bin/pr_template_builder
|
54
57
|
- devflow.gemspec
|
55
58
|
- lib/devflow.rb
|
56
59
|
- lib/devflow/target_process.rb
|