capistrano-exts 1.3.4 → 1.3.5

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.
data/README.md CHANGED
@@ -17,7 +17,7 @@ gem install capistrano-exts
17
17
  or add it to your Gemfile
18
18
 
19
19
  ```ruby
20
- gem 'capistrano-exts', '>=1.3.4'
20
+ gem 'capistrano-exts', '>=1.3.5'
21
21
  ```
22
22
 
23
23
  Setup
@@ -123,6 +123,10 @@ set :application_url, %w(example.com www.example.com)
123
123
  # What are the names of the indexes
124
124
  set :web_server_indexes, %w(index.php index.html)
125
125
 
126
+ # Deny access ?
127
+ # Define here an array of files/pathes to deny access from.
128
+ set :denied_access, [ ".htaccess" ]
129
+
126
130
  # HTTP Basic Authentifications
127
131
  # Uncomment this if you would like to add HTTP Basic authentifications,
128
132
  #
@@ -123,6 +123,10 @@ set :application_url, %w(example.com www.example.com)
123
123
  # What are the names of the indexes
124
124
  set :web_server_indexes, %w(index.php index.html)
125
125
 
126
+ # Deny access ?
127
+ # Define here an array of files/pathes to deny access from.
128
+ set :denied_access, [ ".htaccess" ]
129
+
126
130
  # HTTP Basic Authentifications
127
131
  # Uncomment this if you would like to add HTTP Basic authentifications,
128
132
  #
@@ -123,6 +123,10 @@ set :application_url, %w(example.com www.example.com)
123
123
  # What are the names of the indexes
124
124
  set :web_server_indexes, %w(index.php index.html)
125
125
 
126
+ # Deny access ?
127
+ # Define here an array of files/pathes to deny access from.
128
+ set :denied_access, [ ".htaccess" ]
129
+
126
130
  # HTTP Basic Authentifications
127
131
  # Uncomment this if you would like to add HTTP Basic authentifications,
128
132
  #
@@ -123,6 +123,10 @@ set :application_url, %w(example.com www.example.com)
123
123
  # What are the names of the indexes
124
124
  set :web_server_indexes, %w(index.php index.html)
125
125
 
126
+ # Deny access ?
127
+ # Define here an array of files/pathes to deny access from.
128
+ set :denied_access, [ ".htaccess" ]
129
+
126
130
  # HTTP Basic Authentifications
127
131
  # Uncomment this if you would like to add HTTP Basic authentifications,
128
132
  #
@@ -123,6 +123,10 @@ set :application_url, %w(example.com www.example.com)
123
123
  # What are the names of the indexes
124
124
  set :web_server_indexes, %w(index.php index.html)
125
125
 
126
+ # Deny access ?
127
+ # Define here an array of files/pathes to deny access from.
128
+ set :denied_access, [ ".htaccess" ]
129
+
126
130
  # HTTP Basic Authentifications
127
131
  # Uncomment this if you would like to add HTTP Basic authentifications,
128
132
  #
@@ -123,6 +123,10 @@ set :application_url, %w(example.com www.example.com)
123
123
  # What are the names of the indexes
124
124
  set :web_server_indexes, %w(index.php index.html)
125
125
 
126
+ # Deny access ?
127
+ # Define here an array of files/pathes to deny access from.
128
+ set :denied_access, [ ".htaccess" ]
129
+
126
130
  # HTTP Basic Authentifications
127
131
  # Uncomment this if you would like to add HTTP Basic authentifications,
128
132
  #
@@ -123,6 +123,10 @@ set :application_url, %w(example.com www.example.com)
123
123
  # What are the names of the indexes
124
124
  set :web_server_indexes, %w(index.php index.html)
125
125
 
126
+ # Deny access ?
127
+ # Define here an array of files/pathes to deny access from.
128
+ set :denied_access, [ ".htaccess" ]
129
+
126
130
  # HTTP Basic Authentifications
127
131
  # Uncomment this if you would like to add HTTP Basic authentifications,
128
132
  #
@@ -123,6 +123,10 @@ set :application_url, %w(example.com www.example.com)
123
123
  # What are the names of the indexes
124
124
  set :web_server_indexes, %w(index.php index.html)
125
125
 
126
+ # Deny access ?
127
+ # Define here an array of files/pathes to deny access from.
128
+ set :denied_access, [ ".htaccess" ]
129
+
126
130
  # HTTP Basic Authentifications
127
131
  # Uncomment this if you would like to add HTTP Basic authentifications,
128
132
  #
@@ -123,6 +123,10 @@ set :application_url, %w(example.com www.example.com)
123
123
  # What are the names of the indexes
124
124
  set :web_server_indexes, %w(index.php index.html)
125
125
 
126
+ # Deny access ?
127
+ # Define here an array of files/pathes to deny access from.
128
+ set :denied_access, [ ".htaccess" ]
129
+
126
130
  # HTTP Basic Authentifications
127
131
  # Uncomment this if you would like to add HTTP Basic authentifications,
128
132
  #
@@ -22,6 +22,7 @@ Capistrano::Configuration.instance(:must_exist).load do
22
22
  namespace :contao do
23
23
  desc "[internal] Setup contao shared contents"
24
24
  task :setup, :roles => :app, :except => { :no_release => true } do
25
+ shared_path = fetch :shared_path
25
26
  run <<-CMD
26
27
  #{try_sudo} mkdir -p #{shared_path}/logs &&
27
28
  #{try_sudo} mkdir -p #{shared_path}/config &&
@@ -31,6 +32,11 @@ Capistrano::Configuration.instance(:must_exist).load do
31
32
  #{try_sudo} mkdir -p #{shared_path}/contents/audio &&
32
33
  #{try_sudo} mkdir -p #{shared_path}/contents/pdf
33
34
  CMD
35
+
36
+ deny_htaccess = "order deny,allow"
37
+ deny_htaccess << "deny from all"
38
+
39
+ put deny_htaccess, "#{shared_path}/logs/.htaccess"
34
40
  end
35
41
 
36
42
  desc "[internal] Setup contao's localconfig"
@@ -53,7 +59,7 @@ Capistrano::Configuration.instance(:must_exist).load do
53
59
  localconfig.gsub!(/#DB_NAME#/, mysql_db_name)
54
60
  end
55
61
 
56
- put localconfig, "#{shared_path}/config/localconfig.php"
62
+ put localconfig, "#{fetch :shared_path}/config/localconfig.php"
57
63
  end
58
64
 
59
65
  desc "[internal] Setup .htaccess"
@@ -74,18 +80,21 @@ Capistrano::Configuration.instance(:must_exist).load do
74
80
  desc "[internal] Fix contao's symlinks to the shared path"
75
81
  task :fix_links, :roles => :app, :except => { :no_release => true } do
76
82
  contents_path = fetch :contents_path, "#{fetch :public_path}/tl_files/contents"
83
+ current_path = fetch :current_path
84
+ latest_release = fetch :latest_release
85
+ shared_path = fetch :shared_path
77
86
 
78
87
  # At this point, the current_path does not exists and by running an mkdir
79
88
  # later, we're actually breaking stuff.
80
89
  # So replace current_path with latest_release in the contents_path string
81
- contents_path.gsub!(%r{#{current_path}}, fetch(:latest_release))
90
+ contents_path.gsub! %r{#{current_path}}, latest_release
82
91
 
83
92
  # Remove files
84
93
  run <<-CMD
85
94
  #{try_sudo} rm -f #{contents_path} &&
86
- #{try_sudo} rm -rf #{fetch :latest_release}/public/system/logs &&
87
- #{try_sudo} rm -f #{fetch :latest_release}/public/system/config/localconfig.php &&
88
- #{try_sudo} rm -f #{fetch :latest_release}/public/.htaccess
95
+ #{try_sudo} rm -rf #{latest_release}/public/system/logs &&
96
+ #{try_sudo} rm -f #{latest_release}/public/system/config/localconfig.php &&
97
+ #{try_sudo} rm -f #{latest_release}/public/.htaccess
89
98
  CMD
90
99
 
91
100
  run <<-CMD
@@ -94,10 +103,10 @@ Capistrano::Configuration.instance(:must_exist).load do
94
103
 
95
104
  # Create symlinks
96
105
  run <<-CMD
97
- #{try_sudo} ln -nsf #{fetch :shared_path}/contents #{contents_path} &&
98
- #{try_sudo} ln -nsf #{fetch :shared_path}/config/htaccess.txt #{fetch :latest_release}/public/.htaccess &&
99
- #{try_sudo} ln -nsf #{fetch :shared_path}/config/localconfig.php #{fetch :latest_release}/public/system/config/localconfig.php &&
100
- #{try_sudo} ln -nsf #{fetch :shared_path}/logs #{fetch :latest_release}/public/system/logs
106
+ #{try_sudo} ln -nsf #{shared_path}/contents #{contents_path} &&
107
+ #{try_sudo} ln -nsf #{shared_path}/config/htaccess.txt #{latest_release}/public/.htaccess &&
108
+ #{try_sudo} ln -nsf #{shared_path}/config/localconfig.php #{latest_release}/public/system/config/localconfig.php &&
109
+ #{try_sudo} ln -nsf #{shared_path}/logs #{latest_release}/public/system/logs
101
110
  CMD
102
111
  end
103
112
  end
@@ -24,6 +24,7 @@ Capistrano::Configuration.instance(:must_exist).load do
24
24
  nginx.public_path = fetch :public_path
25
25
  nginx.logs_path = fetch :logs_path
26
26
  nginx.application_url = fetch :application_url
27
+ nginx.denied_access = fetch :denied_access if exists?(:denied_access)
27
28
 
28
29
  nginx.listen_port = fetch(:web_server_listen_port) if exists?(:web_server_listen_port)
29
30
 
@@ -121,6 +121,10 @@ set :application_url, %w(example.com www.example.com)
121
121
  # What are the names of the indexes
122
122
  set :web_server_indexes, %w(index.php index.html)
123
123
 
124
+ # Deny access ?
125
+ # Define here an array of files/pathes to deny access from.
126
+ set :denied_access, [ ".htaccess" ]
127
+
124
128
  # HTTP Basic Authentifications
125
129
  # Uncomment this if you would like to add HTTP Basic authentifications,
126
130
  #
@@ -41,9 +41,11 @@ server {
41
41
  <% end %>
42
42
  }
43
43
 
44
- location ~ /\.ht {
45
- deny all;
46
- }
44
+ <% @denied_access.each do |f| %>
45
+ location ~ <%= Regexp.escape f %> {
46
+ deny all;
47
+ }
48
+ <% end if @denied_access.present? %>
47
49
 
48
50
  <% if php_fpm? %>
49
51
  location ~ .php$ {
@@ -3,7 +3,7 @@ module Capistrano
3
3
  module Version #:nodoc:
4
4
  MAJOR = 1
5
5
  MINOR = 3
6
- TINY = 4
6
+ TINY = 5
7
7
 
8
8
  ARRAY = [MAJOR, MINOR, TINY]
9
9
  STRING = ARRAY.join(".")
@@ -23,9 +23,7 @@ server {
23
23
 
24
24
  }
25
25
 
26
- location ~ /\.ht {
27
- deny all;
28
- }
26
+
29
27
 
30
28
  location ~ .php$ {
31
29
  fastcgi_pass localhost:30313;
@@ -208,6 +208,12 @@ describe Nginx do
208
208
  subject.php_fpm_port = 5454
209
209
  subject.render.should =~ %r{\s+fastcgi_pass\s+localhost:5454.+$}
210
210
  end
211
+
212
+ it "should render 'denied_access'" do
213
+ subject.denied_access = ["/system/logs", "/tl_file/.htaccess"]
214
+ subject.render.should =~ /location ~ \/system\/logs {.*deny\s+all;.*}/m
215
+ subject.render.should =~ /location ~ \/tl_file\/\\.htaccess {.*deny\s+all;.*}/m
216
+ end
211
217
  end
212
218
 
213
219
  describe ":passenger" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-exts
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.4
4
+ version: 1.3.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-09-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano
16
- requirement: &2152783480 !ruby/object:Gem::Requirement
16
+ requirement: &2151902980 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 2.8.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2152783480
24
+ version_requirements: *2151902980
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: i18n
27
- requirement: &2152683500 !ruby/object:Gem::Requirement
27
+ requirement: &2151900160 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.6.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2152683500
35
+ version_requirements: *2151900160
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: activesupport
38
- requirement: &2152629920 !ruby/object:Gem::Requirement
38
+ requirement: &2151897680 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 3.1.0
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2152629920
46
+ version_requirements: *2151897680
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: guard
49
- requirement: &2152451100 !ruby/object:Gem::Requirement
49
+ requirement: &2151896080 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.6.2
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2152451100
57
+ version_requirements: *2151896080
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: guard-bundler
60
- requirement: &2152414620 !ruby/object:Gem::Requirement
60
+ requirement: &2151910960 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 0.1.3
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2152414620
68
+ version_requirements: *2151910960
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: guard-rspec
71
- requirement: &2156285880 !ruby/object:Gem::Requirement
71
+ requirement: &2151910240 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 0.4.3
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *2156285880
79
+ version_requirements: *2151910240
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rspec
82
- requirement: &2151922700 !ruby/object:Gem::Requirement
82
+ requirement: &2151908780 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,7 +87,7 @@ dependencies:
87
87
  version: 2.6.0
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *2151922700
90
+ version_requirements: *2151908780
91
91
  description: Handy extensions for Capistrano
92
92
  email:
93
93
  - wael.nasreddine@gmail.com