capistrano-o2web-recipes 0.0.4 → 0.0.6

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: f9904d22fc53f831320b3f694dc6c87b22035421
4
- data.tar.gz: abf945f754c347cebc8f68073e4f33801708f224
3
+ metadata.gz: b0e3597cb961fe40f1c5aa5341cc3af65c60d2fe
4
+ data.tar.gz: 14f87363001d4e0f30fbb84244412f6901d56252
5
5
  SHA512:
6
- metadata.gz: fd271f0ac60af4a8b208452e63c821dcab3eff6a6aa840a7f0d302d9df5394c646d3e9ebede13ca67159de2461dcdaf4cb77cc01794060104d23fdb2a820e6c8
7
- data.tar.gz: 66fb60aad3e5fc50bfe9aeb9e4eb0caefca05c7005114e6cd75aee6ba6463421ccb6ec66f6af6da73e48f116b6aea91f82aa6d824e8c4f0b5984282f1629cc50
6
+ metadata.gz: a19669eba1b9efdc809d7a8f05c111d63b79d2aa4a5032572cf343efa365edc519bf6d9b01453915f1a90e7e38ddb02361931fce8a19baea13ad3ae8d3520a68
7
+ data.tar.gz: 2dcf021595e88ae0d1ef3764c6dc2968a71a5e5348d14ce9ec3c016451894a71e0ff30971760bb61f688588defe4fb5bbf1d3ddc725535edd683879c4621e2b7
data/README.md CHANGED
@@ -48,7 +48,6 @@ Configurations can be customized in your deploy file with:
48
48
 
49
49
  ```ruby
50
50
  set :server, 'example.com'
51
- set :admin_name, 'admin'
52
51
  set :deployer_name, 'deployer'
53
52
  # default to %W[system]
54
53
  set :files_public_dirs, fetch(:files_public_dirs, []).push(*%W[
@@ -17,7 +17,6 @@ Gem::Specification.new do |gem|
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
19
 
20
- gem.add_dependency 'activesupport', "~> #{Capistrano::O2webRecipes::RAILS_VERSION}", ">= #{Capistrano::O2webRecipes::RAILS_VERSION}.0"
21
20
  gem.add_dependency "capistrano", ">= 3.1"
22
21
  gem.add_dependency "yaml_db"
23
22
  gem.add_development_dependency "rake"
@@ -1,6 +1,6 @@
1
1
  module Capistrano
2
2
  module O2webRecipes
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.6"
4
4
  RAILS_VERSION = "4.2"
5
5
  end
6
6
  end
@@ -1,5 +1,39 @@
1
1
  require 'erb'
2
- require 'active_support/all'
2
+
3
+ Rake::Task["deploy:compile_assets"].clear
4
+
5
+ namespace :deploy do
6
+ desc 'Compile assets'
7
+ task :compile_assets => [:set_rails_env] do
8
+ # invoke 'deploy:assets:precompile'
9
+ invoke 'deploy:assets:precompile_local'
10
+ invoke 'deploy:assets:backup_manifest'
11
+ end
12
+
13
+ namespace :assets do
14
+ desc "Precompile assets locally and then rsync to web servers"
15
+ task :precompile_local do
16
+ # compile assets locally
17
+ run_locally do
18
+ DB = YAML.load_file('config/database.yml')['development']
19
+ db_connection = "#{DB['adapter']}://#{DB['username']}:#{DB['password']}@#{DB['host']}/#{DB['database']}"
20
+ execute "RAILS_ENV=#{fetch(:stage)} DATABASE_URL=#{db_connection} bundle exec rake assets:precompile"
21
+ end
22
+
23
+ # rsync to each server
24
+ local_dir = "./public/assets/"
25
+ on roles( fetch(:assets_roles, [:web]) ) do
26
+ # this needs to be done outside run_locally in order for host to exist
27
+ remote_dir = "#{host.user}@#{host.hostname}:#{release_path}/public/assets/"
28
+
29
+ run_locally { execute "rsync -av --delete #{local_dir} #{remote_dir}" }
30
+ end
31
+
32
+ # clean up
33
+ run_locally { execute "rm -rf #{local_dir}" }
34
+ end
35
+ end
36
+ end
3
37
 
4
38
  namespace :load do
5
39
  task :defaults do
@@ -120,9 +154,9 @@ end
120
154
  namespace :nginx do
121
155
  def upload(server, source, destination)
122
156
  File.open(source, 'w') do |f|
123
- f.puts ERB.new(File.read("#{source}.erb")).result
157
+ f.puts ERB.new(File.read("#{source}.erb"), nil, '-').result
124
158
  end
125
- system "rsync --rsync-path='sudo rsync' -avzO -e 'ssh -p #{fetch(:port)}' '#{source}' #{fetch(:admin_name)}@#{server.hostname}:#{destination}"
159
+ system "rsync --rsync-path='sudo rsync' -avzO -e 'ssh -p #{fetch(:port)}' '#{source}' #{fetch(:deployer_name)}@#{server.hostname}:#{destination}"
126
160
  FileUtils.rm_f source
127
161
  end
128
162
 
@@ -36,6 +36,11 @@ server {
36
36
  # listen 443 ssl;
37
37
  # ssl_certificate /etc/ssl/certs/<%= fetch(:server) %>.chained.crt;
38
38
  # ssl_certificate_key /etc/ssl/private/<%= fetch(:server) %>.key;
39
+
40
+ # redirect https://www.server_name.com to https://server_name.com
41
+ #if ($host = www.$server_name) {
42
+ # rewrite ^(.*) https://$server_name$request_uri? permanent;
43
+ #}
39
44
  <% end -%>
40
45
 
41
46
  client_max_body_size <%= fetch(:nginx_max_body_size) %>;
metadata CHANGED
@@ -1,35 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-o2web-recipes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrice Lebel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-18 00:00:00.000000000 Z
11
+ date: 2016-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: activesupport
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '4.2'
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: 4.2.0
23
- type: :runtime
24
- prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
26
- requirements:
27
- - - "~>"
28
- - !ruby/object:Gem::Version
29
- version: '4.2'
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: 4.2.0
33
13
  - !ruby/object:Gem::Dependency
34
14
  name: capistrano
35
15
  requirement: !ruby/object:Gem::Requirement