omeka-recipes 0.2.0
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/.gitignore +17 -0
- data/.rvmrc +1 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +157 -0
- data/Rakefile +2 -0
- data/lib/helpers.rb +63 -0
- data/lib/omeka-recipes.rb +6 -0
- data/lib/omeka-recipes/apache.rb +10 -0
- data/lib/omeka-recipes/application.rb +47 -0
- data/lib/omeka-recipes/db.rb +108 -0
- data/lib/omeka-recipes/log.rb +29 -0
- data/lib/omeka-recipes/omeka.rb +59 -0
- data/lib/omeka-recipes/symlinks.rb +29 -0
- data/lib/omeka-recipes/version.rb +5 -0
- data/omeka-recipes.gemspec +24 -0
- metadata +133 -0
data/.gitignore
ADDED
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use 1.9.3@omeka-recipes
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Wayne Graham
|
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,157 @@
|
|
1
|
+
# Omeka::Recipes
|
2
|
+
|
3
|
+
Useful Capistrano recipes including:
|
4
|
+
|
5
|
+
* Create MySQL database and user on server (via prompts)
|
6
|
+
* Restart/Stop/Start Apache/HTTPD server
|
7
|
+
* Log rotation and tailing commands
|
8
|
+
* Deploy Omeka
|
9
|
+
|
10
|
+
## Included Tasks
|
11
|
+
|
12
|
+
* `cap apache:reload`
|
13
|
+
* `cap apache:restart`
|
14
|
+
* `cap apache:start`
|
15
|
+
* `cap apache:stop`
|
16
|
+
* `cap db:create_ini`
|
17
|
+
* `cap db:myql:dump`
|
18
|
+
* `cap db:myql:fetch_dump`
|
19
|
+
* `cap db:myql:restore`
|
20
|
+
* `cap db:mysql:setup`
|
21
|
+
* `cap log:rotate`
|
22
|
+
* `cap log:tail`
|
23
|
+
* `cap omeka:db_ini`
|
24
|
+
* `cap omeka:plugins`
|
25
|
+
* `cap omeka:themes`
|
26
|
+
* `cap symlinks:make`
|
27
|
+
|
28
|
+
## Installation
|
29
|
+
|
30
|
+
Add this line to your application's Gemfile:
|
31
|
+
|
32
|
+
gem 'omeka-recipes'
|
33
|
+
|
34
|
+
And then execute:
|
35
|
+
|
36
|
+
$ bundle
|
37
|
+
|
38
|
+
Or install it yourself as:
|
39
|
+
|
40
|
+
$ gem install omeka-recipes
|
41
|
+
|
42
|
+
## Usage
|
43
|
+
|
44
|
+
To set up the initial Capistrano deploy file, go to your application
|
45
|
+
folder in the command line and enter the `capify` command:
|
46
|
+
|
47
|
+
```bash
|
48
|
+
$ capify .
|
49
|
+
$ cap multistage:prepare
|
50
|
+
```
|
51
|
+
|
52
|
+
### Configuration
|
53
|
+
|
54
|
+
Inside a newly created `config/deploy.rb` file, add this:
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
require 'capistrano/ext/multistage'
|
58
|
+
|
59
|
+
# This should go at the end of the deploy.rb file
|
60
|
+
require 'capistrano_omeka'
|
61
|
+
```
|
62
|
+
|
63
|
+
### Plugins
|
64
|
+
Plugins are defined in the `plugins` hash, giving a plugin name, and it's
|
65
|
+
`git` repo. Be sure to use a **read-only** version.
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
plugins = {
|
69
|
+
'Neatline' => 'git://github.com/scholarslab/Neatline.git',
|
70
|
+
'NeatlineMaps' => 'git://github.com/scholarslab/NeatlineMaps.git',
|
71
|
+
'CsvImport' => 'git://github.com/omeka/plugin-CsvImport.git',
|
72
|
+
'Scripto' => 'git://github.com/omeka/plugin-Scripto.git'
|
73
|
+
}
|
74
|
+
```
|
75
|
+
|
76
|
+
### Themes
|
77
|
+
|
78
|
+
Themes are defined in the `themes` hash, passing a theme name and it's
|
79
|
+
`git` repository.
|
80
|
+
|
81
|
+
```ruby
|
82
|
+
themes = {
|
83
|
+
'neatline' => 'git://github.com/scholarslab/neatlinetheme.git'
|
84
|
+
'emiglio' => 'git://github.com/omeka/theme-emiglio.git'
|
85
|
+
}
|
86
|
+
```
|
87
|
+
## Example Configuration
|
88
|
+
|
89
|
+
The following is an example of a `config/deploy.rb` file:
|
90
|
+
|
91
|
+
```ruby
|
92
|
+
set :stages, %w(production staging)
|
93
|
+
set :default_stage, "staging"
|
94
|
+
require 'capistrano/ext/multistage'
|
95
|
+
|
96
|
+
require 'omeka-recipes'
|
97
|
+
|
98
|
+
set :application, "omeka"
|
99
|
+
set :repository, "git://github.com/omeka/Omeka.git"
|
100
|
+
|
101
|
+
set :scm, :git
|
102
|
+
|
103
|
+
set :branch, 'stable-1.5'
|
104
|
+
|
105
|
+
plugins = {
|
106
|
+
'Neatline' => 'git://github.com/scholarslab/Neatline.git',
|
107
|
+
'NeatlineFeatures' => 'git://github.com/scholarslab/NeatlineFeatures.git',
|
108
|
+
'NeatlineMaps' => 'git://github.com/scholarslab/NeatlineMaps.git',
|
109
|
+
'NeatlineTime' => 'git://github.com/scholarslab/NeatlineTime.git',
|
110
|
+
'SolrSearch' => 'git://github.com/scholarslab/SolrSearch.git',
|
111
|
+
}
|
112
|
+
|
113
|
+
themes = {
|
114
|
+
'mcos-omeka-theme' => 'git://github.com/scholarslab/mcos-omeka-theme.git'
|
115
|
+
}
|
116
|
+
|
117
|
+
after "deploy:restart", "deploy:cleanup"
|
118
|
+
```
|
119
|
+
In each of the stages of your deployment (e.g.
|
120
|
+
`deploy/deploy/production.rb`), you will need to add a definition to
|
121
|
+
tell capistrano where to go.
|
122
|
+
|
123
|
+
```ruby
|
124
|
+
server 'server.org', :app, :web, :primary => true
|
125
|
+
```
|
126
|
+
|
127
|
+
And your staging:
|
128
|
+
|
129
|
+
```ruby
|
130
|
+
server 'staging.server.org', :app, :db, :web, :primary => true
|
131
|
+
```
|
132
|
+
|
133
|
+
|
134
|
+
### RVM
|
135
|
+
|
136
|
+
RVM is disabled by default, but you can enable it by setting `:use_rvm,
|
137
|
+
true`. You may also leverage it by setting your `rvm_ruby_string` to an
|
138
|
+
appropriate version (default is `1.9.3`).
|
139
|
+
|
140
|
+
If `using_rvm` is true, the rvm recipe will load the RVM capistrano
|
141
|
+
extensions so you don't have to worry about them during your
|
142
|
+
deployments. You will need to make sure you have an `.rvmrc` file in the
|
143
|
+
project directory, and system-wide installation on the servers.
|
144
|
+
|
145
|
+
See [http://rvm.beginrescueend.com/rvm/install](the rvm site) for more information.
|
146
|
+
|
147
|
+
# Copyright
|
148
|
+
|
149
|
+
See the [LICENSE](https://github.com/waynegraham/omeka-recipes/blob/master/LICENSE) for more information.
|
150
|
+
|
151
|
+
## Contributing
|
152
|
+
|
153
|
+
1. Fork it
|
154
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
155
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
156
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
157
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/lib/helpers.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
# =========================================================================
|
2
|
+
# Helper methods for the recipes
|
3
|
+
# =========================================================================
|
4
|
+
|
5
|
+
# Automatically ests the environment based on presence of
|
6
|
+
# :stage (multistage gem), :rails_env, or RAILS_ENV variable; otherwise
|
7
|
+
# defaults to 'production'
|
8
|
+
def environment
|
9
|
+
if exists?(:stage)
|
10
|
+
stage
|
11
|
+
elsif exists(:rails_env)
|
12
|
+
rails_env
|
13
|
+
elsif(ENV['RAILS_ENV'])
|
14
|
+
ENV['RAILS_ENV']
|
15
|
+
else
|
16
|
+
"production"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def is_using(something, with_some_var)
|
21
|
+
exists?(with_some_var.to_sym) && fetch(with_some_var.to_sym).to_s.downcase == something
|
22
|
+
end
|
23
|
+
|
24
|
+
# Path where generators live
|
25
|
+
def templates_path
|
26
|
+
expand_path_for('../generators')
|
27
|
+
end
|
28
|
+
|
29
|
+
def docs_path
|
30
|
+
expand_path_for('../doc')
|
31
|
+
end
|
32
|
+
|
33
|
+
def expand_path_for(path)
|
34
|
+
expanded = File.join(File.dirname(__FILE__), path)
|
35
|
+
File.expand_path(expanded)
|
36
|
+
end
|
37
|
+
|
38
|
+
def parse_config(file)
|
39
|
+
require 'erb' # render not available in Capistrano 2
|
40
|
+
template = File.read(file)
|
41
|
+
return ERB.new(template).result(binding)
|
42
|
+
end
|
43
|
+
|
44
|
+
# Prompt user for a message
|
45
|
+
def ask(message, default=true)
|
46
|
+
Capistrano::CLI.ui.agree(message)
|
47
|
+
end
|
48
|
+
|
49
|
+
# Generate a configuration file for parsing through ERB
|
50
|
+
# Fetches file and uploads it to remote_file
|
51
|
+
# Make suer you user has the correct permissions
|
52
|
+
def generate_config(local_file, remote_file)
|
53
|
+
temp_file = '/tmp' + File.basename(local_file)
|
54
|
+
buffer = parse_config(local_file)
|
55
|
+
File.open(temp_file, 'w+') { |f| f << buffer }
|
56
|
+
upload temp_file, remote_file, :via => :scp
|
57
|
+
`rm #{temp_file}`
|
58
|
+
end
|
59
|
+
|
60
|
+
# Executes a basic rake task
|
61
|
+
def run_rake(task)
|
62
|
+
run "cd #{current_path} && rake #{task} RAILS_ENV=#{environment}"
|
63
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Capistrano::Configuration.instance.load do
|
2
|
+
namespace :apache do
|
3
|
+
[:stop, :start, :restart, :reload].each do |action|
|
4
|
+
desc "|OmekaRecipes| #{action.to_s.capitalize} Apache"
|
5
|
+
task action, :roles => :web do
|
6
|
+
run "#{sudo} service #{web_server} #{action}", :via => run_method
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
Capistrano::Configuration.instance.load do
|
2
|
+
#User settings
|
3
|
+
set :user, 'deploy' unless exists?(:user)
|
4
|
+
set :group, 'www-data' unless exists?(:group)
|
5
|
+
|
6
|
+
# Server settings
|
7
|
+
set :web_server, 'apache2' unless exists?(:web_server)
|
8
|
+
set :application_port, 80 unless exists?(:application_port)
|
9
|
+
set :runner, user
|
10
|
+
set :run_method, :run
|
11
|
+
|
12
|
+
# SCM Settings
|
13
|
+
set :scm, :git
|
14
|
+
set :branch, 'master' unless exists?(:branch)
|
15
|
+
set :deploy_to, "/usr/local/projects/#{application}" unless exists?(:deploy_to)
|
16
|
+
set :deploy_via, :remote_cache
|
17
|
+
set :keep_releases, 3
|
18
|
+
set :git_enable_submodules, true
|
19
|
+
set :use_sudo, false unless exists?(:use_sudo)
|
20
|
+
|
21
|
+
# Git settings for capistrano
|
22
|
+
default_run_options[:pty] = true
|
23
|
+
ssh_options[:forward_agent] = true
|
24
|
+
|
25
|
+
# RVM settings
|
26
|
+
set :use_rvm, false unless exists?(:use_rvm)
|
27
|
+
|
28
|
+
if use_rvm
|
29
|
+
#$:.unshift(File.expand_path('./lib', ENV['rvm_path'])) # add rvm lib to load path
|
30
|
+
require 'rvm/capistrano' #load rvm capistrano plugin
|
31
|
+
|
32
|
+
set :rvm_ruby_string, '1.9.3' unless exists?(:rvm_ruby_string)
|
33
|
+
end
|
34
|
+
|
35
|
+
set :shared_dirs, %w(archives) unless exists?(:shared_dirs)
|
36
|
+
|
37
|
+
namespace :app do
|
38
|
+
task :setup, :roles => :app do
|
39
|
+
commands = shared_dirs.map do |path|
|
40
|
+
"if [ ! -d '#{path}' ]; then mkdir -p #{path}; fi;"
|
41
|
+
end
|
42
|
+
|
43
|
+
run "cd #{shared_path}; #{commands.join(' ')}"
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
require 'erb'
|
2
|
+
|
3
|
+
Capistrano::Configuration.instance.load do
|
4
|
+
namespace :db do
|
5
|
+
namespace :mysql do
|
6
|
+
|
7
|
+
desc "|OmekaRecipes| Performs a compressed database dump. \n
|
8
|
+
WARNING: This locks your database tables for the duraction of the mysqldump."
|
9
|
+
task :dump, :roles => :db, :only => { :primary => true } do
|
10
|
+
prepare_from_ini
|
11
|
+
run "mysqldump --user=#{username} --host=#{host} -p #{name} | bzip2 -z9 > #{db_remote_file}" do |channel, stream, out|
|
12
|
+
channel.send_data "#{password}\n" if out =~ /^Enter password:/
|
13
|
+
puts out
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "|OmekaRecipes| Restores the database from the latest compressed dump"
|
18
|
+
task :restore, :roles => :db, :only => { :primary => true } do
|
19
|
+
prepare_from_ini
|
20
|
+
run "bzcat #{db_remote_file} | mysql --user=#{username} -p --host=#{host} #{name}" do |channel, stream, out|
|
21
|
+
channel.send_data "#{password}" if out =~ /^Enter password:/
|
22
|
+
puts out
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
desc "|OmekaRecipes| Downloads the compressed database dump to this machine"
|
27
|
+
task :fetch_dump, :roles => :db, :only => { :primary => true } do
|
28
|
+
prepare_from_ini
|
29
|
+
download db_remote_file, db_local_file, :via => :scp
|
30
|
+
end
|
31
|
+
|
32
|
+
desc "|OmekaRecipes| Create MySQL database and user for this environment using promted values"
|
33
|
+
task :setup, :roles => :db, :only => { :primary => true } do
|
34
|
+
prepare_for_db_command
|
35
|
+
|
36
|
+
sql = <<-SQL
|
37
|
+
CREATE DATABASE #{database}
|
38
|
+
GRANT ALL PRIVELEGES ON #{database}.*
|
39
|
+
TO #{username}@localhost
|
40
|
+
INDENTIFIED BY '#{password}'
|
41
|
+
SQL
|
42
|
+
|
43
|
+
run "mysql --user=#{username} -p --execute=\"#{sql}\"" do |channel, stream, data|
|
44
|
+
if data =~ /^Enter password:/
|
45
|
+
pass = Capistrano::CLI.password_prompt "Enter database password for '#{db_admin_user}':"
|
46
|
+
channel.send_data "#{pass}\n"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
desc "|OmekaRecipes| Create db.ini in shared path with settings for current stage and test env"
|
53
|
+
task :create_ini do
|
54
|
+
set(:host) { Capistrano::CLI.ui.ask "Enter #{environment} database host:" }
|
55
|
+
set(:username) { Capistrano::CLI.ui.ask "Enter #{environment} database username:" }
|
56
|
+
set(:password) { Capistrano::CLI.password_prompt "Enter #{environment} database password:" }
|
57
|
+
|
58
|
+
db_config = ERB.new <<-EOF
|
59
|
+
[database]
|
60
|
+
host = "#{host}"
|
61
|
+
username = "#{username}"
|
62
|
+
password = "#{password}"
|
63
|
+
name = "#{application}_#{environment}"
|
64
|
+
prefix = "omeka_"
|
65
|
+
EOF
|
66
|
+
|
67
|
+
put db_config.result, "#{shared_path}/db.ini"
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# Sets database variables
|
72
|
+
def prepare_from_ini
|
73
|
+
|
74
|
+
set(:db_file) { "#{application}-dump.sql.bz2" }
|
75
|
+
set(:db_remote_file) { "#{shared_path}/backup/#{db_file}" }
|
76
|
+
set(:db_local_file) { "/tmp/#{db_file}" }
|
77
|
+
set(:username) { db_config['database']['username'] }
|
78
|
+
set(:password) { db_config['database']["password"] }
|
79
|
+
set(:host) { db_config['database']["host"] }
|
80
|
+
set(:database) { db_config['database']["name"] }
|
81
|
+
set(:prefix) { db_config['database']["prefix"] }
|
82
|
+
end
|
83
|
+
|
84
|
+
def db_config
|
85
|
+
@db_config ||= fetch_db_ini
|
86
|
+
end
|
87
|
+
|
88
|
+
def fetch_db_ini
|
89
|
+
require 'IniFile'
|
90
|
+
|
91
|
+
file = capture "cat #{shared_path}/db.ini"
|
92
|
+
|
93
|
+
db_config = IniFile.new(file).to_h
|
94
|
+
|
95
|
+
end
|
96
|
+
|
97
|
+
def prepare_for_db_command
|
98
|
+
set :database, "#{application}_#{environment}"
|
99
|
+
set(:db_admin_user) { Capistrano::CLI.ui.ask "Username with priviledged database access (to create database):" }
|
100
|
+
set(:username) { Capistrano::CLI.ui.ask "Enter #{environment} database username:" }
|
101
|
+
set(:password) { Capistrano::CLI.password_prompt "Enter #{environment} database password:" }
|
102
|
+
end
|
103
|
+
|
104
|
+
after "deploy:setup" do
|
105
|
+
db.create_ini if Capistrano::CLI.ui.agree("Create db.ini in application's shared path? [Yn]")
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
Capistrano::Configuration.instance.load do
|
2
|
+
namespace :log do
|
3
|
+
|
4
|
+
desc "|OmekaRecipes| Tail all log files"
|
5
|
+
task :tail, :roles => :app do
|
6
|
+
run "tail -f #{shared_path}/log/*.log" do |channel, stream, data|
|
7
|
+
puts "#{channel[:host]} #{data}"
|
8
|
+
break if stream == :err
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
desc "|OmekaRecipes| Install log rotation script; optional args:
|
13
|
+
|
14
|
+
days=7, size=5M, group (defaults to same as user)"
|
15
|
+
task :rotate, :roles => :app do
|
16
|
+
rotate_script = %Q{#{shared_path}/log/#{environment}.log {
|
17
|
+
daily
|
18
|
+
rotate #{ENV['days'] || 7}
|
19
|
+
size #{ENV['size'] || "5M"}
|
20
|
+
compress
|
21
|
+
create 640 #{user} #{ENV['group'] || user}
|
22
|
+
missingok
|
23
|
+
}}
|
24
|
+
put rotate_script, "#{shared_path}/logrotate_script"
|
25
|
+
"#{sudo} cp #{shared_path}/logrotate_script /etc/logrotate.d/#{application}"
|
26
|
+
run "rm #{shared_path}/logrotate_script"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
Capistrano::Configuration.instance.load do
|
2
|
+
|
3
|
+
set :omeka_branch, "master" unless exists?(:omeka_branch)
|
4
|
+
|
5
|
+
def git_clone(hash, directory)
|
6
|
+
hash.each do |name, location|
|
7
|
+
run "cd #{current_path}/#{directory} && rm -rf #{name}"
|
8
|
+
run "cd #{current_path}/#{directory} && git clone #{location} --quiet"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
namespace :omeka do
|
13
|
+
desc 'Ensure the archive directory has write permissions'
|
14
|
+
task :fix_archive_permissions do
|
15
|
+
# This _should_ actually change the permissions of the archive directory to
|
16
|
+
# be the owner of process running httpd/apache2 daemon.
|
17
|
+
run "chmod -R 777 #{current_path}/archive"
|
18
|
+
end
|
19
|
+
|
20
|
+
desc 'Rename files'
|
21
|
+
# Omeka stages these files in its repo
|
22
|
+
task :rename_files do
|
23
|
+
run "cd #{current_path} && mv .htaccess.changeme .htaccess"
|
24
|
+
run "cd #{current_path}/application/config && mv config.ini.changeme config.ini"
|
25
|
+
end
|
26
|
+
|
27
|
+
desc 'Move the archive directory out of the way'
|
28
|
+
task :move_archive_dir do
|
29
|
+
run "mv #{current_path}/archive #{current_path}/archive_deleteme"
|
30
|
+
end
|
31
|
+
|
32
|
+
desc 'Link the archive directoy for the project'
|
33
|
+
task :link_archive_dir, :except => {:no_release => true} do
|
34
|
+
run "cd #{current_path} && ln -snf #{shared_path}/archive"
|
35
|
+
end
|
36
|
+
|
37
|
+
desc 'Add the db.ini to the shared directory'
|
38
|
+
task :db_ini do
|
39
|
+
run "touch #{shared_path}/db.ini"
|
40
|
+
end
|
41
|
+
|
42
|
+
desc 'Deploy the plugins defined in the plugins hash'
|
43
|
+
task :get_plugins do
|
44
|
+
git_clone(plugins, 'plugins')
|
45
|
+
end
|
46
|
+
|
47
|
+
desc 'Deploy the themes defined in the themes hash'
|
48
|
+
task :get_themes do
|
49
|
+
git_clone(themes, 'themes')
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
after 'deploy:cold', 'omeka:fix_archive_permissions', 'omeka:move_archive_dir'
|
55
|
+
#before 'deploy:create_symlink', 'omeka:move_archive_dir'
|
56
|
+
after 'deploy:create_symlink', 'omeka:link_archive_dir'
|
57
|
+
after 'deploy', 'omeka:get_themes', 'omeka:get_plugins', 'omeka:rename_files'
|
58
|
+
|
59
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
Capistrano::Configuration.instance.load do
|
2
|
+
# these are set to the same structure in shared <=> current
|
3
|
+
set :normal_symlinks, %w(application/logs/ archive) unless exists?(:normal_symlinks)
|
4
|
+
|
5
|
+
# weird symlinks go somewhere else
|
6
|
+
set :weird_symlinks, {'db.ini' => 'db.ini.changeme'} unless exists?( :weird_symlinks )
|
7
|
+
|
8
|
+
namespace :symlinks do
|
9
|
+
|
10
|
+
desc "|OmekaRecipes| Make all the symlinks in a single run"
|
11
|
+
task :make, :roles => :app, :except => { :no_release => true } do
|
12
|
+
commands = normal_symlinks.map do |path|
|
13
|
+
"rm -rf #{current_path}/#{path} && \
|
14
|
+
ln -s #{shared_path}/#{path} #{current_path}/#{path}"
|
15
|
+
end
|
16
|
+
|
17
|
+
commands += weird_symlinks.map do |from, to|
|
18
|
+
"rm -rf #{current_path}/#{to} && \
|
19
|
+
ln -s #{shared_path}/#{from} #{current_path}/#{to}"
|
20
|
+
end
|
21
|
+
|
22
|
+
run <<-CMD
|
23
|
+
cd #{current_path} && #{commands.join(" && ")}
|
24
|
+
CMD
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
after 'deploy:create_symlink', 'symlinks:make'
|
29
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/omeka-recipes/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Wayne Graham"]
|
6
|
+
gem.email = ["wayne.graham@virginia.edu"]
|
7
|
+
gem.description = %q{Capistrano recipes for Omeka}
|
8
|
+
gem.summary = %q{Capistrano recipes for deploying Omeka}
|
9
|
+
gem.homepage = "https://github.com/waynegraham/omeka-recipes"
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "omeka-recipes"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = Omeka::Recipes::VERSION
|
17
|
+
|
18
|
+
gem.extra_rdoc_files = %w(LICENSE README.md)
|
19
|
+
|
20
|
+
gem.add_dependency "capistrano", ">= 2.5.9"
|
21
|
+
gem.add_dependency "capistrano-ext", ">= 1.2.1"
|
22
|
+
gem.add_dependency "capistrano-multistage", "~> 0.0.4"
|
23
|
+
gem.add_dependency "capistrano-php", "~> 1.0.0"
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omeka-recipes
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Wayne Graham
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-09-17 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.5.9
|
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.5.9
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: capistrano-ext
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 1.2.1
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.2.1
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: capistrano-multistage
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 0.0.4
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.0.4
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: capistrano-php
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 1.0.0
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.0.0
|
78
|
+
description: Capistrano recipes for Omeka
|
79
|
+
email:
|
80
|
+
- wayne.graham@virginia.edu
|
81
|
+
executables: []
|
82
|
+
extensions: []
|
83
|
+
extra_rdoc_files:
|
84
|
+
- LICENSE
|
85
|
+
- README.md
|
86
|
+
files:
|
87
|
+
- .gitignore
|
88
|
+
- .rvmrc
|
89
|
+
- Gemfile
|
90
|
+
- LICENSE
|
91
|
+
- README.md
|
92
|
+
- Rakefile
|
93
|
+
- lib/helpers.rb
|
94
|
+
- lib/omeka-recipes.rb
|
95
|
+
- lib/omeka-recipes/apache.rb
|
96
|
+
- lib/omeka-recipes/application.rb
|
97
|
+
- lib/omeka-recipes/db.rb
|
98
|
+
- lib/omeka-recipes/log.rb
|
99
|
+
- lib/omeka-recipes/omeka.rb
|
100
|
+
- lib/omeka-recipes/symlinks.rb
|
101
|
+
- lib/omeka-recipes/version.rb
|
102
|
+
- omeka-recipes.gemspec
|
103
|
+
homepage: https://github.com/waynegraham/omeka-recipes
|
104
|
+
licenses: []
|
105
|
+
post_install_message:
|
106
|
+
rdoc_options: []
|
107
|
+
require_paths:
|
108
|
+
- lib
|
109
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
110
|
+
none: false
|
111
|
+
requirements:
|
112
|
+
- - ! '>='
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
115
|
+
segments:
|
116
|
+
- 0
|
117
|
+
hash: -810689480567202438
|
118
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
|
+
none: false
|
120
|
+
requirements:
|
121
|
+
- - ! '>='
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
segments:
|
125
|
+
- 0
|
126
|
+
hash: -810689480567202438
|
127
|
+
requirements: []
|
128
|
+
rubyforge_project:
|
129
|
+
rubygems_version: 1.8.24
|
130
|
+
signing_key:
|
131
|
+
specification_version: 3
|
132
|
+
summary: Capistrano recipes for deploying Omeka
|
133
|
+
test_files: []
|