aws_deploy 0.2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/Rakefile +32 -0
  4. data/app/business/aws_deploy/tasks/generate_aws_deploy.rb +53 -0
  5. data/app/business/aws_deploy/tasks/generate_aws_send_rb.rb +49 -0
  6. data/app/business/aws_deploy/tasks/generate_git_version_tag_rb.rb +70 -0
  7. data/app/business/aws_deploy/tasks/generate_local_deploy_rb.rb +157 -0
  8. data/app/business/aws_deploy/tasks/generate_production_cron_check_updates.rb +134 -0
  9. data/app/business/aws_deploy/tasks/generate_production_deploy_sh.rb +146 -0
  10. data/app/business/aws_deploy/tasks/setup_yml.rb +89 -0
  11. data/app/business/deploy/deploy.rb +17 -0
  12. data/app/business/deploy/packing.rb +13 -0
  13. data/app/controllers/aws_deploy/aws_deploy_application_controller.rb +56 -0
  14. data/app/controllers/aws_deploy/index/version.rb +24 -0
  15. data/app/controllers/aws_deploy/index_controller.rb +70 -0
  16. data/app/views/aws_deploy/index/_config_file_not_found.html.erb +11 -0
  17. data/app/views/aws_deploy/index/index.html.erb +70 -0
  18. data/app/views/layouts/aws_deploy.html.erb +208 -0
  19. data/config/initializers/aws_deploy.rb +19 -0
  20. data/config/routes.rb +10 -0
  21. data/lib/aws_deploy/engine.rb +17 -0
  22. data/lib/aws_deploy/version.rb +3 -0
  23. data/lib/aws_deploy.rb +9 -0
  24. data/lib/tasks/aws_deploy_tasks.rake +47 -0
  25. data/test/aws_deploy_test.rb +7 -0
  26. data/test/dummy/README.rdoc +28 -0
  27. data/test/dummy/Rakefile +6 -0
  28. data/test/dummy/app/assets/javascripts/application.js +13 -0
  29. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  30. data/test/dummy/app/controllers/application_controller.rb +5 -0
  31. data/test/dummy/app/helpers/application_helper.rb +2 -0
  32. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  33. data/test/dummy/bin/bundle +3 -0
  34. data/test/dummy/bin/rails +4 -0
  35. data/test/dummy/bin/rake +4 -0
  36. data/test/dummy/config/application.rb +23 -0
  37. data/test/dummy/config/aws_deploy.yml +11 -0
  38. data/test/dummy/config/aws_deploy_.yml +23 -0
  39. data/test/dummy/config/boot.rb +5 -0
  40. data/test/dummy/config/database.yml +25 -0
  41. data/test/dummy/config/environment.rb +5 -0
  42. data/test/dummy/config/environments/development.rb +29 -0
  43. data/test/dummy/config/environments/production.rb +80 -0
  44. data/test/dummy/config/environments/test.rb +36 -0
  45. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  46. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  47. data/test/dummy/config/initializers/inflections.rb +16 -0
  48. data/test/dummy/config/initializers/mime_types.rb +5 -0
  49. data/test/dummy/config/initializers/secret_token.rb +12 -0
  50. data/test/dummy/config/initializers/session_store.rb +3 -0
  51. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  52. data/test/dummy/config/locales/en.yml +23 -0
  53. data/test/dummy/config/routes.rb +56 -0
  54. data/test/dummy/config.ru +4 -0
  55. data/test/dummy/db/development.sqlite3 +0 -0
  56. data/test/dummy/log/development.log +6379 -0
  57. data/test/dummy/log/local.log +0 -0
  58. data/test/dummy/public/404.html +58 -0
  59. data/test/dummy/public/422.html +58 -0
  60. data/test/dummy/public/500.html +57 -0
  61. data/test/dummy/public/favicon.ico +0 -0
  62. data/test/dummy/script/deploy.rb +116 -0
  63. data/test/dummy/script/lib/deploy/aws_send.rb +29 -0
  64. data/test/dummy/script/lib/deploy/git_version_tag.rb +48 -0
  65. data/test/dummy/script/production/cron_check_updates.rb +109 -0
  66. data/test/dummy/script/production/deploy.sh +127 -0
  67. data/test/test_helper.rb +15 -0
  68. metadata +180 -0
File without changes
@@ -0,0 +1,58 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/404.html -->
52
+ <div class="dialog">
53
+ <h1>The page you were looking for doesn't exist.</h1>
54
+ <p>You may have mistyped the address or the page may have moved.</p>
55
+ </div>
56
+ <p>If you are the application owner check the logs for more information.</p>
57
+ </body>
58
+ </html>
@@ -0,0 +1,58 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/422.html -->
52
+ <div class="dialog">
53
+ <h1>The change you wanted was rejected.</h1>
54
+ <p>Maybe you tried to change something you didn't have access to.</p>
55
+ </div>
56
+ <p>If you are the application owner check the logs for more information.</p>
57
+ </body>
58
+ </html>
@@ -0,0 +1,57 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/500.html -->
52
+ <div class="dialog">
53
+ <h1>We're sorry, but something went wrong.</h1>
54
+ </div>
55
+ <p>If you are the application owner check the logs for more information.</p>
56
+ </body>
57
+ </html>
File without changes
@@ -0,0 +1,116 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ require 'FileUtils'
4
+ require './lib/deploy/git_version_tag.rb'
5
+ require './lib/deploy/aws_send.rb'
6
+
7
+ # -------------------------------------------------------------------------------------
8
+ # CONFIGURABLE
9
+ # -------------------------------------------------------------------------------------
10
+
11
+ zip_file = "projeto_rga"
12
+ md5_file = "#{zip_file}"
13
+
14
+ aws_access_key_id = "bb"
15
+ aws_secret_access_key = "cc"
16
+ aws_bucket = "projeto_rga/deploy"
17
+
18
+ _temp_dir = "#{File.expand_path("~")}/Temp/playliststore"
19
+
20
+ #
21
+ # -------------------------------------------------------------------------------------
22
+
23
+
24
+ time = Time.now.strftime("%y%m%d.%H%M%S")
25
+ public_dir = Dir.new("../public")
26
+
27
+ Dir.mkdir(_temp_dir) unless File.directory?(_temp_dir)
28
+ temp_dir = "#{_temp_dir}/#{time}"
29
+ # env = ARGV[0]
30
+
31
+
32
+
33
+ puts "------------------------------------------------------------------------------
34
+
35
+ "
36
+
37
+
38
+ # puts "------------------------------------------------------------------------------ "
39
+ puts "3. Version.txt"
40
+ # puts "------------------------------------------------------------------------------ "
41
+
42
+ GitVersionTag.new(time, "gitlab", public_dir.path).version_it
43
+
44
+
45
+
46
+ # puts "------------------------------------------------------------------------------ "
47
+ puts "2. Git tag"
48
+ # puts "------------------------------------------------------------------------------ "
49
+
50
+ GitVersionTag.new(time, "gitlab", public_dir.path).tag_it
51
+
52
+
53
+ # puts "------------------------------------------------------------------------------ "
54
+ puts "3. Packing"
55
+ # puts "------------------------------------------------------------------------------ "
56
+
57
+
58
+
59
+ # puts "------------------------------------------------------------------------------ "
60
+ puts "3.1 - Copying content to a temporary folder - #{Time.now}"
61
+ # puts "------------------------------------------------------------------------------ "
62
+
63
+ Dir.mkdir("#{temp_dir}")
64
+
65
+ exclude_dirs = []
66
+ exclude_dirs << "ie7ref"
67
+ exclude_dirs << ".git"
68
+ exclude_dirs << ".gitignore"
69
+ exclude_dirs << ".autotest"
70
+ exclude_dirs << "tmp"
71
+ exclude_dirs << ".svn"
72
+ exclude_dirs << "wip"
73
+ exclude_dirs << "log/*"
74
+ exclude_dirs << "test/*"
75
+ exclude_dirs << "script/security/*"
76
+ exclude_dirs << "README.rdoc"
77
+ exclude_dirs << "public/app"
78
+
79
+ system("#{rsync_command}")
80
+
81
+
82
+
83
+
84
+
85
+
86
+ # puts "------------------------------------------------------------------------------ "
87
+ puts "3.2 - Generating package - #{Time.now}"
88
+ # puts "------------------------------------------------------------------------------ "
89
+
90
+ system("cd #{temp_dir}; bundle install")
91
+ system("cd #{temp_dir}; bundle exec rake assets:precompile --trace")
92
+ # system("rm -rf #{temp_dir}/public/assets")
93
+ system("rm -rf #{temp_dir}/../#{zip_file}.zip")
94
+ system("cd #{temp_dir}; zip -qr ../#{zip_file}.zip ./*")
95
+
96
+
97
+
98
+
99
+ # puts "------------------------------------------------------------------------------ "
100
+ puts "3.3 - Generating MD5 - #{Time.now}"
101
+ # puts "------------------------------------------------------------------------------ "
102
+
103
+ system("rm -rf #{temp_dir}/../#{md5_file}.md5")
104
+ system("cd #{temp_dir}; md5 <<< "#{Time.now}" >> ../#{md5_file}.md5")
105
+
106
+
107
+
108
+ # puts "------------------------------------------------------------------------------ "
109
+ puts "4. AWS Send"
110
+ # puts "------------------------------------------------------------------------------ "
111
+
112
+ AwsSend.new(aws_access_key_id, aws_secret_access_key).send("#{temp_dir}/../#{zip_file}.zip", aws_bucket)
113
+ AwsSend.new(aws_access_key_id, aws_secret_access_key).send("#{temp_dir}/../#{md5_file}.md5", aws_bucket)
114
+
115
+
116
+ puts "------------------------------------------------------------------------------ "
@@ -0,0 +1,29 @@
1
+ require "fileutils"
2
+ require "aws-sdk"
3
+
4
+ class AwsSend
5
+
6
+ DEFAULT_ENV = "development_remote"
7
+
8
+ def initialize access_key_id="", secret_access_key=""
9
+ AWS.config(:access_key_id => "#{access_key_id}", :secret_access_key => "#{secret_access_key}")
10
+ end
11
+
12
+ #
13
+ #
14
+ def send file_name="", bucket_path=""
15
+ puts "File: #{file_name} ... bucket: #{bucket_path}"
16
+
17
+ s3 = AWS::S3.new
18
+ bucket = s3.buckets["#{bucket_path}"]
19
+
20
+ base_file_name = "#{File.basename(file_name, ".*")}-#{AwsSend::DEFAULT_ENV}#{File.extname(file_name)}"
21
+ puts " ... new file name: #{base_file_name}"
22
+
23
+ obj = bucket.objects[base_file_name]
24
+ obj.delete
25
+ obj.write(Pathname.new("#{file_name}"))
26
+
27
+ end
28
+
29
+ end
@@ -0,0 +1,48 @@
1
+ class GitVersionTag
2
+
3
+
4
+ def initialize time="sample time", remote_git="gitlab", public_dir="../public"
5
+ @time = time
6
+ @remote_git = remote_git
7
+ @public_dir = public_dir
8
+ end
9
+
10
+ #
11
+ #
12
+ #
13
+ def version_it
14
+ version_content = "Deployment Version: #{@time}"
15
+
16
+ File.open("#{@public_dir}/version.txt", 'w') {|f| f.write(version_content) }
17
+ system("git branch >> #{@public_dir}/version.txt")
18
+ system("git add .")
19
+ system("git commit -am 'updating version.txt' ")
20
+
21
+ current_branch = %x[git rev-parse --abbrev-ref HEAD].gsub("\n", "").gsub("/",".")
22
+ system("git push #{@remote_git} #{current_branch}")
23
+ end
24
+
25
+
26
+ #
27
+ #
28
+ #
29
+ def tag_it
30
+
31
+ current_branch = %x[git rev-parse --abbrev-ref HEAD].gsub("\n", "").gsub("/",".")
32
+ tag_name = "v.#{@time}.#{current_branch}"
33
+
34
+ puts " - Tag name: #{tag_name}"
35
+ puts " - Current Branch: #{current_branch}"
36
+
37
+ system("git add .")
38
+ system("git commit -am \"deploy from #{current_branch}\"")
39
+ system("git push #{@remote_git} #{current_branch}")
40
+
41
+ system("git tag -a #{tag_name} -m \"tag :: deploy from branch: #{current_branch}\"")
42
+ system("git push #{@remote_git} #{tag_name}")
43
+
44
+ end
45
+
46
+
47
+
48
+ end
@@ -0,0 +1,109 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ require "fileutils"
4
+ require "aws-sdk"
5
+
6
+ # -------------------------------------------------------------------------------------
7
+ # CONFIGURABLE
8
+ # -------------------------------------------------------------------------------------
9
+
10
+ AWS.config(:access_key_id => "bb", :secret_access_key => "cc")
11
+
12
+ base_dir = "/app/deploy/"
13
+ project_name = "dd"
14
+ bucket = "dd/deploy"
15
+
16
+ #
17
+ # -------------------------------------------------------------------------------------
18
+
19
+ s3_filename = "nofile"
20
+
21
+ puts "------------------------------------------------------------------------------ "
22
+
23
+ if "#{ARGV[0]}".empty?
24
+ puts "ERR - Process stoped. Environment not defined."
25
+
26
+ else
27
+ if !%w(admin development_remote production staging).include?("#{ARGV[0]}")
28
+ puts "ERR - Invalid Environment: (#{ARGV[0]})"
29
+ else
30
+
31
+ s3_filename = "#{project_name}-#{ARGV[0]}.zip"
32
+ s3_filename_md5 = "#{project_name}-#{ARGV[0]}.md5"
33
+
34
+
35
+ # # puts "------------------------------------------------------------------------------ "
36
+ puts "1. Getting MD5 ... #{bucket}/#{s3_filename_md5}"
37
+ # # puts "------------------------------------------------------------------------------ "
38
+
39
+ s3 = AWS::S3.new
40
+ bucket = s3.buckets["#{bucket}"]
41
+
42
+ obj = bucket.objects[s3_filename_md5]
43
+
44
+ if obj.exists?
45
+ File.delete("#{base_dir}#{s3_filename_md5}") if File.exist?("#{base_dir}#{s3_filename_md5}")
46
+
47
+ File.open("#{base_dir}#{s3_filename_md5}", 'wb') do |file|
48
+ obj.read do |chunk|
49
+ file.write(chunk)
50
+ end
51
+ end
52
+
53
+
54
+ # # puts "------------------------------------------------------------------------------ "
55
+ puts "2. Checking MD5 ... "
56
+
57
+ # md5 checking...
58
+ md5_file_data = File.read("#{base_dir}#{s3_filename_md5}")
59
+
60
+ if File.exist?("#{base_dir}#{s3_filename_md5}.local")
61
+ md5_local = File.read("#{base_dir}#{s3_filename_md5}.local")
62
+ else
63
+ md5_local = "new__#{md5_file_data}"
64
+ end
65
+
66
+ puts " remote MD5: #{md5_file_data}"
67
+ puts " local MD5: #{md5_local}"
68
+
69
+
70
+ # process the deployment...
71
+ if md5_local != md5_file_data
72
+ # # puts "------------------------------------------------------------------------------ "
73
+ puts "3. Downloading package "
74
+
75
+ obj = bucket.objects[s3_filename]
76
+
77
+ if obj.exists?
78
+
79
+ File.open("#{base_dir}#{s3_filename}", 'w+b') do |file|
80
+ obj.read do |chunk|
81
+ file.write(chunk)
82
+ end
83
+ end
84
+
85
+ # # puts "------------------------------------------------------------------------------ "
86
+ puts "4. Writing controls ... .log and .md5.local files "
87
+
88
+
89
+ system("echo \"#{Time.now.strftime("%y%m%d_%H%M%S")}\" >> #{base_dir}#{project_name}-#{ARGV[0]}_YES.log")
90
+ # updating local MD5
91
+ File.open("#{base_dir}#{s3_filename_md5}.local", 'w+') { |file| file.write("#{md5_file_data}") }
92
+
93
+ puts "5. Deploying...."
94
+ system("#{base_dir}deploy.sh #{ARGV[0]}")
95
+
96
+ else
97
+ system("echo \"#{Time.now.strftime("%y%m%d_%H%M%S")}\" >> #{base_dir}#{project_name}-#{ARGV[0]}_NO.log")
98
+ end
99
+ else
100
+ system("echo \"#{Time.now.strftime("%y%m%d_%H%M%S")}\" >> #{base_dir}#{project_name}-#{ARGV[0]}_NO.log")
101
+ end
102
+ else
103
+ system("echo \"#{Time.now.strftime("%y%m%d_%H%M%S")}\" >> #{base_dir}#{project_name}-#{ARGV[0]}_NO.log")
104
+ end
105
+
106
+ end
107
+
108
+ end
109
+ puts " ------------------------------------------------------------------------------ "
@@ -0,0 +1,127 @@
1
+ #!/bin/bash
2
+ #
3
+ # Usage:
4
+ # ./deploy.sh [app|test2]
5
+ #
6
+ #
7
+
8
+
9
+ DATA_DIR=/app/deploy
10
+ ZIP_FILE_NAME=samsung-g11.zip
11
+ UNPACK_DIR=$DATA_DIR/tmp/unpack_playliststore
12
+ HOST=`hostname`
13
+ NOW=$(date +"%y%m%d-%H%M%S")
14
+
15
+ BASE_DEPLOY_DIR=/app/www
16
+ clear screen
17
+
18
+ TODAY=$(date)
19
+
20
+
21
+ ENV=$1
22
+
23
+ if [ "$1" == "" ]
24
+ then
25
+ echo "***********************************************************************************"
26
+ echo " "
27
+ echo " !!!! PROCESS CANCELED !!!! "
28
+ echo " "
29
+ echo " INFORM A VALID ENVIRONMENT [production|staging|development_remote|admin]"
30
+ echo " "
31
+ echo " onde:"
32
+ echo " "
33
+ echo " production => www.playliststore.com"
34
+ echo " staging => staging.playliststore.com"
35
+ echo " development_remote => test.playliststore.com"
36
+ echo " admin => admin.playliststore.com"
37
+ echo " "
38
+ echo "***********************************************************************************"
39
+ exit
40
+ else
41
+ if [ "$1" == "admin" ]
42
+ then
43
+ export RAILS_ENV=production
44
+ ZIP_FILE_NAME=playliststore-admin.zip
45
+ BASE_DEPLOY_DIR=$BASE_DEPLOY_DIR/admin.playliststore.com.br
46
+ fi
47
+ if [ "$1" == "development_remote" ]
48
+ then
49
+ export RAILS_ENV=development_remote
50
+ ZIP_FILE_NAME=playliststore-development_remote.zip
51
+ BASE_DEPLOY_DIR=$BASE_DEPLOY_DIR/test.playliststore.com.br
52
+ fi
53
+ if [ "$1" == "staging" ]
54
+ then
55
+ export RAILS_ENV=staging
56
+ ZIP_FILE_NAME=playliststore-staging.zip
57
+ BASE_DEPLOY_DIR=$BASE_DEPLOY_DIR/staging.playliststore.com.br
58
+ fi
59
+ if [ "$1" == "production" ]
60
+ then
61
+ export RAILS_ENV=production
62
+ ZIP_FILE_NAME=playliststore-production.zip
63
+ BASE_DEPLOY_DIR=$BASE_DEPLOY_DIR/www.playliststore.com.br
64
+ fi
65
+
66
+ fi
67
+
68
+
69
+ echo "-----------------------------------------------------------------------------------"
70
+ echo "BASE DEPLOY DIR: $BASE_DEPLOY_DIR "
71
+ echo "--"
72
+ echo "1 - Unpack .zip file ($ZIP_FILE_NAME) - $TODAY"
73
+ # echo "-----------------------------------------------------------------------------------"
74
+
75
+ rm -rf $UNPACK_DIR-$ENV-$HOST
76
+
77
+ unzip -q $DATA_DIR/$ZIP_FILE_NAME -d $UNPACK_DIR-$ENV-$HOST
78
+
79
+
80
+
81
+ # echo "-----------------------------------------------------------------------------------"
82
+ echo "2 - Copy data to the app dir - $TODAY"
83
+ # echo "-----------------------------------------------------------------------------------"
84
+
85
+ cp -rf $UNPACK_DIR-$ENV-$HOST/ $BASE_DEPLOY_DIR/$NOW
86
+
87
+
88
+
89
+ # # echo "-----------------------------------------------------------------------------------"
90
+ echo "3 - relink 'current' - $TODAY"
91
+ # # echo "-----------------------------------------------------------------------------------"
92
+
93
+ cd $BASE_DEPLOY_DIR
94
+ rm html
95
+ ln -s $NOW html
96
+ cd -
97
+
98
+
99
+
100
+ echo "- run bundle exec rake assets:precompile - $TODAY"
101
+ cd $BASE_DEPLOY_DIR/html
102
+
103
+
104
+ bundle update
105
+
106
+
107
+ rake db:migrate
108
+
109
+ export RAILS_ENV=production
110
+ bundle exec rake assets:precompile
111
+
112
+
113
+ # echo "-----------------------------------------------------------------------------------"
114
+ echo "4 - Restarting NGINX - $TODAY"
115
+ # echo "-----------------------------------------------------------------------------------"
116
+
117
+ # nginx_restart
118
+ sudo service nginx restart
119
+
120
+
121
+
122
+ echo ""
123
+ echo ""
124
+ echo "FINISHED! - $TODAY "
125
+ echo ""
126
+ echo ""
127
+
@@ -0,0 +1,15 @@
1
+ # Configure Rails Environment
2
+ ENV["RAILS_ENV"] = "test"
3
+
4
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
+ require "rails/test_help"
6
+
7
+ Rails.backtrace_cleaner.remove_silencers!
8
+
9
+ # Load support files
10
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
11
+
12
+ # Load fixtures from the engine
13
+ if ActiveSupport::TestCase.method_defined?(:fixture_path=)
14
+ ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
15
+ end