capistrano-former03 0.0.1 → 0.0.2

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: 6f93a0a9ae8a6fe227953f82f4337b97ca0729f6
4
- data.tar.gz: c65970a378ae6ddfc6b3044900a0de7041dbe995
3
+ metadata.gz: 67b7d66c381ef6c78c06b1140493b6fcb76e37a4
4
+ data.tar.gz: 2b982ebdf4ad4d78b89b2c95d5fa66a6106bb042
5
5
  SHA512:
6
- metadata.gz: 99d652793b3b066e9c241b069af58c26b194fc88100bceaddeb6ffb187a29a4cf6b2a7706e629d6c5c955a64b33c735e6f3814f97da4d747417d18dcdfffdf97
7
- data.tar.gz: 51f44aa275d514356a5485bc7e8a84f55f8d95c440def98e1da79b9354cea2bcdbea5b6059d550a77e04d50f9ce351674ecc5dcf06d60a4e974d74f4b9d61c1e
6
+ metadata.gz: 659d77f10ccd256f5cc3763adc5a870f7d92e06d56f2a2523fdb0e0f73b55e38374fc15ea843ba645ae37df518a2fcd4786d0d8e86d94795d547500e3ca23e19
7
+ data.tar.gz: fda656e846548a2a32c77e4a526a0a3e87ea2419dc115e0e4fc144ee7746e303b1cb86cd17da2e9030132408f79a8a5a6e7f1295fb000e41269d6b743208eeb1
data/README.md CHANGED
@@ -3,6 +3,11 @@ Capistrano extensions for FORMER 03
3
3
 
4
4
  Adds Features for Capistrano that are needed for FORMER 03's deployment
5
5
 
6
+ [![Gem version](https://badge.fury.io/rb/capistrano-former03.png)][gem]
7
+
8
+ [capistrano]: https://github.com/capistrano/capistrano
9
+ [gem]: https://rubygems.org/gems/capistrano-former03
10
+
6
11
  Implemented features:
7
12
  --------------
8
13
 
@@ -15,15 +20,13 @@ Implemented features:
15
20
  - Deploy own static compiled versions of busybox and rsync if configured / needed
16
21
  - Relative symlinking (often needed if ssh or webapp is chrooted)
17
22
  - Current directory is no symlink (some hosting provider don't support wwwroot symlinked)
23
+ - Fix rights at local_stage
18
24
 
19
25
  (Planned) features:
20
26
  --------------
21
27
 
28
+ -?
22
29
 
23
- [![Gem version](https://badge.fury.io/rb/capistrano-former03)][gem]
24
-
25
- [capistrano]: https://github.com/capistrano/capistrano
26
- [gem]: https://rubygems.org/gems/capistrano-former03
27
30
 
28
31
  Requirements
29
32
  ------------
@@ -83,6 +86,9 @@ deploy_busybox_bin | false | deploy a static version of busybox
83
86
  deploy_rsync_bin | nil (Autodetect) | deploy a static version of rsync
84
87
  relative_symlinks | true | create all symlinks with relative
85
88
  current_path_real_dir | false | move actual release to current_path to have a real directory instead of symlink
89
+ ensure_file_mode | nil | If given all files are chmoded to that mode
90
+ ensure_dir_mode | nil | If given all directories are chmoded to that mode
91
+ ensure_path_mode | {} | Dictionary with path => mode mapping for special files/directories
86
92
 
87
93
  Overview
88
94
  --------
@@ -136,7 +142,7 @@ Author
136
142
  - [simonswine][simonswine]
137
143
 
138
144
  [linyows]: https://github.com/linyows
139
- [simonswine]: https://github.com/linyows
145
+ [simonswine]: https://github.com/simonswine
140
146
 
141
147
  License
142
148
  -------
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Former03
3
- VERSION = '0.0.1'
3
+ VERSION = '0.0.2'
4
4
  end
5
5
  end
@@ -19,6 +19,10 @@ namespace :former03 do
19
19
  set :relative_symlinks, true
20
20
  set :current_path_real_dir, false
21
21
 
22
+ set :ensure_file_mode, nil
23
+ set :ensure_dir_mode, nil
24
+ set :ensure_path_mode, {}
25
+
22
26
  set :remote_stage_path, -> {
23
27
  Pathname.new(deploy_to).join(fetch(:remote_stage))
24
28
  }
@@ -84,9 +88,6 @@ namespace :former03 do
84
88
  desc 'Create the local staging directory'
85
89
  task :mkdir_stage => :check do
86
90
 
87
- # Get full path of local stage
88
- set :local_stage_path, Pathname.pwd.join(fetch(:local_stage))
89
-
90
91
  # if already exits finish task
91
92
  next if File.directory? fetch(:local_stage)
92
93
 
@@ -114,10 +115,9 @@ namespace :former03 do
114
115
  git_submodule = [:git, :submodule]
115
116
 
116
117
  run_locally do
117
- # Bugfix for git versions < 1.9
118
-
119
118
  # Check if .gitmodules exist
120
119
  if test :test, '-e', '.gitmodules'
120
+ # Bugfix for git versions < 1.9
121
121
  execute(*git_submodule, :init)
122
122
  execute(*git_submodule, :sync)
123
123
  execute(*git_submodule, :update)
@@ -134,7 +134,7 @@ namespace :former03 do
134
134
  if test :test, '-e', '.gitmodules'
135
135
  # check out all submodules
136
136
  git_submodule = git_prefix + [:submodule]
137
- git_submodule_foreach = git_submodule + [:foreach,:git]
137
+ git_submodule_foreach = git_submodule + [:foreach, :git, '--work-tree', '.']
138
138
  execute(*git_submodule, :init)
139
139
  execute(*git_submodule, :sync)
140
140
  execute(*git_submodule, :update)
@@ -146,6 +146,25 @@ namespace :former03 do
146
146
  end
147
147
  end
148
148
  end
149
+ desc 'Fix file/dir rights on local stage'
150
+ task :fix_rights => :stage do
151
+ run_locally do
152
+ within fetch(:local_stage_path) do
153
+ # fix files
154
+ if fetch(:ensure_file_mode)
155
+ execute :find, '.', '-type', :f, '-print0', '|', :xargs, '-0', :chmod, fetch(:ensure_file_mode)
156
+ end
157
+ # fix directories
158
+ if fetch(:ensure_dir_mode)
159
+ execute :find, '.', '-type', :d, '-print0', '|', :xargs, '-0', :chmod, fetch(:ensure_dir_mode)
160
+ end
161
+ # fix special paths
162
+ fetch(:ensure_path_mode).each do |path,mode|
163
+ execute :chmod, mode, path
164
+ end
165
+ end
166
+ end
167
+ end
149
168
  end
150
169
 
151
170
  namespace :remote do
@@ -210,7 +229,7 @@ namespace :former03 do
210
229
  end
211
230
 
212
231
  desc 'Sync to deployment hosts from local'
213
- task :sync => [:check, 'former03:local:stage'] do
232
+ task :sync => [:check, 'former03:local:fix_rights'] do
214
233
  roles(:all).each do |role|
215
234
  rsync = Capistrano::Former03::Rsync.new(
216
235
  :src_path => fetch(:local_stage_path),
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-former03
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Simon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-28 00:00:00.000000000 Z
11
+ date: 2014-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano