dogids-cli 0.0.3 → 0.0.4

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: 302e5b6ac613d72561e3418cdd31877f8fddd0f0
4
- data.tar.gz: 7e6bd6a04180235ae876908e7560a9fd1d2036c1
3
+ metadata.gz: 07d0fd4f76b92e76013081f27e9d2cdcf456b7d5
4
+ data.tar.gz: d0dd3752fba28661dea43e02f225ecfce7919af5
5
5
  SHA512:
6
- metadata.gz: 927e4006c532844c8d78a300511710fad1e3dafd75029f7ae0fa78923705b00840b628c1fd79462e3ecf99643078948f6b063c89e07b9d0b677484e9344521d7
7
- data.tar.gz: 3cf09314390d823700040524ca5215b408b46e5dbd00769539cf4cccc595e62388b419d464bb3588c06589093f9b5f715932172a32fa87cfb9b07de7a7e9ca1a
6
+ metadata.gz: 626d46f2093795289f0c5e2fa6f40fb9bbd5cf948252b9b98bdb45433f3def4be06b8e8e21960ba77a26b9e445092ff6c88d7e2f163fb2506bcf68953367c442
7
+ data.tar.gz: 6260df51437a6defeec13d152bed7e87d5408c6eb8d51f826013a12222f00e5d26ae4a7757bab6841e68d16e898f78a2d1371c90aca476a969d455941a72107d
@@ -8,16 +8,66 @@ module Dogids
8
8
  print_heading("Deploying dogids.com...")
9
9
 
10
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|
11
+ print_command("Checking the current git status...")
12
+ ssh.exec!(web_git_status_command) do |_channel, _stream, data|
15
13
  print_command(data)
16
14
  end
15
+
16
+ if yes?("-----> Continue with deployment? [no]")
17
+ print_command("Pulling latest from master...")
18
+ ssh.exec!(web_git_pull_command) do |_channel, _stream, data|
19
+ print_command(data)
20
+ end
21
+
22
+ print_command("Updating file permissions...")
23
+ ssh.exec!(web_update_permissions_command) do |_channel, _stream, data|
24
+ print_command(data)
25
+ end
26
+ end
17
27
  end
18
28
 
19
29
  print_heading("Done.")
20
30
  end
21
31
  end
32
+
33
+ private
34
+
35
+ def web_git_pull_command
36
+ commands = []
37
+ commands << "cd /home/dogids/apps/dogids.com"
38
+ commands << "git pull origin master"
39
+ commands.join("&& ")
40
+ end
41
+
42
+ def web_git_status_command
43
+ commands = []
44
+ commands << "cd /home/dogids/apps/dogids.com"
45
+ commands << "git status -s"
46
+ commands.join("&& ")
47
+ end
48
+
49
+ def web_update_permissions_command
50
+ commands = []
51
+ app_path = "/home/dogids/apps/dogids.com"
52
+ writable_directories = [
53
+ "blog/wp-content",
54
+ "feeds",
55
+ "logs",
56
+ "ls_file_cache",
57
+ "resources",
58
+ "reviews_cache",
59
+ "temp",
60
+ "templates",
61
+ "uploaded"
62
+ ]
63
+
64
+ writable_directories.each do |directory|
65
+ full_path = File.join(app_path, directory)
66
+ commands << "sudo chown dogids:www-data -R #{full_path}"
67
+ commands << "sudo chmod 775 -R #{full_path}"
68
+ end
69
+
70
+ commands.join("&& ")
71
+ end
22
72
  end
23
73
  end
@@ -3,7 +3,7 @@ require "open-uri"
3
3
  require "thor"
4
4
 
5
5
  module Dogids
6
- VERSION = "0.0.3"
6
+ VERSION = "0.0.4"
7
7
 
8
8
  class Cli < Thor
9
9
  desc "update", "Update dogids-cli to latest version"
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.3
4
+ version: 0.0.4
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-03 00:00:00.000000000 Z
11
+ date: 2015-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh