git_reflow 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/lib/git_reflow/commands/stage.rb +31 -0
- data/lib/git_reflow/sandbox.rb +1 -1
- data/lib/git_reflow/version.rb +1 -1
- data/lib/git_reflow.rb +18 -0
- data/spec/git_reflow_spec.rb +37 -0
- data/spec/support/fake_github.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: d71fb145146965402e35a8781270d335c6b48992
|
4
|
+
data.tar.gz: 021a46ce6f44072e351fc58dc926a6f86d6bb8e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00e25a1a163fbe53bf386608f825d5c4e598ab38769ef2d38776326a6b6abd3a506c5db72d09d5524fd5d01cae7235554353d5b85824bba188217cb2933f37c5
|
7
|
+
data.tar.gz: 8657729034fa0cbdbc6f573b7571f002b9740ac9d3a322bff3fa0863eab55b0f1e57e56d842d1ae2641a21409408817e2360f4caa018620837d00d0fbf2b50e7
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
git_reflow (0.7.
|
4
|
+
git_reflow (0.7.1)
|
5
5
|
colorize (>= 0.7.0)
|
6
6
|
github_api (= 0.12.4)
|
7
7
|
gli (= 2.13.2)
|
@@ -30,7 +30,7 @@ GEM
|
|
30
30
|
descendants_tracker (0.0.4)
|
31
31
|
thread_safe (~> 0.3, >= 0.3.1)
|
32
32
|
diff-lcs (1.2.5)
|
33
|
-
faraday (0.9.
|
33
|
+
faraday (0.9.2)
|
34
34
|
multipart-post (>= 1.2, < 3)
|
35
35
|
faraday_middleware (0.9.2)
|
36
36
|
faraday (>= 0.7.4, < 0.10)
|
@@ -0,0 +1,31 @@
|
|
1
|
+
desc 'Deliver your changes to a staging server'
|
2
|
+
command :stage do |c|
|
3
|
+
c.desc 'deliver your feature branch to the staging branch'
|
4
|
+
c.action do |global_options, options, args|
|
5
|
+
feature_branch_name = GitReflow.current_branch
|
6
|
+
staging_branch_name = GitReflow::Config.get('reflow.staging-branch', local: true)
|
7
|
+
|
8
|
+
if staging_branch_name.empty?
|
9
|
+
staging_branch_name = GitReflow.ask("What's the name of your staging branch? (default: 'staging') ")
|
10
|
+
staging_branch_name = 'staging' if staging_branch_name.strip == ''
|
11
|
+
GitReflow::Config.set('reflow.staging-branch', staging_branch_name, local: true)
|
12
|
+
end
|
13
|
+
|
14
|
+
GitReflow.run_command_with_label "git checkout #{staging_branch_name}"
|
15
|
+
GitReflow.run_command_with_label "git pull origin #{staging_branch_name}"
|
16
|
+
|
17
|
+
if GitReflow.run_command_with_label "git merge #{feature_branch_name}", with_system: true
|
18
|
+
GitReflow.run_command_with_label "git push origin #{staging_branch_name}"
|
19
|
+
|
20
|
+
staged = GitReflow.deploy(:staging)
|
21
|
+
|
22
|
+
if staged
|
23
|
+
GitReflow.say "Deployed to Staging.", :success
|
24
|
+
else
|
25
|
+
GitReflow.say "There were issues deploying to staging.", :error
|
26
|
+
end
|
27
|
+
else
|
28
|
+
GitReflow.say "There were issues merging your feature branch to staging.", :error
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/git_reflow/sandbox.rb
CHANGED
@@ -39,7 +39,7 @@ module GitReflow
|
|
39
39
|
|
40
40
|
# WARNING: this currently only supports OS X and UBUNTU
|
41
41
|
def ask_to_open_in_browser(url)
|
42
|
-
if OS.
|
42
|
+
if OS.unix?
|
43
43
|
open_in_browser = ask "Would you like to open it in your browser? "
|
44
44
|
if open_in_browser =~ /^y/i
|
45
45
|
if OS.mac?
|
data/lib/git_reflow/version.rb
CHANGED
data/lib/git_reflow.rb
CHANGED
@@ -130,6 +130,24 @@ module GitReflow
|
|
130
130
|
end
|
131
131
|
end
|
132
132
|
|
133
|
+
def deploy(destination_server)
|
134
|
+
deploy_command = GitReflow::Config.get("reflow.deploy-to-#{destination_server}-command", local: true)
|
135
|
+
|
136
|
+
# first check is to allow for automated setup
|
137
|
+
if deploy_command.empty?
|
138
|
+
deploy_command = ask("Enter the command you use to deploy to #{destination_server} (leaving blank will skip deployment)")
|
139
|
+
end
|
140
|
+
|
141
|
+
# second check is to see if the user wants to skip
|
142
|
+
if deploy_command.empty?
|
143
|
+
say "Skipping deployment..."
|
144
|
+
false
|
145
|
+
else
|
146
|
+
GitReflow::Config.set("reflow.deploy-to-#{destination_server}-command", deploy_command, local: true)
|
147
|
+
run_command_with_label(deploy_command, with_system: true)
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
133
151
|
def git_server
|
134
152
|
@git_server ||= GitServer.connect provider: GitReflow::Config.get('reflow.git-server').strip, silent: true
|
135
153
|
end
|
data/spec/git_reflow_spec.rb
CHANGED
@@ -416,4 +416,41 @@ describe GitReflow do
|
|
416
416
|
end
|
417
417
|
end
|
418
418
|
end
|
419
|
+
|
420
|
+
context ".deploy(destination)" do
|
421
|
+
let(:deploy_command) { "bundle exec cap #{destination} deploy" }
|
422
|
+
subject { GitReflow.deploy(destination) }
|
423
|
+
|
424
|
+
before do
|
425
|
+
stub_command_line_inputs({
|
426
|
+
"Enter the command you use to deploy to #{destination} (leaving blank will skip deployment)" => "bundle exec cap #{destination} deploy"
|
427
|
+
})
|
428
|
+
end
|
429
|
+
|
430
|
+
context "staging" do
|
431
|
+
let(:destination) { "staging" }
|
432
|
+
|
433
|
+
it "sets the local git-config for reflow.deploy-to-staging-command" do
|
434
|
+
expect(GitReflow::Config).to receive(:set).with('reflow.deploy-to-staging-command', deploy_command, local: true)
|
435
|
+
subject
|
436
|
+
end
|
437
|
+
|
438
|
+
it "runs the staging deploy command" do
|
439
|
+
expect { subject }.to have_run_command(deploy_command)
|
440
|
+
end
|
441
|
+
end
|
442
|
+
|
443
|
+
context "production" do
|
444
|
+
let(:destination) { "production" }
|
445
|
+
|
446
|
+
it "sets the local git-config for reflow.deploy-to-staging-command" do
|
447
|
+
expect(GitReflow::Config).to receive(:set).with('reflow.deploy-to-production-command', deploy_command, local: true)
|
448
|
+
subject
|
449
|
+
end
|
450
|
+
|
451
|
+
it "runs the staging deploy command" do
|
452
|
+
expect { subject }.to have_run_command(deploy_command)
|
453
|
+
end
|
454
|
+
end
|
455
|
+
end
|
419
456
|
end
|
data/spec/support/fake_github.rb
CHANGED
@@ -113,7 +113,7 @@ class FakeGitHub
|
|
113
113
|
repo_name: self.repo_name,
|
114
114
|
comments: object_data[:comments],
|
115
115
|
pull_request_number: object_data[:number] || 1,
|
116
|
-
created_at: object_data[:created_at] || Time.
|
116
|
+
created_at: object_data[:created_at] || Time.parse('1pm')).to_s,
|
117
117
|
status: 201,
|
118
118
|
headers: {content_type: "application/json; charset=utf-8"})
|
119
119
|
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.
|
4
|
+
version: 0.7.1
|
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: 2015-10-
|
13
|
+
date: 2015-10-27 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: appraisal
|
@@ -262,6 +262,7 @@ files:
|
|
262
262
|
- lib/git_reflow/commands/deliver.rb
|
263
263
|
- lib/git_reflow/commands/review.rb
|
264
264
|
- lib/git_reflow/commands/setup.rb
|
265
|
+
- lib/git_reflow/commands/stage.rb
|
265
266
|
- lib/git_reflow/commands/start.rb
|
266
267
|
- lib/git_reflow/commands/status.rb
|
267
268
|
- lib/git_reflow/config.rb
|