dogids-cli 0.0.17 → 0.0.18

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 22377f1ffda1f76eaf473ebcafc7f516e8ab269b
4
- data.tar.gz: 8106ac7bf8e4c0bc95eeb128f176e2d6ee39a53e
3
+ metadata.gz: a5715f59c8f15a73508d68f90827f08aaf9442b7
4
+ data.tar.gz: 72e90240f35f66ed749c35254a71ac731214af91
5
5
  SHA512:
6
- metadata.gz: 643611e0ef961e4e4b2d1b0cd91d241f4d405cc2092cdeadcee968e827cc4f647fdd159d8edfeb30b5618d413121c05b0ed9a60962caac0c7048fb382996331a
7
- data.tar.gz: becf21f41e184622904b1141f62c9fdeecc85e790220e89914394d0428922f3873d95e8dd823415b08cc50860b145e739ecee52497dad818e59be2b2de47a166
6
+ metadata.gz: 6d41c119785593d2962222782d6b9e21dcff030b5a4eecb579c7ef0f6e5a650e745680643101e62f02217b35e48e3d6b984dda9f7723ba1c7617ae8345a236eb
7
+ data.tar.gz: b5bf3bdc8fac001e168486b1cb0088b338853429e41453247e6b1d19db09b7b14baa8515b70d5bb30fd841330760660c5d7f5666e222a0a1b81c571438704d8a
data/dogids_cli.gemspec CHANGED
@@ -5,7 +5,7 @@ require "dogids/version"
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "dogids-cli"
8
- spec.version = Dogids::VERSION
8
+ spec.version = "0.0.18"
9
9
  spec.authors = ["Brian Pattison"]
10
10
  spec.email = ["brian@brianpattison.com"]
11
11
  spec.summary = "Command line tool for dogIDs tasks"
data/lib/dogids.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require_relative "dogids/base"
2
+ require_relative "dogids/cache"
2
3
  require_relative "dogids/deploy"
3
4
  require_relative "dogids/ssh"
4
5
  require_relative "dogids/version"
@@ -0,0 +1,27 @@
1
+ require "thor"
2
+ require_relative "cache/staging"
3
+ require_relative "cache/production"
4
+ require_relative "cache/development"
5
+
6
+ module Dogids
7
+ class Cli < Thor
8
+ desc "cache", "List available cache commands"
9
+ def cache(env_name = nil)
10
+ puts " "
11
+ puts "Cache Commands:"
12
+ puts " "
13
+ puts " dogids cache:dev clear # Clear whole cache for the dogids.dev storefront"
14
+ puts " dogids cache:dev category # Clear category cache for the dogids.dev storefront"
15
+ puts " dogids cache:dev qa # Clear Q&A cache for the dogids.dev storefront"
16
+ puts " "
17
+ 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.dev storefront"
19
+ puts " dogids cache:staging qa # Clear Q&A cache for the staging.dogids.com storefront"
20
+ puts " "
21
+ puts " dogids cache:production clear # Clear whole cache for the dogids.com storefront"
22
+ puts " dogids cache:production category # Clear category cache for the dogids.dev storefront"
23
+ puts " dogids cache:production qa # Clear Q&A cache for the dogids.com storefront"
24
+ puts " "
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,73 @@
1
+ require "net/ssh"
2
+ require "thor"
3
+
4
+ module Dogids
5
+ class Cli < Thor
6
+ no_commands do
7
+ def cache_dev(vm_name = nil)
8
+ case vm_name
9
+ when "category"
10
+ print_heading("Checking the category reviews cache")
11
+ Net::SSH.start("55.55.55.20", "dogids") do |ssh|
12
+ ssh.exec!(count_category_cache_files_dev_command) do |_channel, _stream, data|
13
+ print_command("Current category reviews: " + data)
14
+ end
15
+ if yes?("-----> Continue with clearing the cache? [no]")
16
+ print_heading("Clearing the development category cache")
17
+ ssh.exec!(clear_category_cache_dev_command) do |_channel, _stream, data|
18
+ end
19
+ end
20
+ end
21
+ when "clear"
22
+ print_heading("Let's start clearing the entire dev cache")
23
+ cache_dev("category")
24
+ cache_dev("qa")
25
+ when "qa"
26
+ print_heading("Checking the product Q&A cache")
27
+ Net::SSH.start("55.55.55.20", "dogids") do |ssh|
28
+ ssh.exec!(count_qa_cache_files_dev_command) do |_channel, _stream, data|
29
+ print_command("Current category reviews: " + data)
30
+ end
31
+ if yes?("-----> Continue with clearing this cache? [no]")
32
+ print_heading("Clearing the development QA cache")
33
+ ssh.exec!(clear_qa_cache_dev_command) do |_channel, _stream, data|
34
+ end
35
+ end
36
+ end
37
+ else
38
+ cache
39
+ end
40
+ end
41
+
42
+ private
43
+
44
+ def count_category_cache_files_dev_command
45
+ commands = []
46
+ commands << "cd /apps/dogids.com/ls_file_cache"
47
+ commands << "find . -iname 'category*' | wc -l"
48
+ commands.join("&& ")
49
+ end
50
+
51
+ def count_qa_cache_files_dev_command
52
+ commands = []
53
+ commands << "cd /apps/dogids.com/ls_file_cache"
54
+ commands << "find . -iname 'turnto*' | wc -l"
55
+ commands.join("&& ")
56
+ end
57
+
58
+ def clear_category_cache_dev_command
59
+ commands = []
60
+ commands << "cd /apps/dogids.com/ls_file_cache"
61
+ commands << "sudo find . -type f -iname 'category*' -delete"
62
+ commands.join("&&")
63
+ end
64
+
65
+ def clear_qa_cache_dev_command
66
+ commands = []
67
+ commands << "cd /apps/dogids.com/ls_file_cache"
68
+ commands << "sudo find . -type f -iname 'turnto*' -delete"
69
+ commands.join("&&")
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,73 @@
1
+ require "net/ssh"
2
+ require "thor"
3
+
4
+ module Dogids
5
+ class Cli < Thor
6
+ no_commands do
7
+ def cache_production(vm_name = nil)
8
+ case vm_name
9
+ when "category"
10
+ print_heading("Checking the category reviews cache")
11
+ Net::SSH.start("web2.dogids.codelation.net", "dogids") do |ssh|
12
+ ssh.exec!(count_category_cache_files_production_command) do |_channel, _stream, data|
13
+ print_command("Current category reviews: " + data)
14
+ end
15
+ if yes?("-----> Continue with clearing the cache? [no]")
16
+ print_heading("Clearing the production category cache")
17
+ ssh.exec!(clear_category_cache_production_command) do |_channel, _stream, data|
18
+ end
19
+ end
20
+ end
21
+ when "clear"
22
+ print_heading("Let's start clearing the entire production cache")
23
+ cache_production("category")
24
+ cache_production("qa")
25
+ when "qa"
26
+ print_heading("Checking the product Q&A cache")
27
+ Net::SSH.start("web2.dogids.codelation.net", "dogids") do |ssh|
28
+ ssh.exec!(count_qa_cache_files_production_command) do |_channel, _stream, data|
29
+ print_command("Current category reviews: " + data)
30
+ end
31
+ if yes?("-----> Continue with clearing this cache? [no]")
32
+ print_heading("Clearing the production QA cache")
33
+ ssh.exec!(clear_qa_cache_production_command) do |_channel, _stream, data|
34
+ end
35
+ end
36
+ end
37
+ else
38
+ cache
39
+ end
40
+ end
41
+
42
+ private
43
+
44
+ def count_category_cache_files_production_command
45
+ commands = []
46
+ commands << "cd /home/dogids/apps/dogids.com/ls_file_cache"
47
+ commands << "find . -iname 'category*' | wc -l"
48
+ commands.join("&& ")
49
+ end
50
+
51
+ def count_qa_cache_files_production_command
52
+ commands = []
53
+ commands << "cd /home/dogids/apps/dogids.com/ls_file_cache"
54
+ commands << "find . -iname 'turnto*' | wc -l"
55
+ commands.join("&& ")
56
+ end
57
+
58
+ def clear_category_cache_production_command
59
+ commands = []
60
+ commands << "cd /home/dogids/apps/dogids.com/ls_file_cache"
61
+ commands << "sudo find . -type f -iname 'category*' -delete"
62
+ commands.join("&&")
63
+ end
64
+
65
+ def clear_qa_cache_production_command
66
+ commands = []
67
+ commands << "cd /home/dogids/apps/dogids.com/ls_file_cache"
68
+ commands << "sudo find . -type f -iname 'turnto*' -delete"
69
+ commands.join("&&")
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,73 @@
1
+ require "net/ssh"
2
+ require "thor"
3
+
4
+ module Dogids
5
+ class Cli < Thor
6
+ no_commands do
7
+ def cache_staging(vm_name = nil)
8
+ case vm_name
9
+ when "category"
10
+ print_heading("Checking the category reviews cache")
11
+ Net::SSH.start("staging.dogids.com", "dogids") do |ssh|
12
+ ssh.exec!(count_category_cache_files_staging_command) do |_channel, _stream, data|
13
+ print_command("Current category reviews: " + data)
14
+ end
15
+ if yes?("-----> Continue with clearing the cache? [no]")
16
+ print_heading("Clearing the staging category cache")
17
+ ssh.exec!(clear_category_cache_staging_command) do |_channel, _stream, data|
18
+ end
19
+ end
20
+ end
21
+ when "clear"
22
+ print_heading("Let's start clearing the entire staging cache")
23
+ cache_staging("category")
24
+ cache_staging("qa")
25
+ when "qa"
26
+ print_heading("Checking the product Q&A cache")
27
+ Net::SSH.start("staging.dogids.com", "dogids") do |ssh|
28
+ ssh.exec!(count_qa_cache_files_staging_command) do |_channel, _stream, data|
29
+ print_command("Current category reviews: " + data)
30
+ end
31
+ if yes?("-----> Continue with clearing this cache? [no]")
32
+ print_heading("Clearing the staging QA cache")
33
+ ssh.exec!(clear_qa_cache_staging_command) do |_channel, _stream, data|
34
+ end
35
+ end
36
+ end
37
+ else
38
+ cache
39
+ end
40
+ end
41
+
42
+ private
43
+
44
+ def count_category_cache_files_staging_command
45
+ commands = []
46
+ commands << "cd /home/dogids/apps/dogids.com/ls_file_cache"
47
+ commands << "find . -iname 'category*' | wc -l"
48
+ commands.join("&& ")
49
+ end
50
+
51
+ def count_qa_cache_files_staging_command
52
+ commands = []
53
+ commands << "cd /home/dogids/apps/dogids.com/ls_file_cache"
54
+ commands << "find . -iname 'turnto*' | wc -l"
55
+ commands.join("&& ")
56
+ end
57
+
58
+ def clear_category_cache_staging_command
59
+ commands = []
60
+ commands << "cd /home/dogids/apps/dogids.com/ls_file_cache"
61
+ commands << "sudo find . -type f -iname 'category*' -delete"
62
+ commands.join("&&")
63
+ end
64
+
65
+ def clear_qa_cache_staging_command
66
+ commands = []
67
+ commands << "cd /home/dogids/apps/dogids.com/ls_file_cache"
68
+ commands << "sudo find . -type f -iname 'turnto*' -delete"
69
+ commands.join("&&")
70
+ end
71
+ end
72
+ end
73
+ end
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.17
4
+ version: 0.0.18
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-12-28 00:00:00.000000000 Z
11
+ date: 2016-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh
@@ -55,6 +55,10 @@ files:
55
55
  - dogids_cli.gemspec
56
56
  - lib/dogids.rb
57
57
  - lib/dogids/base.rb
58
+ - lib/dogids/cache.rb
59
+ - lib/dogids/cache/development.rb
60
+ - lib/dogids/cache/production.rb
61
+ - lib/dogids/cache/staging.rb
58
62
  - lib/dogids/deploy.rb
59
63
  - lib/dogids/deploy/staging.rb
60
64
  - lib/dogids/deploy/web.rb
@@ -90,4 +94,3 @@ signing_key:
90
94
  specification_version: 4
91
95
  summary: Command line tool for dogIDs tasks
92
96
  test_files: []
93
- has_rdoc: