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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 437cd16229bd94b676971ac50d6b86f4d792fe64
4
- data.tar.gz: 171eee617b2500ead9a364c380effc833e1e082a
3
+ metadata.gz: 219b7cb4f97f5c3bd48bba2cb05d9bc3791cab5f
4
+ data.tar.gz: b8fd1884e0f8cde2508a9c81ddb8f167d8f40d09
5
5
  SHA512:
6
- metadata.gz: ab3da35e297f3cab5bda3d0056722712f3dd659726139b43a6c5f3dbca42b5e98837e2b142eb43c92a99cbde882f3250a7eb0daa30f7f06ba11d84153c2a0e0c
7
- data.tar.gz: 26397d79ff5f5deb4157587c1cab10c798271d65c6dbfa8e2c1dc24383370525712bfd65f372face2021b6d292d8ae5b1feb1f910312f4cd34c2acc9d3a4a936
6
+ metadata.gz: ea9d0473e1176e31aacaedb779324fe1cf6db314fa9786bd5435ea56b6be51674c40e019286559a129447e072f8d18f156fabfba436f927cb0f72dc971874369
7
+ data.tar.gz: 78932f0c4e5541d926f0dae0615a548f90c483d2236250e9888acded5b069ea18c2b625968d4dd7665f780ce40f55705a9b5e27fbe6f11c65a9b6cf88acf6bc3
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- git_flower (0.1.1)
4
+ git_flower (0.1.2)
5
5
  activesupport (~> 5.1.2)
6
6
  faraday (~> 0.9.0)
7
7
  git (~> 1.3.0)
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://photos-1.dropbox.com/t/2/AADrhIDYH53IfCbz1VtLnPrNYX0MIHau-ub8g2cqxyclxQ/12/49046/png/32x32/3/1499760000/0/2/git-flower-feature.png/EIbdIhi4-dHgBCACKAI/-z2SbCaiHwKR-cyBs3xEw6ru8kdKgh7Fr8NEtw75NFI?dl=0&size=2048x1536&size_mode=3)
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://photos-2.dropbox.com/t/2/AADERZmXtrsHQ202P285d5je1vTwaRHK6PZtQTNkknzbjQ/12/49046/png/32x32/3/1499763600/0/2/git-flower-bug.png/EIbdIhi4-dHgBCACKAI/VCWQS444mMy3075Fb1w4mf4vmfuz5js8GPKfI87yI_M?dl=0&size=2048x1536&size_mode=3)
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. 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.
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
 
@@ -4,6 +4,9 @@ require "git_flower/feature"
4
4
  require "git_flower/hotfix"
5
5
  require "git_flower/git_repository"
6
6
  require "git_flower/pivotal_project"
7
+ require "git_flower/feature-cli"
8
+ require "git_flower/hotfix-cli"
9
+ require "git_flower/branch"
7
10
 
8
11
  module GitFlower
9
12
  end
@@ -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
@@ -6,11 +6,9 @@ require_relative 'pivotal_project'
6
6
 
7
7
  module GitFlower
8
8
  class Story
9
- def initialize(story_name:, labels:, project_id:, pivotal_token:)
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
- `git flow #{type} start #{branch_name(story.id)}`
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, :project_id, :pivotal_token
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
@@ -1,3 +1,3 @@
1
1
  module GitFlower
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
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.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 00:00:00.000000000 Z
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