git_flower 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +7 -3
- data/lib/git_flower.rb +3 -0
- data/lib/git_flower/branch.rb +17 -0
- data/lib/git_flower/feature-cli.rb +0 -12
- data/lib/git_flower/git_repository.rb +6 -0
- data/lib/git_flower/hotfix-cli.rb +0 -12
- data/lib/git_flower/story.rb +13 -9
- data/lib/git_flower/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 219b7cb4f97f5c3bd48bba2cb05d9bc3791cab5f
|
4
|
+
data.tar.gz: b8fd1884e0f8cde2508a9c81ddb8f167d8f40d09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea9d0473e1176e31aacaedb779324fe1cf6db314fa9786bd5435ea56b6be51674c40e019286559a129447e072f8d18f156fabfba436f927cb0f72dc971874369
|
7
|
+
data.tar.gz: 78932f0c4e5541d926f0dae0615a548f90c483d2236250e9888acded5b069ea18c2b625968d4dd7665f780ce40f55705a9b5e27fbe6f11c65a9b6cf88acf6bc3
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -30,6 +30,8 @@ export PIVOTAL_TOKEN="TOKEN HERE"
|
|
30
30
|
export PIVOTAL_PROJECT_ID="some_number_here"
|
31
31
|
```
|
32
32
|
|
33
|
+
Make sure you have run `git flow init` on the project you want to use this gem with! Check out the [gitflow wiki](https://github.com/nvie/gitflow/wiki/Installation) for up to date installation instructions if you don't have git-flow yet.
|
34
|
+
|
33
35
|
## Usage
|
34
36
|
|
35
37
|
The `git-flower create` commands will create a Pivotal story for your feature or hotfix, start a git-flow branch off of develop, and check out that branch. All you need to do is pass a story name, and it will set a titleized version as the Pivotal ticket name and a slugified version as the branch name.
|
@@ -61,7 +63,7 @@ feature/1234-save-all-the-cats
|
|
61
63
|
|
62
64
|
Your Pivotal Feature would look something like this:
|
63
65
|
|
64
|
-
![Pivotal Feature Example](https://
|
66
|
+
![Pivotal Feature Example](https://farm5.staticflickr.com/4279/35816647836_e20c3d465d_k.jpg)
|
65
67
|
|
66
68
|
### Hotfix
|
67
69
|
|
@@ -84,7 +86,7 @@ hotfix/5678-missing-cat
|
|
84
86
|
|
85
87
|
Your Pivotal Bug would look something like this:
|
86
88
|
|
87
|
-
![Pivotal Bug Example](https://
|
89
|
+
![Pivotal Bug Example](https://farm5.staticflickr.com/4207/35688101172_2cce13f24b_k.jpg)
|
88
90
|
|
89
91
|
### Hitch Integration
|
90
92
|
|
@@ -103,7 +105,9 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
103
105
|
|
104
106
|
## Contributing
|
105
107
|
|
106
|
-
Bug reports and pull requests are welcome on GitLab at https://gitlab.com/alexwilkinson/git-flower.
|
108
|
+
Bug reports and pull requests are welcome on GitLab at https://gitlab.com/alexwilkinson/git-flower. If there isn't already an open Issue attempting to address your bug or feature request, please feel free to open one and I'll follow up within 24 hours.
|
109
|
+
|
110
|
+
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.
|
107
111
|
|
108
112
|
## License
|
109
113
|
|
data/lib/git_flower.rb
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
module GitFlower
|
2
|
+
class Branch
|
3
|
+
def initialize(name:, id:, type:)
|
4
|
+
@story_name = name
|
5
|
+
@story_id = id
|
6
|
+
@type = type
|
7
|
+
end
|
8
|
+
|
9
|
+
def name
|
10
|
+
Shellwords.shellescape("#{type}/#{story_id}-#{story_name.parameterize}")
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
attr_reader :story_name, :story_id, :type
|
16
|
+
end
|
17
|
+
end
|
@@ -39,20 +39,8 @@ module GitFlower
|
|
39
39
|
feature = Feature.new(
|
40
40
|
story_name: story_name,
|
41
41
|
labels: options[:labels],
|
42
|
-
project_id: project_id,
|
43
|
-
pivotal_token: pivotal_token
|
44
42
|
)
|
45
43
|
feature.save!
|
46
44
|
end
|
47
|
-
|
48
|
-
private
|
49
|
-
|
50
|
-
def project_id
|
51
|
-
ENV['PIVOTAL_PROJECT_ID']
|
52
|
-
end
|
53
|
-
|
54
|
-
def pivotal_token
|
55
|
-
ENV['PIVOTAL_TOKEN']
|
56
|
-
end
|
57
45
|
end
|
58
46
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'git'
|
2
|
+
require_relative 'branch'
|
2
3
|
|
3
4
|
class GitError < StandardError; end
|
4
5
|
class GitFlowError < StandardError; end
|
@@ -9,6 +10,11 @@ module GitFlower
|
|
9
10
|
@repo = find_git_repo(path_to_repo)
|
10
11
|
end
|
11
12
|
|
13
|
+
def start_branch(name:, id:, type:)
|
14
|
+
branch_name = GitFlower::Branch.new(name: name, id: id, type: type).name
|
15
|
+
@repo.branch(branch_name).checkout
|
16
|
+
end
|
17
|
+
|
12
18
|
def validate_for_hotfix!
|
13
19
|
puts "Checking for commited files"
|
14
20
|
if has_added_files?
|
@@ -39,20 +39,8 @@ module GitFlower
|
|
39
39
|
hotfix = Hotfix.new(
|
40
40
|
story_name: story_name,
|
41
41
|
labels: options[:labels],
|
42
|
-
project_id: project_id,
|
43
|
-
pivotal_token: pivotal_token
|
44
42
|
)
|
45
43
|
hotfix.save!
|
46
44
|
end
|
47
|
-
|
48
|
-
private
|
49
|
-
|
50
|
-
def project_id
|
51
|
-
ENV['PIVOTAL_PROJECT_ID']
|
52
|
-
end
|
53
|
-
|
54
|
-
def pivotal_token
|
55
|
-
ENV['PIVOTAL_TOKEN']
|
56
|
-
end
|
57
45
|
end
|
58
46
|
end
|
data/lib/git_flower/story.rb
CHANGED
@@ -6,11 +6,9 @@ require_relative 'pivotal_project'
|
|
6
6
|
|
7
7
|
module GitFlower
|
8
8
|
class Story
|
9
|
-
def initialize(story_name:, labels
|
9
|
+
def initialize(story_name:, labels:)
|
10
10
|
@story_name = story_name
|
11
11
|
@labels = Array(labels)
|
12
|
-
@project_id = project_id
|
13
|
-
@pivotal_token = pivotal_token
|
14
12
|
end
|
15
13
|
|
16
14
|
def create_story!(type)
|
@@ -26,12 +24,14 @@ module GitFlower
|
|
26
24
|
puts "Your pivotal story is https://www.pivotaltracker.com/story/show/#{story.id}"
|
27
25
|
puts "Creating #{type} branch for #{story_name}"
|
28
26
|
|
29
|
-
|
27
|
+
GitRepository.
|
28
|
+
new(Dir.pwd).
|
29
|
+
start_branch(name: story_name, id: story.id, type: type)
|
30
30
|
end
|
31
31
|
|
32
32
|
private
|
33
33
|
|
34
|
-
attr_reader :story_name, :labels
|
34
|
+
attr_reader :story_name, :labels
|
35
35
|
|
36
36
|
def validate_environment_and_arguments!
|
37
37
|
if env_variable_undefined?(story_name)
|
@@ -55,6 +55,14 @@ module GitFlower
|
|
55
55
|
PivotalProject.new(pivotal_token, project_id)
|
56
56
|
end
|
57
57
|
|
58
|
+
def pivotal_token
|
59
|
+
ENV['PIVOTAL_TOKEN']
|
60
|
+
end
|
61
|
+
|
62
|
+
def project_id
|
63
|
+
ENV['PIVOTAL_PROJECT_ID']
|
64
|
+
end
|
65
|
+
|
58
66
|
def derive_story_owners
|
59
67
|
begin
|
60
68
|
hitch_config = YAML.load_file("#{ENV['HOME']}/.hitchrc")
|
@@ -67,9 +75,5 @@ module GitFlower
|
|
67
75
|
Array(ENV['USER'])
|
68
76
|
end
|
69
77
|
end
|
70
|
-
|
71
|
-
def branch_name(story_id)
|
72
|
-
Shellwords.shellescape("#{story_id}-#{story_name.parameterize}")
|
73
|
-
end
|
74
78
|
end
|
75
79
|
end
|
data/lib/git_flower/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git_flower
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Wilkinson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -160,6 +160,7 @@ files:
|
|
160
160
|
- exe/git-flower
|
161
161
|
- git_flower.gemspec
|
162
162
|
- lib/git_flower.rb
|
163
|
+
- lib/git_flower/branch.rb
|
163
164
|
- lib/git_flower/cli.rb
|
164
165
|
- lib/git_flower/feature-cli.rb
|
165
166
|
- lib/git_flower/feature.rb
|