dogids-cli 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dogids/deploy.rb +4 -2
- data/lib/dogids/deploy/staging.rb +63 -0
- data/lib/dogids/ssh.rb +5 -1
- data/lib/dogids/ssh/staging.rb +16 -0
- data/lib/dogids/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40d38e3692d59cb06e77ba404589f4bafb4ddc07
|
4
|
+
data.tar.gz: 645543705476bd93e585efbea849e3209b8e2e29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7314c1d8ae83b857058d9afa9bbba58d3e7a683e205fb6b6a43d532e70f255d27c6f7f54449edbfcde423468dafe9503f7ea271e97f7536e9878f4fe63d77c8b
|
7
|
+
data.tar.gz: 3dfb8436d3aac045c07e73fdf99435dc0af19616926414334f4a3a2c7aa737bcf924bb18934d278231eef8c6a520997ab6790d569661f530f83c4ea9ea56321a
|
data/lib/dogids/deploy.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "thor"
|
2
|
+
require_relative "deploy/staging"
|
2
3
|
require_relative "deploy/web"
|
3
4
|
require_relative "deploy/worker"
|
4
5
|
|
@@ -10,8 +11,9 @@ module Dogids
|
|
10
11
|
return self.send(deploy_command) if self.respond_to?(deploy_command)
|
11
12
|
|
12
13
|
puts "Deployment Commands:"
|
13
|
-
puts " dogids deploy
|
14
|
-
puts " dogids deploy
|
14
|
+
puts " dogids deploy staging # Deploy the staging.dogids.com storefront"
|
15
|
+
puts " dogids deploy web # Deploy the dogids.com storefront"
|
16
|
+
puts " dogids deploy worker # Deploy the dogids-backgrounder app"
|
15
17
|
puts " "
|
16
18
|
end
|
17
19
|
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require "net/ssh"
|
2
|
+
require "thor"
|
3
|
+
|
4
|
+
module Dogids
|
5
|
+
class Cli < Thor
|
6
|
+
no_commands do
|
7
|
+
def deploy_staging
|
8
|
+
print_heading("Deploying dogids.com site to staging server...")
|
9
|
+
|
10
|
+
Net::SSH.start("staging.dogids.com", "dogids") do |ssh|
|
11
|
+
print_command("Checking the current git status...")
|
12
|
+
ssh.exec!(staging_git_status_command) do |_channel, _stream, data|
|
13
|
+
print_command(data)
|
14
|
+
end
|
15
|
+
|
16
|
+
current_branch = ssh.exec!("cd /home/dogids/apps/dogids.com && git rev-parse --abbrev-ref HEAD").strip
|
17
|
+
|
18
|
+
print_heading("Current Branch: #{current_branch}")
|
19
|
+
print_heading("Available Branches:")
|
20
|
+
ssh.exec!("cd /home/dogids/apps/dogids.com && git branch -r --no-merged master") do |_channel, _stream, data|
|
21
|
+
print_command("master")
|
22
|
+
data.split("\n").each do |branch|
|
23
|
+
print_command(branch.gsub("origin/", ""))
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
branch = ask("-----> What branch would you like to deploy?").strip
|
28
|
+
return print_command("Fine, be that way.") if branch.length == 0
|
29
|
+
|
30
|
+
print_command("Pulling latest from #{branch}...")
|
31
|
+
ssh.exec!(staging_git_pull_command(branch)) do |_channel, _stream, data|
|
32
|
+
print_command(data)
|
33
|
+
end
|
34
|
+
|
35
|
+
print_command("Updating file permissions...")
|
36
|
+
ssh.exec!(web_update_permissions_command) do |_channel, _stream, data|
|
37
|
+
print_command(data)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
print_heading("Done.")
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def staging_git_pull_command(branch)
|
48
|
+
commands = []
|
49
|
+
commands << "cd /home/dogids/apps/dogids.com"
|
50
|
+
commands << "git fetch origin #{branch}"
|
51
|
+
commands << "git checkout #{branch}"
|
52
|
+
commands << "git pull origin #{branch}"
|
53
|
+
commands.join("&& ")
|
54
|
+
end
|
55
|
+
|
56
|
+
def staging_git_status_command
|
57
|
+
commands = []
|
58
|
+
commands << "cd /home/dogids/apps/dogids.com"
|
59
|
+
commands << "git status -s"
|
60
|
+
commands.join("&& ")
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
data/lib/dogids/ssh.rb
CHANGED
@@ -1,13 +1,17 @@
|
|
1
1
|
require "thor"
|
2
2
|
require_relative "ssh/development"
|
3
3
|
require_relative "ssh/production"
|
4
|
+
require_relative "ssh/staging"
|
4
5
|
|
5
6
|
module Dogids
|
6
7
|
class Cli < Thor
|
7
8
|
desc "ssh", "List available SSH commands"
|
8
9
|
def ssh(vm_name = nil)
|
9
|
-
|
10
|
+
case vm_name
|
11
|
+
when "dev"
|
10
12
|
ssh_development(vm_name)
|
13
|
+
when "staging"
|
14
|
+
ssh_staging(vm_name)
|
11
15
|
else
|
12
16
|
puts "Development SSH Commands:"
|
13
17
|
puts " dogids ssh dev # SSH into local development VM"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require "thor"
|
2
|
+
|
3
|
+
module Dogids
|
4
|
+
class Cli < Thor
|
5
|
+
no_commands do
|
6
|
+
def ssh_staging(vm_name = nil)
|
7
|
+
if vm_name == "staging"
|
8
|
+
puts "Running: ssh -R 52698:localhost:52698 dogids@staging.dogids.com"
|
9
|
+
exec("ssh -R 52698:localhost:52698 dogids@staging.dogids.com")
|
10
|
+
else
|
11
|
+
ssh
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/dogids/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dogids-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Pattison
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-ssh
|
@@ -56,11 +56,13 @@ files:
|
|
56
56
|
- lib/dogids.rb
|
57
57
|
- lib/dogids/base.rb
|
58
58
|
- lib/dogids/deploy.rb
|
59
|
+
- lib/dogids/deploy/staging.rb
|
59
60
|
- lib/dogids/deploy/web.rb
|
60
61
|
- lib/dogids/deploy/worker.rb
|
61
62
|
- lib/dogids/ssh.rb
|
62
63
|
- lib/dogids/ssh/development.rb
|
63
64
|
- lib/dogids/ssh/production.rb
|
65
|
+
- lib/dogids/ssh/staging.rb
|
64
66
|
- lib/dogids/version.rb
|
65
67
|
- resources/temp/.keep
|
66
68
|
homepage: https://github.com/dogIDs/dogids-cli
|