-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
224 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
lib/**/*.rb | ||
bin/* | ||
- | ||
features/**/*.feature | ||
LICENSE.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# rcov generated | ||
coverage | ||
|
||
# rdoc generated | ||
rdoc | ||
|
||
# yard generated | ||
doc | ||
.yardoc | ||
|
||
# bundler | ||
.bundle | ||
|
||
# jeweler generated | ||
pkg | ||
|
||
# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore: | ||
# | ||
# * Create a file at ~/.gitignore | ||
# * Include files you want ignored | ||
# * Run: git config --global core.excludesfile ~/.gitignore | ||
# | ||
# After doing this, these files will be ignored in all your git projects, | ||
# saving you from having to 'pollute' every project you touch with them | ||
# | ||
# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line) | ||
# | ||
# For MacOS: | ||
# | ||
#.DS_Store | ||
# | ||
# For TextMate | ||
#*.tmproj | ||
#tmtags | ||
# | ||
# For emacs: | ||
#*~ | ||
#\#* | ||
#.\#* | ||
# | ||
# For vim: | ||
#*.swp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
source "http://rubygems.org" | ||
|
||
gem "bundler", "~> 1.0.0" | ||
gem "jeweler", "~> 1.5.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
GEM | ||
remote: http://rubygems.org/ | ||
specs: | ||
git (1.2.5) | ||
jeweler (1.5.1) | ||
bundler (~> 1.0.0) | ||
git (>= 1.2.5) | ||
rake | ||
rake (0.8.7) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
bundler (~> 1.0.0) | ||
jeweler (~> 1.5.1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Copyright (c) 2010 Michael Franz Aigner | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
= capistrano_database_yml | ||
|
||
Description goes here. | ||
|
||
== Contributing to capistrano_database_yml | ||
|
||
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet | ||
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it | ||
* Fork the project | ||
* Start a feature/bugfix branch | ||
* Commit and push until you are happy with your contribution | ||
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally. | ||
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it. | ||
|
||
== Copyright | ||
|
||
Copyright (c) 2010 Michael Franz Aigner. See LICENSE.txt for | ||
further details. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
require 'rubygems' | ||
require 'bundler' | ||
begin | ||
Bundler.setup(:default, :development) | ||
rescue Bundler::BundlerError => e | ||
$stderr.puts e.message | ||
$stderr.puts "Run `bundle install` to install missing gems" | ||
exit e.status_code | ||
end | ||
require 'rake' | ||
|
||
require 'jeweler' | ||
Jeweler::Tasks.new do |gem| | ||
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options | ||
gem.name = "capistrano_database_yml" | ||
gem.homepage = "http://github.com/amfranz/capistrano_database_yml" | ||
gem.license = "MIT" | ||
gem.summary = %Q{TODO: one-line summary of your gem} | ||
gem.description = %Q{TODO: longer description of your gem} | ||
gem.email = "amfranz@gmail.com" | ||
gem.authors = ["Michael Franz Aigner"] | ||
# Include your dependencies below. Runtime dependencies are required when using your gem, | ||
# and development dependencies are only needed for development (ie running rake tasks, tests, etc) | ||
# gem.add_runtime_dependency 'jabber4r', '> 0.1' | ||
# gem.add_development_dependency 'rspec', '> 1.2.3' | ||
end | ||
Jeweler::RubygemsDotOrgTasks.new | ||
|
||
task :default => :test | ||
|
||
require 'rake/rdoctask' | ||
Rake::RDocTask.new do |rdoc| | ||
version = File.exist?('VERSION') ? File.read('VERSION') : "" | ||
|
||
rdoc.rdoc_dir = 'rdoc' | ||
rdoc.title = "capistrano_database_yml #{version}" | ||
rdoc.rdoc_files.include('README*') | ||
rdoc.rdoc_files.include('lib/**/*.rb') | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# | ||
# = Capistrano database.yml task | ||
# | ||
# Provides a couple of tasks for creating the database.yml | ||
# configuration file dynamically when deploy:setup is run. | ||
# | ||
# Category:: Capistrano | ||
# Package:: Database | ||
# Author:: Simone Carletti | ||
# Copyright:: 2007-2009 The Authors | ||
# License:: MIT License | ||
# Link:: http://www.simonecarletti.com/ | ||
# Source:: http://gist.github.com/2769 | ||
# | ||
# | ||
|
||
unless Capistrano::Configuration.respond_to?(:instance) | ||
abort "This extension requires Capistrano 2" | ||
end | ||
|
||
Capistrano::Configuration.instance.load do | ||
|
||
namespace :db do | ||
|
||
desc <<-DESC | ||
Creates the database.yml configuration file in shared path. | ||
By default, this task uses a template unless a template \ | ||
called database.yml.erb is found either is :template_dir \ | ||
or /config/deploy folders. The default template matches \ | ||
the template for config/database.yml file shipped with Rails. | ||
When this recipe is loaded, db:setup is automatically configured \ | ||
to be invoked after deploy:setup. You can skip this task setting \ | ||
the variable :skip_db_setup to true. This is especially useful \ | ||
if you are using this recipe in combination with \ | ||
capistrano-ext/multistaging to avoid multiple db:setup calls \ | ||
when running deploy:setup for all stages one by one. | ||
DESC | ||
task :setup, :except => { :no_release => true } do | ||
|
||
default_template = <<-EOF | ||
base: &base | ||
adapter: sqlite3 | ||
timeout: 5000 | ||
development: | ||
database: #{shared_path}/db/development.sqlite3 | ||
<<: *base | ||
test: | ||
database: #{shared_path}/db/test.sqlite3 | ||
<<: *base | ||
production: | ||
database: #{shared_path}/db/production.sqlite3 | ||
<<: *base | ||
EOF | ||
|
||
location = fetch(:template_dir, "config/deploy") + '/database.yml.erb' | ||
template = File.file?(location) ? File.read(location) : default_template | ||
|
||
config = ERB.new(template) | ||
|
||
run "mkdir -p #{shared_path}/db" | ||
run "mkdir -p #{shared_path}/config" | ||
put config.result(binding), "#{shared_path}/config/database.yml" | ||
end | ||
|
||
desc <<-DESC | ||
[internal] Updates the symlink for database.yml file to the just deployed release. | ||
DESC | ||
task :symlink, :except => { :no_release => true } do | ||
run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml" | ||
end | ||
|
||
end | ||
|
||
after "deploy:setup", "db:setup" unless fetch(:skip_db_setup, false) | ||
after "deploy:finalize_update", "db:symlink" | ||
end |