capistrano-rails-dbinit 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in capistrano-rails-dbinit.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Takeshi KOMIYA
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,48 @@
1
+ # Capistrano::Rails::Dbinit
2
+
3
+ Capistrano tasks to initialize database for Rails Apps
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'capistrano-rails-dbinit'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install capistrano-rails-dbinit
18
+
19
+ ## Usage
20
+
21
+ load capistrano-rails-dbinit in your config/deploy.rb:
22
+
23
+ require 'capistrano-rails-dbinit'
24
+
25
+ And then, run capistrano-task *deploy:db:init*
26
+
27
+ $ cap deploy:db:init
28
+
29
+ capistrano-rails-dbinit will initialize your database specified from :rails_env.
30
+ The task calls these tasks on execution:
31
+
32
+ - deploy:update_code
33
+ - deploy:create_symlink
34
+ - db:symlink (capistrano_database_yml)
35
+ - deploy:db:drop
36
+ - deploy:db:create
37
+ - deploy:migrate
38
+ - deploy:db:seed
39
+
40
+ NOTICE: capistrano-rails-dbinit ignores all callbacks (after/before hooks)
41
+
42
+ ## Contributing
43
+
44
+ 1. Fork it
45
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
46
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
47
+ 4. Push to the branch (`git push origin my-new-feature`)
48
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'capistrano-rails-dbinit/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "capistrano-rails-dbinit"
8
+ gem.version = Capistrano::Rails::Dbinit::VERSION
9
+ gem.authors = ["Takeshi KOMIYA"]
10
+ gem.email = ["i.tkomiya@gmail.com"]
11
+ gem.description = "Capistrano tasks to initialize database for Rails Apps"
12
+ gem.summary = "Capistrano tasks to initialize database for Rails Apps"
13
+ gem.homepage = "https://github.com/tk0miya/capistrano-rails-dbinit"
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+
20
+ gem.add_dependency "capistrano"
21
+ gem.add_dependency "capistrano_database_yml"
22
+ end
@@ -0,0 +1,48 @@
1
+ require "capistrano-rails-dbinit/version"
2
+
3
+ Capistrano::Configuration.instance.load do
4
+ namespace :deploy do
5
+ namespace :db do
6
+ def run_rake(task)
7
+ run "cd #{current_path} && bundle exec rake #{task} RAILS_ENV=#{rails_env}"
8
+ end
9
+
10
+ desc "Create Database"
11
+ task :create, {:roles => :db, :only => {:primary => true}} do
12
+ run_rake("db:create")
13
+ end
14
+
15
+ desc "Create Database"
16
+ task :drop, {:roles => :db, :only => {:primary => true}} do
17
+ run_rake("db:drop")
18
+ end
19
+
20
+ desc "Load seed data"
21
+ task :seed, {:roles => :db, :only => {:primary => true}} do
22
+ run_rake("db:seed")
23
+ end
24
+
25
+ task :init, {:roles => :db, :only => {:primary => true}} do
26
+ tasks = %w(deploy:update_code
27
+ deploy:create_symlink
28
+ db:symlink
29
+ deploy:db:drop
30
+ deploy:db:create
31
+ deploy:migrate
32
+ deploy:db:seed)
33
+
34
+
35
+ agree = Capistrano::CLI.ui.agree("deploy:db:init will DROP your database. Are you sure? (Yes, No)") do |q|
36
+ q.default = 'No'
37
+ end
38
+
39
+ transaction do
40
+ tasks.each do |name|
41
+ task = top.find_task(name)
42
+ invoke_task_directly_without_callbacks(task)
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,7 @@
1
+ module Capistrano
2
+ module Rails
3
+ module Dbinit
4
+ VERSION = "0.0.1"
5
+ end
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,86 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-rails-dbinit
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Takeshi KOMIYA
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-02-15 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: '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: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: capistrano_database_yml
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
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: '0'
46
+ description: Capistrano tasks to initialize database for Rails Apps
47
+ email:
48
+ - i.tkomiya@gmail.com
49
+ executables: []
50
+ extensions: []
51
+ extra_rdoc_files: []
52
+ files:
53
+ - .gitignore
54
+ - Gemfile
55
+ - LICENSE.txt
56
+ - README.md
57
+ - Rakefile
58
+ - capistrano-rails-dbinit.gemspec
59
+ - lib/capistrano-rails-dbinit.rb
60
+ - lib/capistrano-rails-dbinit/version.rb
61
+ homepage: https://github.com/tk0miya/capistrano-rails-dbinit
62
+ licenses: []
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ! '>='
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ requirements: []
80
+ rubyforge_project:
81
+ rubygems_version: 1.8.24
82
+ signing_key:
83
+ specification_version: 3
84
+ summary: Capistrano tasks to initialize database for Rails Apps
85
+ test_files: []
86
+ has_rdoc: