aws_deploy 0.2.5.1 → 0.2.6.0

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: b229fde9fbfc7bfcaa8856857dc7dd9f509e2b63
4
- data.tar.gz: 7f62d2f982ff5dc8c0184834c1afd1f220fa1bde
3
+ metadata.gz: d4859b9d704b5ab018e0b2e9e144fa8fadc1647d
4
+ data.tar.gz: a5659af146a42612b5545f884d55fe8e23cf57ca
5
5
  SHA512:
6
- metadata.gz: 98ff65a1bb79582cdf240c82d5d0719a550e092aac60df9e22f86bf36d8c2df3644d69c7da2a54cffaff3e6b8a44ad8e870d466981b6ea86925124f7d42881f6
7
- data.tar.gz: f4e4525f086a4baec3b62588a1eda80c4553e7d03ff4acc642098dc724be65154c3828b7dde15805b611a591e811e86289116b44507b345b64851eb9b8556540
6
+ metadata.gz: c64faa98c4797b3009ab02d4b22e4c5d0d4a0ddbc83f5373177a2ad4c68509a91c29ed8c89364a51fcbd961a304ebfcbc43cebafb89d932a12108e980fc7bc0a
7
+ data.tar.gz: b4b6f64121f2419e6446b9462f9a9b060729dfb0378338076aed2fe93ab9a6bdaf6a128d4c2fc90ce76dd7c4818c96688e36d1b8a9245379421592063c4dcfe8
@@ -0,0 +1,63 @@
1
+ class AwsDeploy::Notification
2
+
3
+
4
+ #
5
+ #
6
+ #
7
+ def self.send to="all"
8
+ @errors = []
9
+
10
+ if to == "all"
11
+
12
+ api_keys = $aws_deploy["pushbullet"]["api_key"]
13
+ keys = api_keys.split(" ")
14
+
15
+ keys.each_with_index do |k,i|
16
+ puts "-" * 100
17
+
18
+ puts "#{i} - #{k}"
19
+
20
+ puts "-" * 100
21
+ end
22
+
23
+ begin
24
+ _sendn(vals[0], vals[1])
25
+ rescue Exception => e
26
+ @errors << "Problem sending to: #{vals[0]}|#{vals[1]}|#{vals[2]} ... #{e}"
27
+ end
28
+
29
+ else
30
+
31
+
32
+ end
33
+
34
+ @errors
35
+ end
36
+
37
+
38
+
39
+ #
40
+ #
41
+ #
42
+ def _sendn token, device_name
43
+ push = MyPush.new :token => token
44
+
45
+ # find the device...
46
+ iden = ""
47
+ devices = push.devices
48
+ devices["devices"].each do |dev|
49
+ if device_name == dev["extras"]["model"]
50
+ puts "ID: #{dev["iden"]}"
51
+ iden = dev["iden"]
52
+ end
53
+ end
54
+
55
+ # send a message..
56
+ push.push :type => MyPush::PUSH_TYPE_NOTE,
57
+ :title => "[TEST][aws_deploy] #{Rails.application.class.parent_name} #{Rails.env}",
58
+ :body => "This is a test message sent from aws_deploy",
59
+ :iden => "#{iden}"
60
+
61
+ end
62
+
63
+ end
@@ -0,0 +1,39 @@
1
+ module AwsDeploy::Tasks::CollectInputs
2
+
3
+
4
+ #
5
+ #
6
+ def collect_inputs
7
+
8
+ print "What is the name of your AWS BUCKET ? [directory/deploy] :"
9
+ @aws_deploy_bucket = STDIN.gets
10
+ @aws_deploy_bucket = (@aws_deploy_bucket.blank? ? "directory/deploy" : @aws_deploy_bucket)
11
+ puts "#{@aws_deploy_bucket.gsub!("\n","")} \n"
12
+
13
+ print "What is your AWS ACCESS KEY ID ? [my_key_id] :"
14
+ @aws_access_key_id = STDIN.gets || "my_key_id"
15
+ puts "#{@aws_access_key_id.gsub!("\n","")} \n"
16
+
17
+ print "What is your AWS SECRET ACCESS KEY ? [my_secret_key] :"
18
+ @aws_secret_access_key = STDIN.gets || "my_secret_key"
19
+ puts "#{@aws_secret_access_key.gsub!("\n","")} \n"
20
+
21
+ print "What is your FILE PATERN ? [my_file_before_zip_ext] :"
22
+ @file_pattern = STDIN.gets || "my_file_before_zip_ext"
23
+ puts "#{@file_pattern.gsub!("\n","")} \n"
24
+
25
+ print "What is of your project NAME? [ex: admin.XXX.com.br|www.XXX.com.br|test.XXX.com.br] :"
26
+ @project_name = STDIN.gets
27
+ @project_name = (@project_name.blank? ? "project_name" : @project_name)
28
+ puts "#{@project_name.gsub!("\n","")} \n"
29
+
30
+ print "Name of your base dir? [default: /var/app/www] :"
31
+ @deploy_base_dir = STDIN.gets
32
+ @deploy_base_dir = (@deploy_base_dir.blank? ? "/var/app/www" : @deploy_base_dir)
33
+ puts "#{@deploy_base_dir.gsub!("\n","")} \n"
34
+
35
+
36
+ end
37
+
38
+
39
+ end
@@ -26,28 +26,6 @@ module AwsDeploy::Tasks::GenerateAwsDeploy
26
26
  end
27
27
 
28
28
 
29
- #
30
- #
31
- def collect_inputs__aws_deploy
32
-
33
- print "What is the of your AWS BUCKET ? [directory/deploy] :"
34
- @aws_deploy_bucket = STDIN.gets
35
- @aws_deploy_bucket = (@aws_deploy_bucket.blank? ? "directory/deploy" : @aws_deploy_bucket)
36
- puts "#{@aws_deploy_bucket.gsub!("\n","")} \n"
37
-
38
- print "What is your AWS ACCESS KEY ID ? [my_key_id] :"
39
- @aws_access_key_id = STDIN.gets || "my_key_id"
40
- puts "#{@aws_access_key_id.gsub!("\n","")} \n"
41
-
42
- print "What is your AWS SECRET ACCESS KEY ? [my_secret_key] :"
43
- @aws_secret_access_key = STDIN.gets || "my_secret_key"
44
- puts "#{@aws_secret_access_key.gsub!("\n","")} \n"
45
-
46
- print "What is your FILE PATERN ? [my_file_before_zip_ext] :"
47
- @file_pattern = STDIN.gets || "my_file_before_zip_ext"
48
- puts "#{@file_pattern.gsub!("\n","")} \n"
49
-
50
- end
51
29
 
52
30
 
53
31
  end
@@ -16,12 +16,12 @@ module AwsDeploy::Tasks::GenerateLocalDeployRb
16
16
  "# CONFIGURABLE \n" +
17
17
  "# ------------------------------------------------------------------------------------- \n" +
18
18
  " \n" +
19
- "zip_file = \"#{@project_name}\" \n" +
19
+ "zip_file = \"#{@file_pattern}\" \n" +
20
20
  "md5_file = \"\#{zip_file}\" \n" +
21
21
  " \n" +
22
22
  "aws_access_key_id = \"#{@aws_access_key_id}\" \n" +
23
23
  "aws_secret_access_key = \"#{@aws_secret_access_key}\" \n" +
24
- "aws_bucket = \"#{@project_name}/deploy\" \n" +
24
+ "aws_bucket = \"#{@aws_deploy_bucket}\" \n" +
25
25
  " \n" +
26
26
  "_temp_dir = \"\#{File.expand_path(\"~\")}/Temp/#{@project_name}\" \n" +
27
27
  " \n" +
@@ -74,6 +74,7 @@ module AwsDeploy::Tasks::GenerateLocalDeployRb
74
74
  "exclude_dirs << \".gitignore\" \n" +
75
75
  "exclude_dirs << \".autotest\" \n" +
76
76
  "exclude_dirs << \"tmp\" \n" +
77
+ "exclude_dirs << \"doc\" \n" +
77
78
  "exclude_dirs << \".svn\" \n" +
78
79
  "exclude_dirs << \"wip\" \n" +
79
80
  "exclude_dirs << \"log/*\" \n" +
@@ -135,14 +136,6 @@ module AwsDeploy::Tasks::GenerateLocalDeployRb
135
136
 
136
137
 
137
138
 
138
- def collect_inputs__local_deploy_rb
139
- print "Name of your project? [directory/deploy] :"
140
- @project_name = STDIN.gets
141
- @project_name = (@project_name.blank? ? "project_name" : @project_name)
142
- puts "#{@project_name.gsub!("\n","")} \n"
143
-
144
- end
145
-
146
139
 
147
140
 
148
141
 
@@ -16,9 +16,9 @@ module AwsDeploy::Tasks::GenerateProductionCronCheckUpdates
16
16
  " \n" +
17
17
  " AWS.config(:access_key_id => \"#{@aws_access_key_id}\", :secret_access_key => \"#{@aws_secret_access_key}\") \n" +
18
18
  " \n" +
19
- "base_dir = \"/app/deploy/\" \n" +
20
- "project_name = \"#{@file_pattern}\" \n" +
21
- "bucket = \"#{@file_pattern}/deploy\" \n" +
19
+ "data_dir = File.expand_path File.dirname(__FILE__) \n" +
20
+ "file_pattern = \"#{@file_pattern}\" \n" +
21
+ "bucket = \"#{@aws_deploy_bucket}\" \n" +
22
22
  " \n" +
23
23
  "# \n" +
24
24
  "# ------------------------------------------------------------------------------------- \n" +
@@ -35,8 +35,8 @@ module AwsDeploy::Tasks::GenerateProductionCronCheckUpdates
35
35
  " puts \"ERR - Invalid Environment: (\#{ARGV[0]})\" \n" +
36
36
  " else \n" +
37
37
  " \n" +
38
- " s3_filename = \"\#{project_name}-\#{ARGV[0]}.zip\" \n" +
39
- " s3_filename_md5 = \"\#{project_name}-\#{ARGV[0]}.md5\" \n" +
38
+ " s3_filename = \"\#{file_pattern}-\#{ARGV[0]}.zip\" \n" +
39
+ " s3_filename_md5 = \"\#{file_pattern}-\#{ARGV[0]}.md5\" \n" +
40
40
  " \n" +
41
41
  " \n" +
42
42
  " # # puts \"------------------------------------------------------------------------------ \" \n" +
@@ -49,9 +49,9 @@ module AwsDeploy::Tasks::GenerateProductionCronCheckUpdates
49
49
  " obj = bucket.objects[s3_filename_md5] \n" +
50
50
  " \n" +
51
51
  " if obj.exists? \n" +
52
- " File.delete(\"\#{base_dir}\#{s3_filename_md5}\") if File.exist?(\"\#{base_dir}\#{s3_filename_md5}\") \n" +
52
+ " File.delete(\"\#{data_dir}/\#{s3_filename_md5}\") if File.exist?(\"\#{data_dir}/\#{s3_filename_md5}\") \n" +
53
53
  " \n" +
54
- " File.open(\"\#{base_dir}\#{s3_filename_md5}\", 'wb') do |file| \n" +
54
+ " File.open(\"\#{data_dir}/\#{s3_filename_md5}\", 'wb') do |file| \n" +
55
55
  " obj.read do |chunk| \n" +
56
56
  " file.write(chunk) \n" +
57
57
  " end \n" +
@@ -62,10 +62,10 @@ module AwsDeploy::Tasks::GenerateProductionCronCheckUpdates
62
62
  " puts \"2. Checking MD5 ... \" \n" +
63
63
  " \n" +
64
64
  " # md5 checking... \n" +
65
- " md5_file_data = File.read(\"\#{base_dir}\#{s3_filename_md5}\") \n" +
65
+ " md5_file_data = File.read(\"\#{data_dir}/\#{s3_filename_md5}\") \n" +
66
66
  " \n" +
67
- " if File.exist?(\"\#{base_dir}\#{s3_filename_md5}.local\") \n" +
68
- " md5_local = File.read(\"\#{base_dir}\#{s3_filename_md5}.local\") \n" +
67
+ " if File.exist?(\"\#{data_dir}/\#{s3_filename_md5}.local\") \n" +
68
+ " md5_local = File.read(\"\#{data_dir}/\#{s3_filename_md5}.local\") \n" +
69
69
  " else \n" +
70
70
  " md5_local = \"new__\#{md5_file_data}\" \n" +
71
71
  " end \n" +
@@ -83,7 +83,7 @@ module AwsDeploy::Tasks::GenerateProductionCronCheckUpdates
83
83
  " \n" +
84
84
  " if obj.exists? \n" +
85
85
  " \n" +
86
- " File.open(\"\#{base_dir}\#{s3_filename}\", 'w+b') do |file| \n" +
86
+ " File.open(\"\#{data_dir}/\#{s3_filename}\", 'w+b') do |file| \n" +
87
87
  " obj.read do |chunk| \n" +
88
88
  " file.write(chunk) \n" +
89
89
  " end \n" +
@@ -93,21 +93,21 @@ module AwsDeploy::Tasks::GenerateProductionCronCheckUpdates
93
93
  " puts \"4. Writing controls ... .log and .md5.local files \" \n" +
94
94
  " \n" +
95
95
  " \n" +
96
- " system(\"echo \\\"\#{Time.now.strftime(\"%y%m%d_%H%M%S\")}\\\" >> \#{base_dir}\#{project_name}-\#{ARGV[0]}_YES.log\") \n" +
96
+ " system(\"echo \\\"\#{Time.now.strftime(\"%y%m%d_%H%M%S\")}\\\" >> \#{data_dir}/\#{file_pattern}-\#{ARGV[0]}_YES.log\") \n" +
97
97
  " # updating local MD5 \n" +
98
- " File.open(\"\#{base_dir}\#{s3_filename_md5}.local\", 'w+') { |file| file.write(\"\#{md5_file_data}\") } \n " +
98
+ " File.open(\"\#{data_dir}/\#{s3_filename_md5}.local\", 'w+') { |file| file.write(\"\#{md5_file_data}\") } \n " +
99
99
  " \n" +
100
100
  " puts \"5. Deploying....\" \n" +
101
- " system(\"\#{base_dir}deploy.sh \#{ARGV[0]}\") \n " +
101
+ " system(\"\#{data_dir}/deploy.sh \#{ARGV[0]}\") \n " +
102
102
  " \n" +
103
103
  " else \n" +
104
- " system(\"echo \\\"\#{Time.now.strftime(\"%y%m%d_%H%M%S\")}\\\" >> \#{base_dir}\#{project_name}-\#{ARGV[0]}_NO.log\") \n" +
104
+ " system(\"echo \\\"\#{Time.now.strftime(\"%y%m%d_%H%M%S\")}\\\" >> \#{data_dir}/\#{file_pattern}-\#{ARGV[0]}_NO.log\") \n" +
105
105
  " end \n" +
106
106
  " else \n" +
107
- " system(\"echo \\\"\#{Time.now.strftime(\"%y%m%d_%H%M%S\")}\\\" >> \#{base_dir}\#{project_name}-\#{ARGV[0]}_NO.log\") \n" +
107
+ " system(\"echo \\\"\#{Time.now.strftime(\"%y%m%d_%H%M%S\")}\\\" >> \#{data_dir}/\#{file_pattern}-\#{ARGV[0]}_NO.log\") \n" +
108
108
  " end \n" +
109
109
  " else \n" +
110
- " system(\"echo \\\"\#{Time.now.strftime(\"%y%m%d_%H%M%S\")}\\\" >> \#{base_dir}\#{project_name}-\#{ARGV[0]}_NO.log\") \n" +
110
+ " system(\"echo \\\"\#{Time.now.strftime(\"%y%m%d_%H%M%S\")}\\\" >> \#{data_dir}/\#{file_pattern}-\#{ARGV[0]}_NO.log\") \n" +
111
111
  " end \n" +
112
112
  " \n" +
113
113
  " end \n" +
@@ -8,18 +8,18 @@ module AwsDeploy::Tasks::GenerateProductionDeploySh
8
8
  "#!/bin/bash \n " +
9
9
  "# \n " +
10
10
  "# Usage: \n " +
11
- "# ./deploy.sh [app|test2] \n " +
11
+ "# ./deploy.sh [RAILS_ENV] \n " +
12
12
  "# \n " +
13
13
  "# \n " +
14
14
  " \n " +
15
15
  " \n " +
16
- "DATA_DIR=/app/deploy \n " +
16
+ "DATA_DIR=\"$( cd \"$( dirname \"${BASH_SOURCE[0]}\" )\" && pwd )\" \n " +
17
17
  "ZIP_FILE_NAME=zip_file.zip \n " +
18
- "UNPACK_DIR=$DATA_DIR/tmp/npack_{@project_name} \n " +
18
+ "UNPACK_DIR=$DATA_DIR/tmp/npack_#{@project_name} \n " +
19
19
  "HOST=`hostname` \n " +
20
20
  "NOW=$(date +\"%y%m%d-%H%M%S\") \n " +
21
21
  " \n " +
22
- "BASE_DEPLOY_DIR=/app/www \n " +
22
+ "BASE_DEPLOY_DIR=#{@deploy_base_dir} \n " +
23
23
  "clear screen \n " +
24
24
  " \n " +
25
25
  "TODAY=$(date) \n " +
@@ -37,10 +37,10 @@ module AwsDeploy::Tasks::GenerateProductionDeploySh
37
37
  " echo \" \" \n " +
38
38
  " echo \" onde:\" \n " +
39
39
  " echo \" \" \n " +
40
- " echo \" production => www.{@project_name}.com\" \n " +
41
- " echo \" staging => staging.{@project_name}.com\" \n " +
42
- " echo \" development_remote => test.{@project_name}.com\" \n " +
43
- " echo \" admin => admin.{@project_name}.com\" \n " +
40
+ " echo \" production => www.#{@project_name}.com\" \n " +
41
+ " echo \" staging => staging.#{@project_name}.com\" \n " +
42
+ " echo \" development_remote => test.#{@project_name}.com\" \n " +
43
+ " echo \" admin => admin.#{@project_name}.com\" \n " +
44
44
  " echo \" \" \n " +
45
45
  " echo \"***********************************************************************************\" \n " +
46
46
  " exit \n " +
@@ -48,26 +48,26 @@ module AwsDeploy::Tasks::GenerateProductionDeploySh
48
48
  " if [ \"$1\" == \"admin\" ] \n " +
49
49
  " then \n " +
50
50
  " export RAILS_ENV=production \n " +
51
- " ZIP_FILE_NAME={@project_name}-admin.zip \n " +
52
- " BASE_DEPLOY_DIR=$BASE_DEPLOY_DIR/admin.{@project_name}.com.br \n " +
51
+ " ZIP_FILE_NAME=#{@file_pattern}-admin.zip \n " +
52
+ " BASE_DEPLOY_DIR=$BASE_DEPLOY_DIR/admin.#{@project_name}.com.br \n " +
53
53
  " fi \n " +
54
54
  " if [ \"$1\" == \"development_remote\" ] \n " +
55
55
  " then \n " +
56
56
  " export RAILS_ENV=development_remote \n " +
57
- " ZIP_FILE_NAME={@project_name}-development_remote.zip \n " +
58
- " BASE_DEPLOY_DIR=$BASE_DEPLOY_DIR/test.{@project_name}.com.br \n " +
57
+ " ZIP_FILE_NAME=#{@file_pattern}-development_remote.zip \n " +
58
+ " BASE_DEPLOY_DIR=$BASE_DEPLOY_DIR/test.#{@project_name}.com.br \n " +
59
59
  " fi \n " +
60
60
  " if [ \"$1\" == \"staging\" ] \n " +
61
61
  " then \n " +
62
62
  " export RAILS_ENV=staging \n " +
63
- " ZIP_FILE_NAME={@project_name}-staging.zip \n " +
64
- " BASE_DEPLOY_DIR=$BASE_DEPLOY_DIR/staging.{@project_name}.com.br \n " +
63
+ " ZIP_FILE_NAME=#{@file_pattern}-staging.zip \n " +
64
+ " BASE_DEPLOY_DIR=$BASE_DEPLOY_DIR/staging.#{@project_name}.com.br \n " +
65
65
  " fi \n " +
66
66
  " if [ \"$1\" == \"production\" ] \n " +
67
67
  " then \n " +
68
68
  " export RAILS_ENV=production \n " +
69
- " ZIP_FILE_NAME={@project_name}-production.zip \n " +
70
- " BASE_DEPLOY_DIR=$BASE_DEPLOY_DIR/www.{@project_name}.com.br \n " +
69
+ " ZIP_FILE_NAME=#{@file_pattern}-production.zip \n " +
70
+ " BASE_DEPLOY_DIR=$BASE_DEPLOY_DIR/www.#{@project_name}.com.br \n " +
71
71
  " fi \n " +
72
72
  " \n " +
73
73
  "fi \n " +
@@ -122,7 +122,7 @@ module AwsDeploy::Tasks::GenerateProductionDeploySh
122
122
  "# echo \"-----------------------------------------------------------------------------------\" \n " +
123
123
  " \n " +
124
124
  "# nginx_restart \n " +
125
- "sudo service nginx restart \n " +
125
+ "service nginx restart \n " +
126
126
  " \n " +
127
127
  " \n " +
128
128
  " \n " +
@@ -1,20 +1,22 @@
1
1
  class AwsDeploy::Tasks::SetupYml
2
+ include AwsDeploy::Tasks::CollectInputs
2
3
  include AwsDeploy::Tasks::GenerateAwsDeploy
3
4
  include AwsDeploy::Tasks::GenerateLocalDeployRb
4
5
  include AwsDeploy::Tasks::GenerateAwsSendRb
5
6
  include AwsDeploy::Tasks::GenerateGitVersionTagRb
6
7
  include AwsDeploy::Tasks::GenerateProductionCronCheckUpdates
7
8
  include AwsDeploy::Tasks::GenerateProductionDeploySh
8
-
9
+
9
10
  #
10
11
  #
11
12
  def run
12
13
 
14
+ collect_inputs
15
+
13
16
  #
14
17
  # aws_deploy.yml
15
18
  #
16
- puts "\n1. aws_deploy.rb"
17
- collect_inputs__aws_deploy
19
+ puts "\n1. aws_deploy.yml"
18
20
  generate_aws_deploy
19
21
 
20
22
 
@@ -27,7 +29,6 @@ class AwsDeploy::Tasks::SetupYml
27
29
  # deploy.rb
28
30
  #
29
31
  puts "\n3. deploy.rb"
30
- collect_inputs__local_deploy_rb
31
32
  generate_local_deploy_rb
32
33
 
33
34
 
@@ -0,0 +1,67 @@
1
+ class AwsDeploy::NotificationsController < AwsDeploy::AwsDeployApplicationController
2
+ layout "aws_deploy"
3
+
4
+ # include AwsDeploy::Index::Version
5
+
6
+ #
7
+ #
8
+ def index
9
+
10
+ end
11
+
12
+
13
+ #
14
+ #
15
+ def sendn
16
+
17
+ @errors = []
18
+ params.keys.each do |k|
19
+ if k.starts_with?("item_")
20
+
21
+ vals = params[k].split("|")
22
+
23
+ begin
24
+ _sendn(vals[0], vals[1])
25
+ rescue Exception => e
26
+ @errors << "Problem sending to: #{vals[0]}|#{vals[1]}|#{vals[2]} ... #{e}"
27
+ end
28
+
29
+ end
30
+ end
31
+
32
+ flash[:message] = "Push sent! - #{Time.now.strftime('%Y/%m/%d %H:%M:%S')}"
33
+ flash[:errors] = @errors
34
+ redirect_to :action => :index
35
+ end
36
+
37
+
38
+
39
+ private
40
+
41
+
42
+ #
43
+ #
44
+ #
45
+ def _sendn token, device_name
46
+ push = MyPush.new :token => token
47
+
48
+ # find the device...
49
+ iden = ""
50
+ devices = push.devices
51
+ devices["devices"].each do |dev|
52
+ if device_name == dev["extras"]["model"]
53
+ puts "ID: #{dev["iden"]}"
54
+ iden = dev["iden"]
55
+ end
56
+ end
57
+
58
+ # send a message..
59
+ push.push :type => MyPush::PUSH_TYPE_NOTE,
60
+ :title => "[TEST][aws_deploy] #{Rails.application.class.parent_name} #{Rails.env}",
61
+ :body => "This is a test message sent from aws_deploy",
62
+ :iden => "#{iden}"
63
+
64
+ end
65
+
66
+
67
+ end
@@ -0,0 +1,19 @@
1
+ <hr>
2
+ <b>Notifications:</b>
3
+
4
+ <%if $aws_deploy["pushbullet"] && $aws_deploy["pushbullet"]["api_key"]%>
5
+ <a href="<%= aws_deploy_notifications_path%>">Send a test</a>
6
+
7
+ <ul>
8
+ <%
9
+ api_keys = $aws_deploy["pushbullet"]["api_key"]
10
+ keys = api_keys.split(" ")
11
+ %>
12
+ <% keys.each_with_index do |k,i| %>
13
+ <li><%= k%></li>
14
+ <% end %>
15
+ </ul>
16
+
17
+ <% else %>
18
+ <i>You don't have Pushbullet configured</i>
19
+ <% end %>
@@ -68,3 +68,6 @@ function pushTo(event) {
68
68
  <% else %>
69
69
  <%= render :partial => "config_file_not_found" %>
70
70
  <% end %>
71
+
72
+ <%= render :partial => "notification" %>
73
+
@@ -0,0 +1,43 @@
1
+ <h1>Notifications</h1>
2
+
3
+ <%if flash[:message] %>
4
+ <hr>
5
+ <b>Message:</b> <br>
6
+ <h2><%= flash[:message]%></h2>
7
+ <hr>
8
+ <% end %>
9
+
10
+
11
+ <%if !flash[:errors].blank? %>
12
+ <b>Errors:</b> <br>
13
+ <h2><%= flash[:errors]%></h2>
14
+ <hr>
15
+ <% end %>
16
+
17
+
18
+ <h3>Pushbullet - API Keys</h3>
19
+
20
+ <%= form_tag(aws_deploy_notifications_send_path) do %>
21
+ <ul>
22
+ <%
23
+ api_keys = $aws_deploy["pushbullet"]["api_key"]
24
+ keys = api_keys.split(" ")
25
+ %>
26
+ <% keys.each_with_index do |k,i| %>
27
+ <li>
28
+ <%= label_tag "item_#{i}", k do%>
29
+ <%= check_box_tag "item_#{i}", k, :checked %>
30
+ <%= k%>
31
+ <% end %>
32
+ </li>
33
+ <% end %>
34
+ </ul>
35
+ <hr>
36
+ <button class="sexybutton sexysimple"><span class="ok">Send Message</span></button>
37
+ <%end-%>
38
+ <br>
39
+ <button class="sexybutton sexysimple" onclick="window.open('<%= aws_deploy_root_awsdeploy_path%>', '_self');">Back</button>
40
+
41
+
42
+
43
+
data/config/routes.rb CHANGED
@@ -1,10 +1,26 @@
1
1
  Rails.application.routes.draw do
2
2
  if Rails.env == "development" || Rails.env == "development_remote"
3
- namespace :aws_deploy do
4
- root :to => 'index#index', :as => :root_awsdeploy
5
- match "/send_to_production" => "index#send_to_production", :as => :send_to_production_awsdeploy, via: [:post]
3
+ #TODO refactor with metaprogramming
4
+ if Rails.application.config.action_controller.relative_url_root.blank?
5
+ namespace :aws_deploy do
6
+ root :to => 'index#index', :as => :root_awsdeploy
7
+ match "/send_to_production" => "index#send_to_production", :as => :send_to_production_awsdeploy, via: [:post]
8
+ match "/version" => "index#version", :as => :version, via: [:get]
6
9
 
7
- match "/version" => "index#version", :as => :version, via: [:get]
10
+ get "/notifications" => "notifications#index", :as => :notifications
11
+ post "/notifications/send" => "notifications#sendn", :as => :notifications_send
12
+ end
13
+ else
14
+ scope Rails.application.config.action_controller.relative_url_root do
15
+ namespace :aws_deploy do
16
+ root :to => 'index#index', :as => :root_awsdeploy
17
+ match "/send_to_production" => "index#send_to_production", :as => :send_to_production_awsdeploy, via: [:post]
18
+ match "/version" => "index#version", :as => :version, via: [:get]
19
+
20
+ get "/notifications" => "notifications#index", :as => :notifications
21
+ post "/notifications/send" => "notifications#sendn", :as => :notifications_send
22
+ end
23
+ end
8
24
  end
9
25
  end
10
26
  end
@@ -1,3 +1,3 @@
1
1
  module AwsDeploy
2
- VERSION = "0.2.5.1"
2
+ VERSION = "0.2.6.0"
3
3
  end
@@ -3,9 +3,14 @@ development:
3
3
  aws_access_key_id: "bb"
4
4
  aws_secret_access_key: "cc"
5
5
  file_pattern: "dd"
6
+ pushbullet:
7
+ api_key: v1Y50OAUUEcDZKiVUtbiivJJ18HPatwazWujzCvGXFPuS|Chrome|MG.Browser v1Y50OAUUEcDZKiVUtbiivJJ18HPatwazWujzCvGXFPuS|XT1033|MG.MotoG
8
+
6
9
 
7
10
  development_remote:
8
11
  aws_bucket: "aa"
9
12
  aws_access_key_id: "bb"
10
13
  aws_secret_access_key: "cc"
11
14
  file_pattern: "dd"
15
+ pushbullet:
16
+ api_key: v1Y50OAUUEcDZKiVUtbiivJJ18HPatwazWujzCvGXFPuS|Chrome|Marcio 1111111111