playframework-capistrano 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/lib/playframework/capistrano/version.rb +5 -0
- data/lib/playframework/capistrano.rb +83 -0
- data/playframework-capistrano.gemspec +25 -0
- metadata +102 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Tomás Augusto Müller
|
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,29 @@
|
|
1
|
+
# Playframework::Capistrano
|
2
|
+
|
3
|
+
PlayFramework / Capistrano Integration Gem.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
PlayFramework / Capistrano integration is available as a separate gem. Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'playframework-capistrano'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install playframework-capistrano
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# Recipes for using PlayFramework on a server with capistrano.
|
2
|
+
|
3
|
+
module Capistrano
|
4
|
+
Configuration.instance(true).load do
|
5
|
+
|
6
|
+
# Taken from the capistrano code.
|
7
|
+
def _cset(name, *args, &block)
|
8
|
+
unless exists?(name)
|
9
|
+
set(name, *args, &block)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
_cset(:application, 'my_application')
|
14
|
+
_cset(:deploy_to, "/var/lib/#{application}")
|
15
|
+
|
16
|
+
_cset(:log_dir, '/var/log')
|
17
|
+
|
18
|
+
_cset(:prod_conf, 'prod.conf')
|
19
|
+
_cset(:project_home, '.')
|
20
|
+
|
21
|
+
|
22
|
+
namespace :playframework do
|
23
|
+
task :setup do
|
24
|
+
run "mkdir -p #{deploy_to}"
|
25
|
+
put "#!/bin/bash\nnohup bash -c \"cd #{deploy_to} && target/start $* &>> #{log_dir}/#{application}.log 2>&1\" &> /dev/null &", "#{deploy_to}/start.sh", :mode => '755', :via => :scp
|
26
|
+
put "#!/bin/bash\npid=`cat RUNNING_PID 2> /dev/null`\nif [ \"$pid\" == \"\" ]; then echo '#{application} is not running'; exit 0; fi\necho 'Stopping #{application}...'\nkill -SIGTERM $pid", "#{deploy_to}/stop.sh", :mode => '755', :via => :scp
|
27
|
+
end
|
28
|
+
|
29
|
+
task :deploy_prod, :roles => :prod do
|
30
|
+
package
|
31
|
+
stop
|
32
|
+
copy_app_files
|
33
|
+
start_prod
|
34
|
+
end
|
35
|
+
|
36
|
+
task :deploy_dev, :roles => :dev do
|
37
|
+
package
|
38
|
+
stop
|
39
|
+
copy_app_files
|
40
|
+
start_dev
|
41
|
+
end
|
42
|
+
|
43
|
+
task :stop do
|
44
|
+
depend :remote, deploy_to
|
45
|
+
targets = find_servers_for_task(current_task)
|
46
|
+
failed_targets = targets.map do |target|
|
47
|
+
cmd = "ssh #{user}@#{target.host} 'cd #{deploy_to} && ./stop.sh'"
|
48
|
+
target.host unless system cmd
|
49
|
+
end.compact
|
50
|
+
raise "Stopping #{application} failed on #{failed_targets.join(',')}" if failed_targets.any?
|
51
|
+
end
|
52
|
+
|
53
|
+
task :start_prod do
|
54
|
+
targets = find_servers_for_task(current_task)
|
55
|
+
failed_targets = targets.map do |target|
|
56
|
+
cmd = "ssh #{user}@#{target.host} 'cd #{deploy_to} && ./start.sh -Dconfig.resource=#{prod_conf}'"
|
57
|
+
target.host unless system cmd
|
58
|
+
end.compact
|
59
|
+
raise "Starting #{application} failed on #{failed_targets.join(',')}" if failed_targets.any?
|
60
|
+
end
|
61
|
+
|
62
|
+
task :start_dev do
|
63
|
+
targets = find_servers_for_task(current_task)
|
64
|
+
failed_targets = targets.map do |target|
|
65
|
+
cmd = "ssh #{user}@#{target.host} 'cd #{deploy_to} && ./start.sh'"
|
66
|
+
target.host unless system cmd
|
67
|
+
end.compact
|
68
|
+
raise "Starting #{application} failed on #{failed_targets.join(',')}" if failed_targets.any?
|
69
|
+
end
|
70
|
+
|
71
|
+
task :package do
|
72
|
+
system "cd #{project_home} && play clean compile test stage"
|
73
|
+
raise "Error in package task" if not $?.success?
|
74
|
+
end
|
75
|
+
|
76
|
+
task :copy_app_files do
|
77
|
+
run "rm -fr #{deploy_to}/target"
|
78
|
+
upload "#{project_home}/target", deploy_to, :via => :scp, :recursive => true
|
79
|
+
end
|
80
|
+
end # end namespace playframework
|
81
|
+
|
82
|
+
end if Capistrano.const_defined? :Configuration and Capistrano::Configuration.methods.map(&:to_sym).include? :instance
|
83
|
+
end # end module Capistrano
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'playframework/capistrano/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "playframework-capistrano"
|
8
|
+
spec.version = Playframework::Capistrano::VERSION
|
9
|
+
spec.authors = ["Tomás Augusto Müller"]
|
10
|
+
spec.email = ["tomas.am@gmail.com"]
|
11
|
+
spec.description = %q{PlayFramework / Capistrano integration Gem}
|
12
|
+
spec.summary = %q{Deploy PlayFramework apps with Capistrano}
|
13
|
+
spec.homepage = "https://github.com/tomasmuller/playframework-capistrano"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.add_dependency 'capistrano', '>=2.0.0'
|
17
|
+
|
18
|
+
spec.files = `git ls-files`.split($/)
|
19
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: playframework-capistrano
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Tomás Augusto Müller
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-05-04 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: capistrano
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 2.0.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 2.0.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: bundler
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '1.3'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '1.3'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rake
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
description: PlayFramework / Capistrano integration Gem
|
63
|
+
email:
|
64
|
+
- tomas.am@gmail.com
|
65
|
+
executables: []
|
66
|
+
extensions: []
|
67
|
+
extra_rdoc_files: []
|
68
|
+
files:
|
69
|
+
- .gitignore
|
70
|
+
- Gemfile
|
71
|
+
- LICENSE.txt
|
72
|
+
- README.md
|
73
|
+
- Rakefile
|
74
|
+
- lib/playframework/capistrano.rb
|
75
|
+
- lib/playframework/capistrano/version.rb
|
76
|
+
- playframework-capistrano.gemspec
|
77
|
+
homepage: https://github.com/tomasmuller/playframework-capistrano
|
78
|
+
licenses:
|
79
|
+
- MIT
|
80
|
+
post_install_message:
|
81
|
+
rdoc_options: []
|
82
|
+
require_paths:
|
83
|
+
- lib
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
86
|
+
requirements:
|
87
|
+
- - ! '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
none: false
|
92
|
+
requirements:
|
93
|
+
- - ! '>='
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
requirements: []
|
97
|
+
rubyforge_project:
|
98
|
+
rubygems_version: 1.8.25
|
99
|
+
signing_key:
|
100
|
+
specification_version: 3
|
101
|
+
summary: Deploy PlayFramework apps with Capistrano
|
102
|
+
test_files: []
|