standalone_migrations 0.4.7 → 0.4.8
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/README.markdown +3 -1
- data/VERSION +1 -1
- data/lib/tasks/standalone_migrations.rb +6 -1
- data/spec/standalone_migrations_spec.rb +6 -0
- data/standalone_migrations.gemspec +2 -2
- metadata +3 -3
data/README.markdown
CHANGED
@@ -3,9 +3,11 @@ Rails migrations in non-Rails (and non Ruby) projects.
|
|
3
3
|
USAGE
|
4
4
|
=====
|
5
5
|
Install Ruby, RubyGems and a ruby-database driver (e.g. `gem install mysql`) then:
|
6
|
+
|
6
7
|
sudo gem install standalone_migrations
|
7
8
|
|
8
9
|
Add to `Rakefile` in your projects base directory:
|
10
|
+
|
9
11
|
begin
|
10
12
|
require 'tasks/standalone_migrations'
|
11
13
|
MigratorTasks.new do |t|
|
@@ -14,7 +16,6 @@ Add to `Rakefile` in your projects base directory:
|
|
14
16
|
# t.schema = "db/schema.rb"
|
15
17
|
# t.sub_namespace = "dbname"
|
16
18
|
# t.env = "DB"
|
17
|
-
# t.default_env = "development"
|
18
19
|
# t.verbose = true
|
19
20
|
# t.log_level = Logger::ERROR
|
20
21
|
end
|
@@ -23,6 +24,7 @@ Add to `Rakefile` in your projects base directory:
|
|
23
24
|
end
|
24
25
|
|
25
26
|
Add database configuration to `db/config.yml` in your projects base directory e.g.:
|
27
|
+
|
26
28
|
development:
|
27
29
|
adapter: sqlite3
|
28
30
|
database: db/development.sqlite3
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.8
|
@@ -72,7 +72,11 @@ class MigratorTasks < ::Rake::TaskLib
|
|
72
72
|
|
73
73
|
desc "Migrate the database using the scripts in the migrations directory. Target specific version with VERSION=x. Turn off output with VERBOSE=false."
|
74
74
|
task :migrate => :ar_init do
|
75
|
-
|
75
|
+
begin
|
76
|
+
require 'migration_helpers'
|
77
|
+
rescue LoadError
|
78
|
+
require "#{@vendor}/migration_helpers/init"
|
79
|
+
end
|
76
80
|
ActiveRecord::Migration.verbose = ENV['VERBOSE'] || @verbose
|
77
81
|
@migrations.each do |path|
|
78
82
|
ActiveRecord::Migrator.migrate(path, ENV["VERSION"] ? ENV["VERSION"].to_i : nil)
|
@@ -156,6 +160,7 @@ class MigratorTasks < ::Rake::TaskLib
|
|
156
160
|
task :create do
|
157
161
|
ar_init(false)
|
158
162
|
config = ActiveRecord::Base.configurations[self.current_env]
|
163
|
+
raise ArgumentError, "#{self.current_env} database is not configured" unless config
|
159
164
|
create_database config
|
160
165
|
end
|
161
166
|
|
@@ -105,6 +105,12 @@ end
|
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
108
|
+
describe 'db:create when nonexistent environment is specified' do
|
109
|
+
it "should provide an informative error message" do
|
110
|
+
run_with_output("rake db:create DB=nonexistent").should match /nonexistent database is not configured/
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
108
114
|
describe 'db:new_migration' do
|
109
115
|
context "single migration path" do
|
110
116
|
it "fails if i do not add a name" do
|
@@ -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.8"
|
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-05-31}
|
13
13
|
s.email = %q{thuss@gabrito.com}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"README.markdown"
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 4
|
8
|
-
-
|
9
|
-
version: 0.4.
|
8
|
+
- 8
|
9
|
+
version: 0.4.8
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Todd Huss
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-05-31 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|