standalone_migrations 0.4.4 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/tasks/standalone_migrations.rb +8 -6
- data/standalone_migrations.gemspec +3 -3
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.5
|
@@ -3,7 +3,9 @@ require 'rake/tasklib'
|
|
3
3
|
require 'logger'
|
4
4
|
|
5
5
|
class MigratorTasks < ::Rake::TaskLib
|
6
|
-
|
6
|
+
DefaultEnv = 'development'
|
7
|
+
|
8
|
+
attr_accessor :name, :base, :vendor, :config, :schema, :env, :current_env, :verbose, :log_level, :logger
|
7
9
|
attr_reader :migrations
|
8
10
|
|
9
11
|
def initialize(name = :migrator)
|
@@ -16,7 +18,6 @@ class MigratorTasks < ::Rake::TaskLib
|
|
16
18
|
@config = "#{base}/db/config.yml"
|
17
19
|
@schema = "#{base}/db/schema.rb"
|
18
20
|
@env = 'DB'
|
19
|
-
@default_env = 'development'
|
20
21
|
@verbose = true
|
21
22
|
@log_level = Logger::ERROR
|
22
23
|
yield self if block_given?
|
@@ -33,7 +34,7 @@ class MigratorTasks < ::Rake::TaskLib
|
|
33
34
|
namespace :db do
|
34
35
|
def ar_init(connect = true)
|
35
36
|
require 'active_record'
|
36
|
-
ENV[@env]
|
37
|
+
self.current_env = ENV[@env] || DefaultEnv
|
37
38
|
|
38
39
|
if @config.is_a?(Hash)
|
39
40
|
ActiveRecord::Base.configurations = @config
|
@@ -41,7 +42,7 @@ class MigratorTasks < ::Rake::TaskLib
|
|
41
42
|
require 'erb'
|
42
43
|
ActiveRecord::Base.configurations = YAML::load(ERB.new(IO.read(@config)).result)
|
43
44
|
end
|
44
|
-
ActiveRecord::Base.establish_connection(
|
45
|
+
ActiveRecord::Base.establish_connection(current_env) if connect
|
45
46
|
if @logger
|
46
47
|
logger = @logger
|
47
48
|
else
|
@@ -70,6 +71,7 @@ class MigratorTasks < ::Rake::TaskLib
|
|
70
71
|
puts "Current version: #{ActiveRecord::Migrator.current_version}"
|
71
72
|
end
|
72
73
|
|
74
|
+
|
73
75
|
def create_database(config)
|
74
76
|
begin
|
75
77
|
if config['adapter'] =~ /sqlite/
|
@@ -139,7 +141,7 @@ class MigratorTasks < ::Rake::TaskLib
|
|
139
141
|
desc 'Create the database from config/database.yml for the current DATABASE_ENV'
|
140
142
|
task :create do
|
141
143
|
ar_init(false)
|
142
|
-
config = ActiveRecord::Base.configurations[self.
|
144
|
+
config = ActiveRecord::Base.configurations[self.current_env]
|
143
145
|
create_database config
|
144
146
|
end
|
145
147
|
|
@@ -161,7 +163,7 @@ class MigratorTasks < ::Rake::TaskLib
|
|
161
163
|
|
162
164
|
desc 'Drops the database for the current DATABASE_ENV'
|
163
165
|
task :drop => :ar_init do
|
164
|
-
config = ActiveRecord::Base.configurations[
|
166
|
+
config = ActiveRecord::Base.configurations[current_env]
|
165
167
|
drop_database(config)
|
166
168
|
end
|
167
169
|
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{standalone_migrations}
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Todd Huss", "Michael Grosser"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-04-01}
|
13
13
|
s.email = %q{thuss@gabrito.com}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"README.markdown"
|
@@ -28,7 +28,7 @@ Gem::Specification.new do |s|
|
|
28
28
|
]
|
29
29
|
s.homepage = %q{http://github.com/thuss/standalone-migrations}
|
30
30
|
s.require_paths = ["lib"]
|
31
|
-
s.rubygems_version = %q{1.
|
31
|
+
s.rubygems_version = %q{1.6.2}
|
32
32
|
s.summary = %q{A thin wrapper to use Rails Migrations in non Rails projects}
|
33
33
|
s.test_files = [
|
34
34
|
"spec/standalone_migrations_spec.rb"
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: standalone_migrations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.4.
|
5
|
+
version: 0.4.5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Todd Huss
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2011-
|
14
|
+
date: 2011-04-01 00:00:00 -07:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements: []
|
80
80
|
|
81
81
|
rubyforge_project:
|
82
|
-
rubygems_version: 1.
|
82
|
+
rubygems_version: 1.6.2
|
83
83
|
signing_key:
|
84
84
|
specification_version: 3
|
85
85
|
summary: A thin wrapper to use Rails Migrations in non Rails projects
|