banana 0.1.0 → 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/Gemfile CHANGED
@@ -4,4 +4,5 @@ source 'https://rubygems.org'
4
4
 
5
5
  group :development, :test do
6
6
  gem 'rake'
7
+ gem 'gemcutter'
7
8
  end
data/README.md CHANGED
@@ -23,7 +23,7 @@ Or install it yourself as:
23
23
  3. add database name to migration
24
24
  4. as always run `rake db:create`, `rake db:migrate`, `rake db:drop`
25
25
 
26
- ## Exsamples
26
+ ## Examples
27
27
 
28
28
  ```yaml
29
29
  # config/database.yml
@@ -1,7 +1,7 @@
1
1
  tasks = Rake.application.instance_variable_get '@tasks'
2
- tasks.delete 'db:create'
3
- tasks.delete 'db:drop'
4
- tasks.delete 'db:schema:dump'
2
+ override_tasks = ['db:create', 'db:drop', 'db:migrate', 'db:schema:dump']
3
+ unsupported_tasks = ['db:schema:load']
4
+ (override_tasks + unsupported_tasks).each { |task_name| tasks.delete(task_name) }
5
5
 
6
6
  db_namespace = namespace :db do
7
7
  desc 'Create the multiple databases from config/database.yml for the current Rails.env (use db:create:all to create all dbs in the config)'
@@ -9,6 +9,17 @@ db_namespace = namespace :db do
9
9
  configs_for_multi_environment.each { |config| create_database(config) }
10
10
  end
11
11
 
12
+ desc "Migrate the database (options: VERSION=x, VERBOSE=false)."
13
+ task :migrate => [:environment, :load_config] do
14
+ ActiveRecord::Base.establish_connection(Rails.env)
15
+
16
+ ActiveRecord::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true
17
+ ActiveRecord::Migrator.migrate(ActiveRecord::Migrator.migrations_paths, ENV["VERSION"] ? ENV["VERSION"].to_i : nil) do |migration|
18
+ ENV["SCOPE"].blank? || (ENV["SCOPE"] == migration.scope)
19
+ end
20
+ db_namespace['_dump'].invoke
21
+ end
22
+
12
23
  desc 'Drops the multiple databases for the current Rails.env (use db:drop:all to drop all databases)'
13
24
  task :drop => :load_config do
14
25
  configs_for_multi_environment.each { |config| drop_database_and_rescue(config) }
@@ -1,3 +1,3 @@
1
1
  module Banana
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: banana
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -43,7 +43,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
43
43
  version: '0'
44
44
  segments:
45
45
  - 0
46
- hash: 457216682735190219
46
+ hash: 109049043091770607
47
47
  required_rubygems_version: !ruby/object:Gem::Requirement
48
48
  none: false
49
49
  requirements:
@@ -52,7 +52,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
52
52
  version: '0'
53
53
  segments:
54
54
  - 0
55
- hash: 457216682735190219
55
+ hash: 109049043091770607
56
56
  requirements: []
57
57
  rubyforge_project:
58
58
  rubygems_version: 1.8.24