git_reflow 0.7.2 → 0.7.4

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: 96e1b777d8f08abf43c5dfb292beaf97d4c6e607
4
- data.tar.gz: d1675e623c154925a047bbfeb2f7934a485307dc
3
+ metadata.gz: 64b5781cd74b023d9f5a94c91949cac9528636f7
4
+ data.tar.gz: f509d8459ca0b092d4bd710722987613bfb6cd5f
5
5
  SHA512:
6
- metadata.gz: b139ee997dc07485c92fdda0846db9399158ca9cb0025e4fb6c528a9e1af7e6c1ca27b521d245cb0ac0e990ccc9d50fd48e10bfb031913124ba44397641b87ba
7
- data.tar.gz: a1baf7332b3c3bf4de2311f435913de66a4b04b9fdedebdb24c9da67e30696b1d667f901ab67f9375f1d63ec4373161c32c07a35ed3a62604e9dfcbcae6300b3
6
+ metadata.gz: 0ec9acd3327e943147292d1a6f794b23ae5cedbc80250e4c29c3884d26d7382f4b972ef0151ece4ea989e524721248a02ffc2df453c1c1bd094c7f1cd6de62bd
7
+ data.tar.gz: 860b02e97c65b9121ec31428ee8218a463fe5ccfab846767ee7312891a2321853e053902448bd29111f65200153b0cca775b4432d674465b5d6422239c2c9b02
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- git_reflow (0.7.2)
4
+ git_reflow (0.7.4)
5
5
  colorize (>= 0.7.0)
6
6
  github_api (= 0.12.4)
7
7
  gli (= 2.13.2)
@@ -4,7 +4,16 @@ command :setup do |c|
4
4
  c.switch [:l, :local], default_value: false, desc: 'setup GitReflow for the current project only'
5
5
  c.switch [:e, :enterprise], default_value: false, desc: 'setup GitReflow with a Github Enterprise account'
6
6
  c.action do |global_options, options, args|
7
- reflow_options = { project_only: options[:local], enterprise: options[:enterprise] }
7
+ reflow_options = { project_only: options[:local], enterprise: options[:enterprise] }
8
+ existing_git_include_paths = GitReflow::Config.get('include.path', all: true).split("\n")
9
+
10
+ unless File.exist?(GitReflow::Config::CONFIG_FILE_PATH) or existing_git_include_paths.include?(GitReflow::Config::CONFIG_FILE_PATH)
11
+ GitReflow.run "touch #{GitReflow::Config::CONFIG_FILE_PATH}"
12
+ GitReflow.say "Created #{GitReflow::Config::CONFIG_FILE_PATH} for Reflow specific configurations", :notice
13
+ GitReflow::Config.add "include.path", GitReflow::Config::CONFIG_FILE_PATH, global: true
14
+ GitReflow.say "Added #{GitReflow::Config::CONFIG_FILE_PATH} to ~/.gitconfig include paths", :notice
15
+ end
16
+
8
17
  choose do |menu|
9
18
  menu.header = "Available remote Git Server services:"
10
19
  menu.prompt = "Which service would you like to use for this project? "
@@ -2,6 +2,8 @@ module GitReflow
2
2
  module Config
3
3
  extend self
4
4
 
5
+ CONFIG_FILE_PATH = "~/.gitconfig.reflow".freeze
6
+
5
7
  def get(key, reload: false, all: false, local: false)
6
8
  if reload == false and cached_key_value = instance_variable_get(:"@#{key.tr('.-', '_')}")
7
9
  cached_key_value
@@ -21,7 +23,7 @@ module GitReflow
21
23
  if local
22
24
  GitReflow::Sandbox.run "git config --replace-all #{key} \"#{value}\"", loud: false
23
25
  else
24
- GitReflow::Sandbox.run "git config --global --replace-all #{key} \"#{value}\"", loud: false
26
+ GitReflow::Sandbox.run "git config -f #{CONFIG_FILE_PATH} --replace-all #{key} \"#{value}\"", loud: false
25
27
  end
26
28
  end
27
29
 
@@ -30,15 +32,17 @@ module GitReflow
30
32
  if local
31
33
  GitReflow::Sandbox.run "git config --unset-all #{key} #{value}", loud: false
32
34
  else
33
- GitReflow::Sandbox.run "git config --global --unset-all #{key} #{value}", loud: false
35
+ GitReflow::Sandbox.run "git config -f #{CONFIG_FILE_PATH} --unset-all #{key} #{value}", loud: false
34
36
  end
35
37
  end
36
38
 
37
- def add(key, value, local: false)
38
- if local
39
+ def add(key, value, local: false, global: false)
40
+ if global
41
+ GitReflow::Sandbox.run "git config --global --add #{key} \"#{value}\"", loud: false
42
+ elsif local
39
43
  GitReflow::Sandbox.run "git config --add #{key} \"#{value}\"", loud: false
40
44
  else
41
- GitReflow::Sandbox.run "git config --global --add #{key} \"#{value}\"", loud: false
45
+ GitReflow::Sandbox.run "git config -f #{CONFIG_FILE_PATH} --add #{key} \"#{value}\"", loud: false
42
46
  end
43
47
  end
44
48
  end
@@ -31,6 +31,11 @@ module GitReflow
31
31
  run_command_with_label "git push origin #{current_branch}"
32
32
  end
33
33
 
34
+ def update_current_branch
35
+ run_command_with_label "git pull origin #{current_branch}"
36
+ push_current_branch
37
+ end
38
+
34
39
  def fetch_destination(destination_branch)
35
40
  run_command_with_label "git fetch origin #{destination_branch}"
36
41
  end
@@ -100,7 +100,6 @@ module GitReflow
100
100
  config.endpoint = GitServer::GitHub.api_endpoint
101
101
  config.site = GitServer::GitHub.site_url
102
102
  config.adapter = :net_http
103
- config.ssl = {:verify => false}
104
103
  end
105
104
 
106
105
  @connection.connection_options = {headers: {"X-GitHub-OTP" => options[:two_factor_auth_code]}} if options[:two_factor_auth_code]
@@ -1,3 +1,3 @@
1
1
  module GitReflow
2
- VERSION = "0.7.2"
2
+ VERSION = "0.7.4"
3
3
  end
data/lib/git_reflow.rb CHANGED
@@ -109,6 +109,7 @@ module GitReflow
109
109
  feature_branch = current_branch
110
110
  base_branch = options['base'] || 'master'
111
111
 
112
+ update_current_branch
112
113
  fetch_destination(base_branch)
113
114
  update_destination(feature_branch)
114
115
 
@@ -194,6 +194,11 @@ describe GitReflow do
194
194
 
195
195
  subject { GitReflow.deliver inputs }
196
196
 
197
+ it "fetches the latest changes to the current branch" do
198
+ GitReflow.should_receive(:update_current_branch)
199
+ subject
200
+ end
201
+
197
202
  it "fetches the latest changes to the destination branch" do
198
203
  GitReflow.should_receive(:fetch_destination).with('master')
199
204
  subject
@@ -16,7 +16,7 @@ describe GitReflow::Config do
16
16
  end
17
17
 
18
18
  context "and checking for updates" do
19
- before { GitReflow::Config.get('checknorris.roundhouse') }
19
+ before { GitReflow::Config.get('chucknorris.roundhouse') }
20
20
  subject { GitReflow::Config.get('chucknorris.roundhouse') }
21
21
  it { expect{ subject }.to_not have_run_command_silently 'git config --get chucknorris.roundhouse-kick' }
22
22
  end
@@ -29,7 +29,7 @@ describe GitReflow::Config do
29
29
 
30
30
  describe ".set(key)" do
31
31
  subject { GitReflow::Config.set('chucknorris.roundhouse', 'to the face') }
32
- it { expect{ subject }.to have_run_command_silently 'git config --global --replace-all chucknorris.roundhouse "to the face"' }
32
+ it { expect{ subject }.to have_run_command_silently 'git config -f ~/.gitconfig.reflow --replace-all chucknorris.roundhouse "to the face"' }
33
33
 
34
34
  context "for current project only" do
35
35
  subject { GitReflow::Config.set('chucknorris.roundhouse', 'to the face', local: true) }
@@ -39,11 +39,11 @@ describe GitReflow::Config do
39
39
 
40
40
  describe ".unset(key)" do
41
41
  subject { GitReflow::Config.unset('chucknorris.roundhouse') }
42
- it { expect{ subject }.to have_run_command_silently 'git config --global --unset-all chucknorris.roundhouse ' }
42
+ it { expect{ subject }.to have_run_command_silently 'git config -f ~/.gitconfig.reflow --unset-all chucknorris.roundhouse ' }
43
43
 
44
44
  context "for multi-value keys" do
45
45
  subject { GitReflow::Config.unset('chucknorris.roundhouse', value: 'to the face') }
46
- it { expect{ subject }.to have_run_command_silently 'git config --global --unset-all chucknorris.roundhouse "to the face"' }
46
+ it { expect{ subject }.to have_run_command_silently 'git config -f ~/.gitconfig.reflow --unset-all chucknorris.roundhouse "to the face"' }
47
47
  end
48
48
 
49
49
  context "for current project only" do
@@ -59,11 +59,16 @@ describe GitReflow::Config do
59
59
 
60
60
  describe ".add(key)" do
61
61
  subject { GitReflow::Config.add('chucknorris.roundhouse', 'to the face') }
62
- it { expect{ subject }.to have_run_command_silently 'git config --global --add chucknorris.roundhouse "to the face"' }
62
+ it { expect{ subject }.to have_run_command_silently "git config -f #{GitReflow::Config::CONFIG_FILE_PATH} --add chucknorris.roundhouse \"to the face\"" }
63
63
 
64
64
  context "for current project only" do
65
65
  subject { GitReflow::Config.add('chucknorris.roundhouse', 'to the face', local: true) }
66
66
  it { expect{ subject }.to have_run_command_silently 'git config --add chucknorris.roundhouse "to the face"' }
67
67
  end
68
+
69
+ context "globally" do
70
+ subject { GitReflow::Config.add('chucknorris.roundhouse', 'to the face', global: true) }
71
+ it { expect{ subject }.to have_run_command_silently 'git config --global --add chucknorris.roundhouse "to the face"' }
72
+ end
68
73
  end
69
74
  end
@@ -88,6 +88,18 @@ describe GitReflow::GitHelpers do
88
88
  end
89
89
  end
90
90
 
91
+ describe ".update_current_branch" do
92
+ subject { Gitacular.update_current_branch }
93
+ before { Gitacular.stub(:current_branch).and_return('new-feature') }
94
+
95
+ it "updates the remote changes and pushes any local changes" do
96
+ expect { subject }.to have_run_commands_in_order [
97
+ "git pull origin new-feature",
98
+ "git push origin new-feature"
99
+ ]
100
+ end
101
+ end
102
+
91
103
  describe ".merge_feature_branch(options)" do
92
104
  let(:destination_branch) { 'monkey-business' }
93
105
  let(:feature_branch) { 'bananas' }
@@ -103,10 +103,10 @@ describe GitReflow::GitServer::GitHub do
103
103
  end
104
104
 
105
105
  it "creates git config keys for github connections" do
106
- expect{ subject }.to have_run_command_silently "git config --global --replace-all github.site \"#{GitReflow::GitServer::GitHub.site_url}\""
107
- expect{ subject }.to have_run_command_silently "git config --global --replace-all github.endpoint \"#{GitReflow::GitServer::GitHub.api_endpoint}\""
108
- expect{ subject }.to have_run_command_silently "git config --global --replace-all github.oauth-token \"#{oauth_token_hash[:token]}\""
109
- expect{ subject }.to have_run_command_silently "git config --global --replace-all reflow.git-server \"GitHub\""
106
+ expect{ subject }.to have_run_command_silently "git config -f #{GitReflow::Config::CONFIG_FILE_PATH} --replace-all github.site \"#{GitReflow::GitServer::GitHub.site_url}\""
107
+ expect{ subject }.to have_run_command_silently "git config -f #{GitReflow::Config::CONFIG_FILE_PATH} --replace-all github.endpoint \"#{GitReflow::GitServer::GitHub.api_endpoint}\""
108
+ expect{ subject }.to have_run_command_silently "git config -f #{GitReflow::Config::CONFIG_FILE_PATH} --replace-all github.oauth-token \"#{oauth_token_hash[:token]}\""
109
+ expect{ subject }.to have_run_command_silently "git config -f #{GitReflow::Config::CONFIG_FILE_PATH} --replace-all reflow.git-server \"GitHub\""
110
110
  end
111
111
 
112
112
  context "exclusive to project" do
@@ -118,16 +118,16 @@ describe GitReflow::GitServer::GitHub do
118
118
  end
119
119
 
120
120
  it "creates _local_ git config keys for github connections" do
121
- expect{ subject }.to_not have_run_command_silently "git config --global --replace-all github.site \"#{GitReflow::GitServer::GitHub.site_url}\""
122
- expect{ subject }.to_not have_run_command_silently "git config --global --replace-all github.endpoint \"#{GitReflow::GitServer::GitHub.api_endpoint}\""
123
- expect{ subject }.to_not have_run_command_silently "git config --global --replace-all github.oauth-token \"#{oauth_token_hash[:token]}\""
124
- expect{ subject }.to_not have_run_command_silently "git config --global --replace-all reflow.git-server \"GitHub\""
121
+ expect{ subject }.to_not have_run_command_silently "git config -f #{GitReflow::Config::CONFIG_FILE_PATH} --replace-all github.site \"#{GitReflow::GitServer::GitHub.site_url}\""
122
+ expect{ subject }.to_not have_run_command_silently "git config -f #{GitReflow::Config::CONFIG_FILE_PATH} --replace-all github.endpoint \"#{GitReflow::GitServer::GitHub.api_endpoint}\""
123
+ expect{ subject }.to_not have_run_command_silently "git config -f #{GitReflow::Config::CONFIG_FILE_PATH} --replace-all github.oauth-token \"#{oauth_token_hash[:token]}\""
124
+ expect{ subject }.to_not have_run_command_silently "git config -f #{GitReflow::Config::CONFIG_FILE_PATH} --replace-all reflow.git-server \"GitHub\""
125
125
 
126
126
  expect{ subject }.to have_run_command_silently "git config --replace-all github.site \"#{GitReflow::GitServer::GitHub.site_url}\""
127
127
  expect{ subject }.to have_run_command_silently "git config --replace-all github.endpoint \"#{GitReflow::GitServer::GitHub.api_endpoint}\""
128
128
  expect{ subject }.to have_run_command_silently "git config --replace-all github.oauth-token \"#{oauth_token_hash[:token]}\""
129
129
  expect{ subject }.to have_run_command_silently "git config --replace-all reflow.git-server \"GitHub\""
130
- expect{ subject }.to have_run_command_silently "git config --global --add reflow.local-projects \"#{user}/#{repo}\""
130
+ expect{ subject }.to have_run_command_silently "git config -f #{GitReflow::Config::CONFIG_FILE_PATH} --add reflow.local-projects \"#{user}/#{repo}\""
131
131
  end
132
132
  end
133
133
 
@@ -135,10 +135,10 @@ describe GitReflow::GitServer::GitHub do
135
135
  let(:github) { GitReflow::GitServer::GitHub.new(enterprise: true) }
136
136
  before { GitReflow::GitServer::GitHub.stub(:@using_enterprise).and_return(true) }
137
137
  it "creates git config keys for github connections" do
138
- expect{ subject }.to have_run_command_silently "git config --global --replace-all github.site \"#{enterprise_site}\""
139
- expect{ subject }.to have_run_command_silently "git config --global --replace-all github.endpoint \"#{enterprise_api}\""
140
- expect{ subject }.to have_run_command_silently "git config --global --replace-all github.oauth-token \"#{oauth_token_hash[:token]}\""
141
- expect{ subject }.to have_run_command_silently "git config --global --replace-all reflow.git-server \"GitHub\""
138
+ expect{ subject }.to have_run_command_silently "git config -f #{GitReflow::Config::CONFIG_FILE_PATH} --replace-all github.site \"#{enterprise_site}\""
139
+ expect{ subject }.to have_run_command_silently "git config -f #{GitReflow::Config::CONFIG_FILE_PATH} --replace-all github.endpoint \"#{enterprise_api}\""
140
+ expect{ subject }.to have_run_command_silently "git config -f #{GitReflow::Config::CONFIG_FILE_PATH} --replace-all github.oauth-token \"#{oauth_token_hash[:token]}\""
141
+ expect{ subject }.to have_run_command_silently "git config -f #{GitReflow::Config::CONFIG_FILE_PATH} --replace-all reflow.git-server \"GitHub\""
142
142
  end
143
143
  end
144
144
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git_reflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Valentino Stoll
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-02-22 00:00:00.000000000 Z
13
+ date: 2016-04-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: appraisal