dogids-cli 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -8
- data/README.md +5 -4
- data/dogids_cli.gemspec +2 -1
- data/lib/dogids.rb +1 -0
- data/lib/dogids/base.rb +1 -1
- data/lib/dogids/deploy.rb +18 -0
- data/lib/dogids/deploy/web.rb +23 -0
- data/lib/dogids/deploy/worker.rb +30 -0
- data/lib/dogids/version.rb +1 -1
- metadata +19 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 302e5b6ac613d72561e3418cdd31877f8fddd0f0
|
4
|
+
data.tar.gz: 7e6bd6a04180235ae876908e7560a9fd1d2036c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 927e4006c532844c8d78a300511710fad1e3dafd75029f7ae0fa78923705b00840b628c1fd79462e3ecf99643078948f6b063c89e07b9d0b677484e9344521d7
|
7
|
+
data.tar.gz: 3cf09314390d823700040524ca5215b408b46e5dbd00769539cf4cccc595e62388b419d464bb3588c06589093f9b5f715932172a32fa87cfb9b07de7a7e9ca1a
|
data/Gemfile.lock
CHANGED
@@ -1,22 +1,18 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
|
5
|
-
|
6
|
-
progressbar (~> 0.21)
|
7
|
-
rubyzip (~> 1.1)
|
4
|
+
dogids-cli (0.0.2)
|
5
|
+
net-ssh (~> 2.9)
|
8
6
|
thor (~> 0.19)
|
9
7
|
|
10
8
|
GEM
|
11
9
|
remote: https://rubygems.org/
|
12
10
|
specs:
|
13
|
-
|
14
|
-
progressbar (0.21.0)
|
15
|
-
rubyzip (1.1.7)
|
11
|
+
net-ssh (2.9.2)
|
16
12
|
thor (0.19.1)
|
17
13
|
|
18
14
|
PLATFORMS
|
19
15
|
ruby
|
20
16
|
|
21
17
|
DEPENDENCIES
|
22
|
-
|
18
|
+
dogids-cli!
|
data/README.md
CHANGED
@@ -14,10 +14,11 @@ $ gem install dogids-cli
|
|
14
14
|
$ dogids help
|
15
15
|
|
16
16
|
Commands:
|
17
|
-
dogids
|
18
|
-
dogids
|
19
|
-
dogids
|
20
|
-
dogids
|
17
|
+
dogids deploy # List available deployment commands
|
18
|
+
dogids help [COMMAND] # Describe available commands or one specific command
|
19
|
+
dogids ssh # List available SSH commands
|
20
|
+
dogids update # Update dogids-cli to latest version
|
21
|
+
dogids version # Show version information
|
21
22
|
```
|
22
23
|
|
23
24
|
## Contributing
|
data/dogids_cli.gemspec
CHANGED
@@ -13,8 +13,9 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.license = "MIT"
|
14
14
|
|
15
15
|
spec.files = `git ls-files -z`.split("\x0")
|
16
|
-
spec.executables = spec.files.grep(%r{^bin/}) {
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) {|f| File.basename(f) }
|
17
17
|
spec.require_paths = ["lib"]
|
18
18
|
|
19
|
+
spec.add_dependency "net-ssh", "~> 2.9"
|
19
20
|
spec.add_dependency "thor", "~> 0.19"
|
20
21
|
end
|
data/lib/dogids.rb
CHANGED
data/lib/dogids/base.rb
CHANGED
@@ -49,7 +49,7 @@ module Dogids
|
|
49
49
|
# Print a message to the terminal about a command that's going to run.
|
50
50
|
# @param command [String]
|
51
51
|
def print_command(command)
|
52
|
-
|
52
|
+
print_wrapped(command, indent: 7)
|
53
53
|
end
|
54
54
|
|
55
55
|
# Run a command with Bash after first printing the command to the terminal.
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "thor"
|
2
|
+
require_relative "deploy/web"
|
3
|
+
require_relative "deploy/worker"
|
4
|
+
|
5
|
+
module Dogids
|
6
|
+
class Cli < Thor
|
7
|
+
desc "deploy", "List available deployment commands"
|
8
|
+
def deploy(app_name = nil)
|
9
|
+
deploy_command = "deploy_#{app_name}"
|
10
|
+
return self.send(deploy_command) if self.respond_to?(deploy_command)
|
11
|
+
|
12
|
+
puts "Deployment Commands:"
|
13
|
+
puts " dogids deploy web # Deploy the dogids.com storefront"
|
14
|
+
puts " dogids deploy worker # Deploy the dogids-backgrounder app"
|
15
|
+
puts " "
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require "net/ssh"
|
2
|
+
require "thor"
|
3
|
+
|
4
|
+
module Dogids
|
5
|
+
class Cli < Thor
|
6
|
+
no_commands do
|
7
|
+
def deploy_web
|
8
|
+
print_heading("Deploying dogids.com...")
|
9
|
+
|
10
|
+
Net::SSH.start("web1.dogids.codelation.net", "dogids") do |ssh|
|
11
|
+
commands = []
|
12
|
+
commands << "cd apps/dogids.com"
|
13
|
+
commands << "git pull origin master"
|
14
|
+
ssh.exec!(commands.join("&& ")) do |_channel, _stream, data|
|
15
|
+
print_command(data)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
print_heading("Done.")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require "net/ssh"
|
2
|
+
require "thor"
|
3
|
+
|
4
|
+
module Dogids
|
5
|
+
class Cli < Thor
|
6
|
+
no_commands do
|
7
|
+
def deploy_worker
|
8
|
+
print_heading("Deploying dogids-backgrounder...")
|
9
|
+
|
10
|
+
Net::SSH.start("worker1.dogids.codelation.net", "dogids") do |ssh|
|
11
|
+
commands = []
|
12
|
+
commands << "cd apps/dogids-backgrounder"
|
13
|
+
commands << "git pull origin master"
|
14
|
+
ssh.exec!(commands.join("&& ")) do |_channel, _stream, data|
|
15
|
+
print_command(data)
|
16
|
+
end
|
17
|
+
|
18
|
+
if yes?("-----> Do you want to restart Sidekiq? [no]")
|
19
|
+
command = "sudo restart dogids-backgrounder"
|
20
|
+
ssh.exec!(command) do |_channel, _stream, data|
|
21
|
+
print_command(data)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
print_heading("Done.")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/dogids/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
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.3
|
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-03
|
11
|
+
date: 2015-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: net-ssh
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.9'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.9'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: thor
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -41,6 +55,9 @@ files:
|
|
41
55
|
- dogids_cli.gemspec
|
42
56
|
- lib/dogids.rb
|
43
57
|
- lib/dogids/base.rb
|
58
|
+
- lib/dogids/deploy.rb
|
59
|
+
- lib/dogids/deploy/web.rb
|
60
|
+
- lib/dogids/deploy/worker.rb
|
44
61
|
- lib/dogids/ssh.rb
|
45
62
|
- lib/dogids/ssh/development.rb
|
46
63
|
- lib/dogids/ssh/production.rb
|