fgi 1.1.3 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/bin/fgi +4 -0
  3. data/lib/fgi.rb +1 -1
  4. data/lib/fgi/git_service.rb +9 -5
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1891f28f5ddf8fb90c595b3ae58293bcd00651bb
4
- data.tar.gz: 8d17307b6f8edadf84b85cbb5b408816423b2a58
3
+ metadata.gz: 33608108acb7c3f2ecd4c83270135f5e06740287
4
+ data.tar.gz: fa341ad5f16c126722c08201f4bb959cd2436c8c
5
5
  SHA512:
6
- metadata.gz: 690c3ec932312ea33b690f4bd44aa62a2fd0aaca29def6ca4465a912c70d2dff8d09cc231acf6feade769d743382c7eb63b0c8cdfa8e214494c155aeb1c92cee
7
- data.tar.gz: d6e096772f58333bd418c88dd8b316a2d34738951dfbddbd538e613e881ed464eef85958f2a23326daa8939756ca5753d5d5933dfea41b4f6b0b0585bd76b94f
6
+ metadata.gz: 81a4ef11f6164af60057df09b2196de60e616350bc0d23e0792c254dd92c451169322f83aaa97c942254a012865e890c8aa792e869a687bce39a3e282be1605e
7
+ data.tar.gz: 12e636b5a22cb8db4b4c27ce199952a601e6d759bcdf6b4b3362495cba261b4f5ac59a87adb2d5e50deabdd6645ef4af97ec34a5440c0a1260053dc0a69ac733
data/bin/fgi CHANGED
@@ -41,6 +41,10 @@ options_parser = OptionParser.new do |fgi|
41
41
  options[:prefix] = prefix
42
42
  end
43
43
 
44
+ fgi.on('--from-current', 'Tell FGI to create the new issue from a specific branch.') do
45
+ options[:from_current] = true
46
+ end
47
+
44
48
  fgi.on('-m', '--fix-message [MESSAGE]', %q(Add a custom message with the basic 'Fix #ID')) do |message|
45
49
  options[:fix_message] = message
46
50
  end
data/lib/fgi.rb CHANGED
@@ -14,7 +14,7 @@ module Fgi
14
14
  require_relative 'fgi/configuration'
15
15
  require_relative 'fgi/git_service'
16
16
 
17
- VERSION = '1.1.3'.freeze
17
+ VERSION = '1.1.4'.freeze
18
18
 
19
19
  # Add FGI user's current issues to the gitignore
20
20
  if `cat .gitignore | grep '.current_issues.fgi.yml'`.empty?
@@ -33,7 +33,7 @@ module Fgi
33
33
  branch_name = snakify(title)
34
34
  branch_name = "#{options[:prefix]}/#{branch_name}" unless options[:prefix].nil?
35
35
  save_issue(branch: branch_name, id: response['iid'], title: response['title'].tr("'", ' '))
36
- create_branch(branch_name) unless options[:later]
36
+ create_branch(name: branch_name, from_current: options[:from_current]) unless options[:later]
37
37
  set_issue_estimation(
38
38
  issue_id: response['iid'],
39
39
  estimation: options[:estimate],
@@ -63,6 +63,7 @@ module Fgi
63
63
  commit_message += " - #{options[:fix_message]}" unless options[:fix_message].nil?
64
64
  `git commit -a --allow-empty -m '#{commit_message}'`
65
65
  `git push #{git_remote} HEAD`
66
+ `git branch -u #{git_remote}/#{name}` # Define the upstream branch
66
67
  `git checkout #{CONFIG[:default_branch]}` # Be sure to be on the default branch.
67
68
  remove_issue(current_branch)
68
69
  puts "Congrat's ! You're now back to work on the default branch (#{CONFIG[:default_branch]})"
@@ -167,14 +168,17 @@ module Fgi
167
168
 
168
169
  # The method used to create branches
169
170
  # @param name [String] the branch name
170
- def create_branch(name)
171
+ def create_branch(name:, from_current:)
172
+ from = if from_current
173
+ `git branch | grep '*'`.gsub('* ', '').chomp
174
+ else
175
+ CONFIG[:default_branch]
176
+ end
171
177
  check_status
172
178
  git_remote = ask_for_remote
173
- `git checkout #{CONFIG[:default_branch]}` # Be sure to be on the default branch.
174
- from = `git branch | grep '*'`.gsub('* ', '').chomp
179
+ `git checkout #{from}` # Be sure to be on the default or specified branch.
175
180
  `git pull #{git_remote} HEAD` # Be sure to get the remote changes locally.
176
181
  `git checkout -b #{name}` # Create the new branch.
177
- `git branch -u #{git_remote}/#{name}` # Define the upstream branch
178
182
  to = `git branch | grep '*'`.gsub('* ', '').chomp
179
183
  puts "\nYou are now working on branch #{to} created from #{from} !"
180
184
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fgi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julien Philibin