dogids-cli 0.0.18 → 0.0.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/LICENSE +1 -1
- data/dogids_cli.gemspec +4 -3
- data/lib/dogids.rb +1 -0
- data/lib/dogids/base.rb +20 -0
- data/lib/dogids/cache.rb +10 -4
- data/lib/dogids/cache/development.rb +59 -2
- data/lib/dogids/cache/production.rb +59 -2
- data/lib/dogids/cache/staging.rb +58 -2
- data/lib/dogids/config.rb +81 -0
- data/lib/dogids/deploy/staging.rb +2 -1
- data/lib/dogids/deploy/web.rb +7 -4
- data/lib/dogids/deploy/worker.rb +4 -1
- data/lib/dogids/ssh/development.rb +3 -2
- data/lib/dogids/ssh/production.rb +20 -8
- data/lib/dogids/ssh/staging.rb +5 -2
- data/lib/dogids/version.rb +1 -1
- metadata +19 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80ec59b468779ec530624feea1a184e87c5eeccb
|
4
|
+
data.tar.gz: f652dddd35193576e00b7ee519e345c282397cda
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e77351ed55840edeec18537708a8862f7dfcaaaf90b36a99c73762fcccd1482c3edda42ce060c7ee73494ab0a25db7bb058d923331a466f9ef136edb28785f8f
|
7
|
+
data.tar.gz: bc8998bb6d8e5706414f0a6e13c08ab251a04d58d459eb0355a173a1ffcb1c3b989cead1a06794a50bbdc8c53bd296b3d3ffefb76cf397aee0908fa1cec4b087
|
data/Gemfile
CHANGED
data/LICENSE
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
Name: dogids-cli
|
2
|
-
Copyright (c)
|
2
|
+
Copyright (c) 2016 Brian Pattison, Jaryd Krishnan
|
3
3
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
5
5
|
|
data/dogids_cli.gemspec
CHANGED
@@ -5,9 +5,9 @@ require "dogids/version"
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "dogids-cli"
|
8
|
-
spec.version = "0.0.
|
9
|
-
spec.authors = ["
|
10
|
-
spec.email = ["
|
8
|
+
spec.version = "0.0.19"
|
9
|
+
spec.authors = ["Jaryd Krishnan"]
|
10
|
+
spec.email = ["jaryd@dogids.com"]
|
11
11
|
spec.summary = "Command line tool for dogIDs tasks"
|
12
12
|
spec.homepage = "https://github.com/dogIDs/dogids-cli"
|
13
13
|
spec.license = "MIT"
|
@@ -18,4 +18,5 @@ Gem::Specification.new do |spec|
|
|
18
18
|
|
19
19
|
spec.add_dependency "net-ssh", "~> 2.9"
|
20
20
|
spec.add_dependency "thor", "~> 0.19"
|
21
|
+
spec.add_dependency "user_config", "~> 0.0.4"
|
21
22
|
end
|
data/lib/dogids.rb
CHANGED
data/lib/dogids/base.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require "json"
|
2
2
|
require "net/http"
|
3
3
|
require "thor"
|
4
|
+
require "user_config"
|
4
5
|
|
5
6
|
module Dogids
|
6
7
|
class Cli < Thor
|
@@ -40,6 +41,18 @@ module Dogids
|
|
40
41
|
|
41
42
|
private
|
42
43
|
|
44
|
+
def get_config_url(location)
|
45
|
+
config_file = set_config_location
|
46
|
+
if config_file.key?("#{location}") then
|
47
|
+
return config_file["#{location}"]
|
48
|
+
else
|
49
|
+
say("URL/IP hasn't been set for #{location} \n")
|
50
|
+
say("Please set this first by running: \n")
|
51
|
+
say("dogids config #{location}","\e[32m")
|
52
|
+
return false
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
43
56
|
# Print a heading to the terminal for commands that are going to be run.
|
44
57
|
# @param heading [String]
|
45
58
|
def print_heading(heading)
|
@@ -60,5 +73,12 @@ module Dogids
|
|
60
73
|
print_command(command)
|
61
74
|
`#{command}`
|
62
75
|
end
|
76
|
+
|
77
|
+
# Access local configuration file
|
78
|
+
# @param file [String]
|
79
|
+
def set_config_location
|
80
|
+
config = UserConfig.new('.dogids')
|
81
|
+
config['conf.yaml']
|
82
|
+
end
|
63
83
|
end
|
64
84
|
end
|
data/lib/dogids/cache.rb
CHANGED
@@ -12,15 +12,21 @@ module Dogids
|
|
12
12
|
puts " "
|
13
13
|
puts " dogids cache:dev clear # Clear whole cache for the dogids.dev storefront"
|
14
14
|
puts " dogids cache:dev category # Clear category cache for the dogids.dev storefront"
|
15
|
+
puts " dogids cache:dev css # Clear CSS cache for the dogids.dev storefront"
|
16
|
+
puts " dogids cache:dev javascript # Clear Javascript cache for the dogids.dev storefront"
|
15
17
|
puts " dogids cache:dev qa # Clear Q&A cache for the dogids.dev storefront"
|
16
18
|
puts " "
|
17
19
|
puts " dogids cache:staging clear # Clear whole cache for the staging.dogids.com storefront"
|
18
|
-
puts " dogids cache:staging category # Clear category cache for the dogids.
|
20
|
+
puts " dogids cache:staging category # Clear category cache for the staging.dogids.com storefront"
|
21
|
+
puts " dogids cache:staging css # Clear CSS cache for the staging.dogids.com storefront"
|
22
|
+
puts " dogids cache:staging javascript # Clear Javascript cache for the staging.dogids.com storefront"
|
19
23
|
puts " dogids cache:staging qa # Clear Q&A cache for the staging.dogids.com storefront"
|
20
24
|
puts " "
|
21
|
-
puts " dogids cache:production clear
|
22
|
-
puts " dogids cache:production category
|
23
|
-
puts " dogids cache:production
|
25
|
+
puts " dogids cache:production clear # Clear whole cache for the dogids.com storefront"
|
26
|
+
puts " dogids cache:production category # Clear category cache for the dogids.dev storefront"
|
27
|
+
puts " dogids cache:production css # Clear CSS cache for the production.dogids.com storefront"
|
28
|
+
puts " dogids cache:production javascript # Clear Javascript cache for the production.dogids.com storefront"
|
29
|
+
puts " dogids cache:production qa # Clear Q&A cache for the dogids.com storefront"
|
24
30
|
puts " "
|
25
31
|
end
|
26
32
|
end
|
@@ -5,10 +5,13 @@ module Dogids
|
|
5
5
|
class Cli < Thor
|
6
6
|
no_commands do
|
7
7
|
def cache_dev(vm_name = nil)
|
8
|
+
ssh_address = get_config_url("dev")
|
9
|
+
return if ssh_address == false
|
10
|
+
|
8
11
|
case vm_name
|
9
12
|
when "category"
|
10
13
|
print_heading("Checking the category reviews cache")
|
11
|
-
Net::SSH.start("
|
14
|
+
Net::SSH.start("#{ssh_address}", "dogids") do |ssh|
|
12
15
|
ssh.exec!(count_category_cache_files_dev_command) do |_channel, _stream, data|
|
13
16
|
print_command("Current category reviews: " + data)
|
14
17
|
end
|
@@ -22,9 +25,35 @@ module Dogids
|
|
22
25
|
print_heading("Let's start clearing the entire dev cache")
|
23
26
|
cache_dev("category")
|
24
27
|
cache_dev("qa")
|
28
|
+
cache_dev("javascript")
|
29
|
+
cache_dev("css")
|
30
|
+
when "css"
|
31
|
+
print_heading("Checking the CSS cache")
|
32
|
+
Net::SSH.start("#{ssh_address}", "dogids") do |ssh|
|
33
|
+
ssh.exec!(count_css_cache_files_dev_command) do |_channel, _stream, data|
|
34
|
+
print_command("Current CSS cache files: " + data)
|
35
|
+
end
|
36
|
+
if yes?("-----> Continue with clearing the CSS cache? [no]")
|
37
|
+
print_heading("Clearing the development CSS cache")
|
38
|
+
ssh.exec!(clear_css_cache_dev_command) do |_channel, _stream, data|
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
when "javascript"
|
43
|
+
print_heading("Checking the Javascript cache")
|
44
|
+
Net::SSH.start("#{ssh_address}", "dogids") do |ssh|
|
45
|
+
ssh.exec!(count_javascript_cache_files_dev_command) do |_channel, _stream, data|
|
46
|
+
print_command("Current Javascript cache files: " + data)
|
47
|
+
end
|
48
|
+
if yes?("-----> Continue with clearing the Javascript cache? [no]")
|
49
|
+
print_heading("Clearing the development Javascript cache")
|
50
|
+
ssh.exec!(clear_javascript_cache_dev_command) do |_channel, _stream, data|
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
25
54
|
when "qa"
|
26
55
|
print_heading("Checking the product Q&A cache")
|
27
|
-
Net::SSH.start("
|
56
|
+
Net::SSH.start("#{ssh_address}", "dogids") do |ssh|
|
28
57
|
ssh.exec!(count_qa_cache_files_dev_command) do |_channel, _stream, data|
|
29
58
|
print_command("Current category reviews: " + data)
|
30
59
|
end
|
@@ -55,6 +84,20 @@ module Dogids
|
|
55
84
|
commands.join("&& ")
|
56
85
|
end
|
57
86
|
|
87
|
+
def count_javascript_cache_files_dev_command
|
88
|
+
commands = []
|
89
|
+
commands << "cd /apps/dogids.com/temp/resource_cache"
|
90
|
+
commands << "find . -iname '*.javascript.gz' | wc -l"
|
91
|
+
commands.join("&& ")
|
92
|
+
end
|
93
|
+
|
94
|
+
def count_css_cache_files_dev_command
|
95
|
+
commands = []
|
96
|
+
commands << "cd /apps/dogids.com/temp/resource_cache"
|
97
|
+
commands << "find . -iname '*.css.gz' | wc -l"
|
98
|
+
commands.join("&& ")
|
99
|
+
end
|
100
|
+
|
58
101
|
def clear_category_cache_dev_command
|
59
102
|
commands = []
|
60
103
|
commands << "cd /apps/dogids.com/ls_file_cache"
|
@@ -62,6 +105,20 @@ module Dogids
|
|
62
105
|
commands.join("&&")
|
63
106
|
end
|
64
107
|
|
108
|
+
def clear_css_cache_dev_command
|
109
|
+
commands = []
|
110
|
+
commands << "cd /apps/dogids.com/temp/resource_cache"
|
111
|
+
commands << "sudo find . -type f -iname '*.css.gz' -delete"
|
112
|
+
commands.join("&&")
|
113
|
+
end
|
114
|
+
|
115
|
+
def clear_javascript_cache_dev_command
|
116
|
+
commands = []
|
117
|
+
commands << "cd /apps/dogids.com/temp/resource_cache"
|
118
|
+
commands << "sudo find . -type f -iname '*.javascript.gz' -delete"
|
119
|
+
commands.join("&&")
|
120
|
+
end
|
121
|
+
|
65
122
|
def clear_qa_cache_dev_command
|
66
123
|
commands = []
|
67
124
|
commands << "cd /apps/dogids.com/ls_file_cache"
|
@@ -5,10 +5,13 @@ module Dogids
|
|
5
5
|
class Cli < Thor
|
6
6
|
no_commands do
|
7
7
|
def cache_production(vm_name = nil)
|
8
|
+
ssh_address = get_config_url("web")
|
9
|
+
return if ssh_address == false
|
10
|
+
|
8
11
|
case vm_name
|
9
12
|
when "category"
|
10
13
|
print_heading("Checking the category reviews cache")
|
11
|
-
Net::SSH.start("
|
14
|
+
Net::SSH.start("#{ssh_address}", "dogids") do |ssh|
|
12
15
|
ssh.exec!(count_category_cache_files_production_command) do |_channel, _stream, data|
|
13
16
|
print_command("Current category reviews: " + data)
|
14
17
|
end
|
@@ -22,9 +25,35 @@ module Dogids
|
|
22
25
|
print_heading("Let's start clearing the entire production cache")
|
23
26
|
cache_production("category")
|
24
27
|
cache_production("qa")
|
28
|
+
cache_dev("javascript")
|
29
|
+
cache_dev("css")
|
30
|
+
when "css"
|
31
|
+
print_heading("Checking the CSS cache")
|
32
|
+
Net::SSH.start("#{ssh_address}", "dogids") do |ssh|
|
33
|
+
ssh.exec!(count_css_cache_files_production_command) do |_channel, _stream, data|
|
34
|
+
print_command("Current CSS cache files: " + data)
|
35
|
+
end
|
36
|
+
if yes?("-----> Continue with clearing the CSS cache? [no]")
|
37
|
+
print_heading("Clearing the development CSS cache")
|
38
|
+
ssh.exec!(clear_css_cache_production_command) do |_channel, _stream, data|
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
when "javascript"
|
43
|
+
print_heading("Checking the Javascript cache")
|
44
|
+
Net::SSH.start("#{ssh_address}", "dogids") do |ssh|
|
45
|
+
ssh.exec!(count_javascript_cache_files_production_command) do |_channel, _stream, data|
|
46
|
+
print_command("Current Javascript cache files: " + data)
|
47
|
+
end
|
48
|
+
if yes?("-----> Continue with clearing the Javascript cache? [no]")
|
49
|
+
print_heading("Clearing the development Javascript cache")
|
50
|
+
ssh.exec!(clear_javascript_cache_production_command) do |_channel, _stream, data|
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
25
54
|
when "qa"
|
26
55
|
print_heading("Checking the product Q&A cache")
|
27
|
-
Net::SSH.start("
|
56
|
+
Net::SSH.start("#{ssh_address}", "dogids") do |ssh|
|
28
57
|
ssh.exec!(count_qa_cache_files_production_command) do |_channel, _stream, data|
|
29
58
|
print_command("Current category reviews: " + data)
|
30
59
|
end
|
@@ -55,6 +84,20 @@ module Dogids
|
|
55
84
|
commands.join("&& ")
|
56
85
|
end
|
57
86
|
|
87
|
+
def count_javascript_cache_files_production_command
|
88
|
+
commands = []
|
89
|
+
commands << "cd /home/dogids/apps/dogids.com/temp/resource_cache"
|
90
|
+
commands << "find . -iname '*.javascript.gz' | wc -l"
|
91
|
+
commands.join("&& ")
|
92
|
+
end
|
93
|
+
|
94
|
+
def count_css_cache_files_production_command
|
95
|
+
commands = []
|
96
|
+
commands << "cd /home/dogids/apps/dogids.com/temp/resource_cache"
|
97
|
+
commands << "find . -iname '*.css.gz' | wc -l"
|
98
|
+
commands.join("&& ")
|
99
|
+
end
|
100
|
+
|
58
101
|
def clear_category_cache_production_command
|
59
102
|
commands = []
|
60
103
|
commands << "cd /home/dogids/apps/dogids.com/ls_file_cache"
|
@@ -68,6 +111,20 @@ module Dogids
|
|
68
111
|
commands << "sudo find . -type f -iname 'turnto*' -delete"
|
69
112
|
commands.join("&&")
|
70
113
|
end
|
114
|
+
|
115
|
+
def clear_css_cache_production_command
|
116
|
+
commands = []
|
117
|
+
commands << "cd /home/dogids/apps/dogids.com/temp/resource_cache"
|
118
|
+
commands << "sudo find . -type f -iname '*.css.gz' -delete"
|
119
|
+
commands.join("&&")
|
120
|
+
end
|
121
|
+
|
122
|
+
def clear_javascript_cache_production_command
|
123
|
+
commands = []
|
124
|
+
commands << "cd /home/dogids/apps/dogids.com/temp/resource_cache"
|
125
|
+
commands << "sudo find . -type f -iname '*.javascript.gz' -delete"
|
126
|
+
commands.join("&&")
|
127
|
+
end
|
71
128
|
end
|
72
129
|
end
|
73
130
|
end
|
data/lib/dogids/cache/staging.rb
CHANGED
@@ -5,10 +5,12 @@ module Dogids
|
|
5
5
|
class Cli < Thor
|
6
6
|
no_commands do
|
7
7
|
def cache_staging(vm_name = nil)
|
8
|
+
ssh_address = get_config_url("staging")
|
9
|
+
return if ssh_address == false
|
8
10
|
case vm_name
|
9
11
|
when "category"
|
10
12
|
print_heading("Checking the category reviews cache")
|
11
|
-
Net::SSH.start("
|
13
|
+
Net::SSH.start("#{ssh_address}", "dogids") do |ssh|
|
12
14
|
ssh.exec!(count_category_cache_files_staging_command) do |_channel, _stream, data|
|
13
15
|
print_command("Current category reviews: " + data)
|
14
16
|
end
|
@@ -22,9 +24,35 @@ module Dogids
|
|
22
24
|
print_heading("Let's start clearing the entire staging cache")
|
23
25
|
cache_staging("category")
|
24
26
|
cache_staging("qa")
|
27
|
+
cache_dev("javascript")
|
28
|
+
cache_dev("css")
|
29
|
+
when "css"
|
30
|
+
print_heading("Checking the CSS cache")
|
31
|
+
Net::SSH.start("#{ssh_address}", "dogids") do |ssh|
|
32
|
+
ssh.exec!(count_css_cache_files_staging_command) do |_channel, _stream, data|
|
33
|
+
print_command("Current CSS cache files: " + data)
|
34
|
+
end
|
35
|
+
if yes?("-----> Continue with clearing the CSS cache? [no]")
|
36
|
+
print_heading("Clearing the development CSS cache")
|
37
|
+
ssh.exec!(clear_css_cache_staging_command) do |_channel, _stream, data|
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
when "javascript"
|
42
|
+
print_heading("Checking the Javascript cache")
|
43
|
+
Net::SSH.start("#{ssh_address}", "dogids") do |ssh|
|
44
|
+
ssh.exec!(count_javascript_cache_files_staging_command) do |_channel, _stream, data|
|
45
|
+
print_command("Current Javascript cache files: " + data)
|
46
|
+
end
|
47
|
+
if yes?("-----> Continue with clearing the Javascript cache? [no]")
|
48
|
+
print_heading("Clearing the development Javascript cache")
|
49
|
+
ssh.exec!(clear_javascript_cache_staging_command) do |_channel, _stream, data|
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
25
53
|
when "qa"
|
26
54
|
print_heading("Checking the product Q&A cache")
|
27
|
-
Net::SSH.start("
|
55
|
+
Net::SSH.start("#{ssh_address}", "dogids") do |ssh|
|
28
56
|
ssh.exec!(count_qa_cache_files_staging_command) do |_channel, _stream, data|
|
29
57
|
print_command("Current category reviews: " + data)
|
30
58
|
end
|
@@ -55,6 +83,20 @@ module Dogids
|
|
55
83
|
commands.join("&& ")
|
56
84
|
end
|
57
85
|
|
86
|
+
def count_javascript_cache_files_staging_command
|
87
|
+
commands = []
|
88
|
+
commands << "cd /home/dogids/apps/dogids.com/temp/resource_cache"
|
89
|
+
commands << "find . -iname '*.javascript.gz' | wc -l"
|
90
|
+
commands.join("&& ")
|
91
|
+
end
|
92
|
+
|
93
|
+
def count_css_cache_files_staging_command
|
94
|
+
commands = []
|
95
|
+
commands << "cd /home/dogids/apps/dogids.com/temp/resource_cache"
|
96
|
+
commands << "find . -iname '*.css.gz' | wc -l"
|
97
|
+
commands.join("&& ")
|
98
|
+
end
|
99
|
+
|
58
100
|
def clear_category_cache_staging_command
|
59
101
|
commands = []
|
60
102
|
commands << "cd /home/dogids/apps/dogids.com/ls_file_cache"
|
@@ -68,6 +110,20 @@ module Dogids
|
|
68
110
|
commands << "sudo find . -type f -iname 'turnto*' -delete"
|
69
111
|
commands.join("&&")
|
70
112
|
end
|
113
|
+
|
114
|
+
def clear_css_cache_staging_command
|
115
|
+
commands = []
|
116
|
+
commands << "cd /home/dogids/apps/dogids.com/temp/resource_cache"
|
117
|
+
commands << "sudo find . -type f -iname '*.css.gz' -delete"
|
118
|
+
commands.join("&&")
|
119
|
+
end
|
120
|
+
|
121
|
+
def clear_javascript_cache_staging_command
|
122
|
+
commands = []
|
123
|
+
commands << "cd /home/dogids/apps/dogids.com/temp/resource_cache"
|
124
|
+
commands << "sudo find . -type f -iname '*.javascript.gz' -delete"
|
125
|
+
commands.join("&&")
|
126
|
+
end
|
71
127
|
end
|
72
128
|
end
|
73
129
|
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
require "thor"
|
2
|
+
require "user_config"
|
3
|
+
|
4
|
+
module Dogids
|
5
|
+
class Cli < Thor
|
6
|
+
desc "config", "Configure URLs/IP Addresses"
|
7
|
+
def config(command = nil)
|
8
|
+
# Commands
|
9
|
+
case command
|
10
|
+
when "list"
|
11
|
+
list
|
12
|
+
when "admin"
|
13
|
+
set_config("admin")
|
14
|
+
when "db"
|
15
|
+
set_config("db")
|
16
|
+
when "dev"
|
17
|
+
set_config("dev")
|
18
|
+
when "staging"
|
19
|
+
set_config("staging")
|
20
|
+
when "web"
|
21
|
+
set_config("web")
|
22
|
+
when "worker"
|
23
|
+
set_config("worker")
|
24
|
+
else
|
25
|
+
puts " "
|
26
|
+
puts "Config Commands:"
|
27
|
+
puts " "
|
28
|
+
puts " dogids config list # List all current configurations"
|
29
|
+
puts " "
|
30
|
+
puts " dogids config admin # Set URL/IP for Admin"
|
31
|
+
puts " dogids config db # Set URL/IP for DB"
|
32
|
+
puts " dogids config dev # Set URL/IP for Dev"
|
33
|
+
puts " dogids config staging # Set URL/IP for Staging"
|
34
|
+
puts " dogids config web # Set URL/IP for Web"
|
35
|
+
puts " dogids config worker # Set URL/IP for Worker"
|
36
|
+
puts " "
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
no_commands do
|
41
|
+
def list
|
42
|
+
dogids_config = set_config_location
|
43
|
+
if dogids_config.any? then
|
44
|
+
say("The following configurations are set: \n \n")
|
45
|
+
print_table(dogids_config)
|
46
|
+
else
|
47
|
+
say("No configuration values have been set. Here's the command list:")
|
48
|
+
config
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def set_config(location)
|
53
|
+
dogids_config = set_config_location
|
54
|
+
current_value = ""
|
55
|
+
if dogids_config.key?("#{location}") then
|
56
|
+
current_value = dogids_config["#{location}"]
|
57
|
+
say("Current #{location} URL/IP: #{current_value} \n","\e[32m")
|
58
|
+
set_new = yes?("-------> Do you want to enter a new value?[no]")
|
59
|
+
return if set_new != true
|
60
|
+
end
|
61
|
+
new_value = ask("Enter in a URL/IP for #{location}: ").strip
|
62
|
+
if (new_value == "" || new_value == current_value )then
|
63
|
+
say("Now you're just being silly. ")
|
64
|
+
if (new_value == "") then
|
65
|
+
say("In case it wasn't clear, you are supposed to set a value...")
|
66
|
+
confirm_string = "REMOVE the old value"
|
67
|
+
else
|
68
|
+
say("You are literally about to change nothing")
|
69
|
+
confirm_string = "literally do nothing"
|
70
|
+
end
|
71
|
+
confirm = yes?("-------> Do you want to #{confirm_string}?[no]")
|
72
|
+
return if confirm != true
|
73
|
+
end
|
74
|
+
dogids_config["#{location}"] = new_value
|
75
|
+
dogids_config.save
|
76
|
+
say("The new URL/IP for #{location}: #{new_value}","\e[32m")
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
end
|
@@ -6,8 +6,9 @@ module Dogids
|
|
6
6
|
no_commands do
|
7
7
|
def deploy_staging
|
8
8
|
print_heading("Deploying dogids.com site to staging server")
|
9
|
+
ssh_address = get_config_url("staging")
|
9
10
|
|
10
|
-
Net::SSH.start("
|
11
|
+
Net::SSH.start("#{ssh_address}", "dogids") do |ssh|
|
11
12
|
print_command("Checking the current git status")
|
12
13
|
ssh.exec!(staging_git_status_command) do |_channel, _stream, data|
|
13
14
|
print_command(data)
|
data/lib/dogids/deploy/web.rb
CHANGED
@@ -8,14 +8,17 @@ module Dogids
|
|
8
8
|
print_heading("Deploying dogids.com")
|
9
9
|
|
10
10
|
server_addresses = [
|
11
|
-
"
|
12
|
-
"admin
|
11
|
+
"web",
|
12
|
+
"admin"
|
13
13
|
]
|
14
14
|
|
15
15
|
server_addresses.each do |server_address|
|
16
|
-
|
16
|
+
ssh_address = get_config_url("#{server_address}")
|
17
|
+
next if ssh_address == false
|
17
18
|
|
18
|
-
|
19
|
+
print_command("Server(#{server_address}): #{ssh_address}")
|
20
|
+
|
21
|
+
Net::SSH.start(ssh_address, "dogids") do |ssh|
|
19
22
|
print_command("Checking the current git status")
|
20
23
|
ssh.exec!(web_git_status_command) do |_channel, _stream, data|
|
21
24
|
print_command(data)
|
data/lib/dogids/deploy/worker.rb
CHANGED
@@ -5,9 +5,12 @@ module Dogids
|
|
5
5
|
class Cli < Thor
|
6
6
|
no_commands do
|
7
7
|
def deploy_worker
|
8
|
+
ssh_address = get_config_url("worker")
|
9
|
+
return if ssh_address == false
|
10
|
+
|
8
11
|
print_heading("Deploying dogids-backgrounder")
|
9
12
|
|
10
|
-
Net::SSH.start("
|
13
|
+
Net::SSH.start("#{ssh_address}", "dogids") do |ssh|
|
11
14
|
print_command("Pulling latest from master")
|
12
15
|
ssh.exec!(worker_git_pull_command) do |_channel, _stream, data|
|
13
16
|
print_command(data)
|
@@ -5,8 +5,9 @@ module Dogids
|
|
5
5
|
no_commands do
|
6
6
|
def ssh_development(vm_name = nil)
|
7
7
|
if vm_name == "dev"
|
8
|
-
|
9
|
-
|
8
|
+
ssh_address = get_config_url(vm_name)
|
9
|
+
puts "Running: ssh -R 52698:localhost:52698 dogids@#{ssh_address}"
|
10
|
+
exec("ssh -R 52698:localhost:52698 dogids@#{ssh_address}")
|
10
11
|
else
|
11
12
|
ssh
|
12
13
|
end
|
@@ -6,17 +6,29 @@ module Dogids
|
|
6
6
|
def ssh_production(vm_name = nil)
|
7
7
|
case vm_name
|
8
8
|
when "admin"
|
9
|
-
|
10
|
-
|
9
|
+
ssh_address = get_config_url(vm_name)
|
10
|
+
if ssh_address then
|
11
|
+
puts "Running: `ssh -R 52698:localhost:52698 dogids@#{ssh_address}`"
|
12
|
+
exec("ssh -R 52698:localhost:52698 dogids@#{ssh_address}")
|
13
|
+
end
|
11
14
|
when "db"
|
12
|
-
|
13
|
-
|
15
|
+
ssh_address = get_config_url(vm_name)
|
16
|
+
if ssh_address then
|
17
|
+
puts "Running: `ssh -R 52698:localhost:52698 dogids@#{ssh_address}`"
|
18
|
+
exec("ssh -R 52698:localhost:52698 dogids@#{ssh_address}")
|
19
|
+
end
|
14
20
|
when "web"
|
15
|
-
|
16
|
-
|
21
|
+
ssh_address = get_config_url(vm_name)
|
22
|
+
if ssh_address then
|
23
|
+
puts "Running: `ssh -R 52698:localhost:52698 dogids@#{ssh_address}`"
|
24
|
+
exec("ssh -R 52698:localhost:52698 dogids@#{ssh_address}")
|
25
|
+
end
|
17
26
|
when "worker"
|
18
|
-
|
19
|
-
|
27
|
+
ssh_address = get_config_url(vm_name)
|
28
|
+
if ssh_address then
|
29
|
+
puts "Running: `ssh -R 52698:localhost:52698 dogids@#{ssh_address}`"
|
30
|
+
exec("ssh -R 52698:localhost:52698 dogids@#{ssh_address}")
|
31
|
+
end
|
20
32
|
else
|
21
33
|
ssh
|
22
34
|
end
|
data/lib/dogids/ssh/staging.rb
CHANGED
@@ -5,8 +5,11 @@ module Dogids
|
|
5
5
|
no_commands do
|
6
6
|
def ssh_staging(vm_name = nil)
|
7
7
|
if vm_name == "staging"
|
8
|
-
|
9
|
-
|
8
|
+
ssh_address = get_config_url(vm_name)
|
9
|
+
if ssh_address then
|
10
|
+
puts "Running: ssh -R 52698:localhost:52698 dogids@#{ssh_address}"
|
11
|
+
exec("ssh -R 52698:localhost:52698 dogids@#{ssh_address}")
|
12
|
+
end
|
10
13
|
else
|
11
14
|
ssh
|
12
15
|
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.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Jaryd Krishnan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-ssh
|
@@ -38,9 +38,23 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0.19'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: user_config
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.0.4
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.0.4
|
41
55
|
description:
|
42
56
|
email:
|
43
|
-
-
|
57
|
+
- jaryd@dogids.com
|
44
58
|
executables:
|
45
59
|
- dogids
|
46
60
|
extensions: []
|
@@ -59,6 +73,7 @@ files:
|
|
59
73
|
- lib/dogids/cache/development.rb
|
60
74
|
- lib/dogids/cache/production.rb
|
61
75
|
- lib/dogids/cache/staging.rb
|
76
|
+
- lib/dogids/config.rb
|
62
77
|
- lib/dogids/deploy.rb
|
63
78
|
- lib/dogids/deploy/staging.rb
|
64
79
|
- lib/dogids/deploy/web.rb
|