dogids-cli 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f92adf8b306ac327e96c9858995d75ba71d880a4
4
- data.tar.gz: bab6e4f8879fd69bcd710a935e8c4e1e7a3d3d2e
3
+ metadata.gz: 302e5b6ac613d72561e3418cdd31877f8fddd0f0
4
+ data.tar.gz: 7e6bd6a04180235ae876908e7560a9fd1d2036c1
5
5
  SHA512:
6
- metadata.gz: 8c75d2959c9658db2610d33f0e10db178c80aaba1d89fe89798157ff6a2ad1e89f77db4b51e85e8c81942b7ab2b03ef02101a5d1df0f056d8907728614fe00ac
7
- data.tar.gz: 3b6f3bcc2043460417757a378862ebb0db85490c0eecb8647ffb46aa7ad564d3b829cb4f757ce403108489118f27db4371ff1a3bd7204714a28cdf74eb0ffc99
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
- codelation-cli (0.0.2)
5
- open_uri_redirections (~> 0.2)
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
- open_uri_redirections (0.2.1)
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
- codelation-cli!
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 help [COMMAND] # Describe available commands or one specific command
18
- dogids ssh # List available SSH commands
19
- dogids update # Update dogids-cli to latest version
20
- dogids version # Show version information
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/}) { |f| File.basename(f) }
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
@@ -1,3 +1,4 @@
1
1
  require_relative "dogids/base"
2
+ require_relative "dogids/deploy"
2
3
  require_relative "dogids/ssh"
3
4
  require_relative "dogids/version"
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
- puts " #{command}"
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
@@ -3,7 +3,7 @@ require "open-uri"
3
3
  require "thor"
4
4
 
5
5
  module Dogids
6
- VERSION = "0.0.2"
6
+ VERSION = "0.0.3"
7
7
 
8
8
  class Cli < Thor
9
9
  desc "update", "Update dogids-cli to latest version"
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.2
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-18 00:00:00.000000000 Z
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