secondbase 0.4.1 → 0.4.2

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/Rakefile CHANGED
@@ -16,7 +16,7 @@ Jeweler::Tasks.new do |gem|
16
16
  gem.homepage = "http://github.com/karledurante/secondbase"
17
17
  gem.license = "MIT"
18
18
  gem.summary = %Q{Allow Rails manage second database in your projects}
19
- gem.description = %Q{Secondbase provides support to Rails to create a homogeneous for a dual database project. Using the rake tasks already familiar to you, this gem enables Rails to work with two primary databases, instead of just one.}
19
+ gem.description = %Q{Secondbase provides support to Rails to create a homogeneous environment for a dual database project. Using the rake tasks already familiar to you, this gem enables Rails to work with two primary databases, instead of just one.}
20
20
  gem.email = "kdurante@customink.com"
21
21
  gem.authors = ["karledurante"]
22
22
  gem.add_development_dependency 'activerecord', '~> 3.0.0'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.4.2
@@ -39,6 +39,13 @@ namespace :db do
39
39
  Rake::Task["db:migrate:original"].invoke
40
40
  end
41
41
 
42
+ override_task :abort_if_pending_migrations do
43
+ # Execute the original/default prepare task
44
+ Rake::Task["db:abort_if_pending_migrations"].invoke
45
+
46
+ Rake::Task["db:abort_if_pending_migrations:secondbase"].invoke
47
+ end
48
+
42
49
  namespace :test do
43
50
  override_task :prepare do
44
51
  Rake::Task['environment'].invoke
@@ -53,6 +60,29 @@ namespace :db do
53
60
 
54
61
  ##################################
55
62
  # SecondBase specific database tasks
63
+ namespace :abort_if_pending_migrations do
64
+ desc "determines if your secondbase has pending migrations"
65
+ task :secondbase => :environment do
66
+ # reset connection to secondbase...
67
+ SecondBase::has_runner(Rails.env)
68
+
69
+ pending_migrations = ActiveRecord::Migrator.new(:up, "db/migrate/#{SecondBase::CONNECTION_PREFIX}").pending_migrations
70
+
71
+ if pending_migrations.any?
72
+ puts "You have #{pending_migrations.size} pending migrations:"
73
+ pending_migrations.each do |pending_migration|
74
+ puts ' %4d %s' % [pending_migration.version, pending_migration.name]
75
+ end
76
+ abort %{Run "rake db:migrate" to update your database then try again.}
77
+ else
78
+ puts "\n\n No pending migrations! \n\n"
79
+ end
80
+
81
+ # reset connection back to firstbase...
82
+ FirstBase::has_runner(Rails.env)
83
+ end
84
+ end
85
+
56
86
  namespace :migrate do
57
87
  desc "migrates the second database"
58
88
  task :secondbase => :load_config do
@@ -141,7 +171,7 @@ namespace :db do
141
171
  namespace :test do
142
172
  namespace :prepare do
143
173
  desc 'Prepares the test instance of secondbase'
144
- task :secondbase do
174
+ task :secondbase => 'db:abort_if_pending_migrations:secondbase' do
145
175
  Rake::Task["db:test:clone_structure:secondbase"].invoke
146
176
  end
147
177
  end
data/secondbase.gemspec CHANGED
@@ -5,12 +5,12 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{secondbase}
8
- s.version = "0.4.1"
8
+ s.version = "0.4.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["karledurante"]
12
- s.date = %q{2011-03-08}
13
- s.description = %q{Secondbase provides support to Rails to create a homogeneous for a dual database project. Using the rake tasks already familiar to you, this gem enables Rails to work with two primary databases, instead of just one.}
12
+ s.date = %q{2011-05-18}
13
+ s.description = %q{Secondbase provides support to Rails to create a homogeneous environment for a dual database project. Using the rake tasks already familiar to you, this gem enables Rails to work with two primary databases, instead of just one.}
14
14
  s.email = %q{kdurante@customink.com}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE.txt",
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: secondbase
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 1
10
- version: 0.4.1
9
+ - 2
10
+ version: 0.4.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - karledurante
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-08 00:00:00 -05:00
18
+ date: 2011-05-18 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -96,7 +96,7 @@ dependencies:
96
96
  requirement: *id005
97
97
  prerelease: false
98
98
  name: activerecord
99
- description: Secondbase provides support to Rails to create a homogeneous for a dual database project. Using the rake tasks already familiar to you, this gem enables Rails to work with two primary databases, instead of just one.
99
+ description: Secondbase provides support to Rails to create a homogeneous environment for a dual database project. Using the rake tasks already familiar to you, this gem enables Rails to work with two primary databases, instead of just one.
100
100
  email: kdurante@customink.com
101
101
  executables: []
102
102