cap-templates 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +17 -0
- data/LICENSE.txt +22 -0
- data/README.md +46 -0
- data/Rakefile +1 -0
- data/cap-templates.gemspec +22 -0
- data/lib/cap-templates.rb +30 -0
- metadata +79 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
N2EyYmE3YmNiOWQwODdlMzA1YTRmNjgwNjJjZGQ3NDBkZjc0ZGY4Nw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
Y2U4MDQ0ODQ4NjhiZDQxYzQyOGVjNGU4ZWQ1NDliOWMxNDBiZDdlNw==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MzU4YjlkYTM1MDcwNjc4ZDY2ODg2YzU5ODA3Y2FkNTBhZDk4Y2ZlNGJiNWUy
|
10
|
+
ZmI1NjczMGUxOWQ3Yzc1ZGYxY2JiOTQ1NDgzNjYyOWI5OTc2NmNkODgxMDA1
|
11
|
+
MjliNzExZTgxYTUwZTRlNzgyNDY5MjgwNzUwYTFkMzM2NmFiNDY=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
Mjk0MjM3ZDY1N2Q5NzMzOGY1OTFiZjU4NGRkNmYwMmQwMTc0NTYyMmU2Yjc2
|
14
|
+
MmExOTQ0ZmMwNzI5OWY4MTk1ODEwZmUzZmE2MzA1ZDZlODQ1ZGMxNjBhYWJk
|
15
|
+
Yjk3ZjY3MGFiOTMwMzA5MDhlMTBkOThhY2I4NGYxNzA5ZTRjMmY=
|
data/.gitignore
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Erez Rabih
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
cap-templates
|
2
|
+
=============
|
3
|
+
|
4
|
+
Capistrano plugin that resolved .erb files on deploy
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
gem 'cap-templates'
|
11
|
+
|
12
|
+
And then execute:
|
13
|
+
|
14
|
+
$ bundle
|
15
|
+
|
16
|
+
Or install it yourself as:
|
17
|
+
|
18
|
+
$ gem install cap-templates
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
In your `deploy.rb` you should:
|
23
|
+
|
24
|
+
1. require `cap-templates`
|
25
|
+
2. set the `erb_templates` variable.
|
26
|
+
|
27
|
+
A typical deploy file might look like this:
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
require 'cap-templates'
|
31
|
+
set :erb_templates, ['nginx/configuration.erb' ,'unicorn.rb.erb']
|
32
|
+
```
|
33
|
+
|
34
|
+
Files inside `erb_templates` are relative to your `root_path/config/` directory.
|
35
|
+
|
36
|
+
These files will be resolved to the filename with the .erb extention omitted.
|
37
|
+
|
38
|
+
The template files are not deleted in the process
|
39
|
+
|
40
|
+
## Contributing
|
41
|
+
|
42
|
+
1. Fork it
|
43
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
44
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
45
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
46
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "cap-templates"
|
7
|
+
spec.version = "0.0.1"
|
8
|
+
spec.authors = ["Erez Rabih"]
|
9
|
+
spec.email = ["erez.rabih@gmail.com"]
|
10
|
+
spec.description = %q{Capistrano plugin that resolves ERB templates}
|
11
|
+
spec.summary = %q{Capistrano plugin that resolves ERB templates}
|
12
|
+
spec.homepage = "https://github.com/FTBpro/cap-templates"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files`.split($/)
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
21
|
+
spec.add_development_dependency "rake"
|
22
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
2
|
+
|
3
|
+
def get_binding
|
4
|
+
binding
|
5
|
+
end
|
6
|
+
|
7
|
+
def from_template(file)
|
8
|
+
require 'erb'
|
9
|
+
template = File.read(file)
|
10
|
+
ERB.new(template).result(self.get_binding)
|
11
|
+
end
|
12
|
+
|
13
|
+
def resolve_template(file)
|
14
|
+
template_file_name = File.join(Dir.pwd, "config", file)
|
15
|
+
resolved_content = from_template(template_file_name)
|
16
|
+
put resolved_content, File.join(release_path, "config", file).gsub(/\.erb$/, "")
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
namespace :deploy do
|
21
|
+
desc "Resolves ERB configuration templates"
|
22
|
+
task :resolve_configuration_erbs, roles: :app do
|
23
|
+
erb_templates.each { |t| resolve_template t }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
after "deploy:update_code", "deploy:resolve_configuration_erbs"
|
28
|
+
end
|
29
|
+
|
30
|
+
|
metadata
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cap-templates
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Erez Rabih
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-01-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Capistrano plugin that resolves ERB templates
|
42
|
+
email:
|
43
|
+
- erez.rabih@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- .gitignore
|
49
|
+
- LICENSE.txt
|
50
|
+
- README.md
|
51
|
+
- Rakefile
|
52
|
+
- cap-templates.gemspec
|
53
|
+
- lib/cap-templates.rb
|
54
|
+
homepage: https://github.com/FTBpro/cap-templates
|
55
|
+
licenses:
|
56
|
+
- MIT
|
57
|
+
metadata: {}
|
58
|
+
post_install_message:
|
59
|
+
rdoc_options: []
|
60
|
+
require_paths:
|
61
|
+
- lib
|
62
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ! '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ! '>='
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
requirements: []
|
73
|
+
rubyforge_project:
|
74
|
+
rubygems_version: 2.0.5
|
75
|
+
signing_key:
|
76
|
+
specification_version: 4
|
77
|
+
summary: Capistrano plugin that resolves ERB templates
|
78
|
+
test_files: []
|
79
|
+
has_rdoc:
|