activerecord-migrations 1.0.0.pre.rc1 → 1.0.0.pre.rc2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 11e8e2bd885b2c4bd85d7ef4c73b7202e87a6388
4
- data.tar.gz: aad70b80eeb33529dcc54daa31e45b1b505d59bd
3
+ metadata.gz: d4e2379b874bf520a0e2cd2a5fbec506153fcd6f
4
+ data.tar.gz: eb5a1b839409043cdc1e63a9889106b3a0e6c3c6
5
5
  SHA512:
6
- metadata.gz: 4d273de003666d8aedf3317623b2adc14179d2485da351478b3f63ffb62dd55eb626d55f391ab43757c9f144e6dd72d159f59e1d9c879caaa3bdc76bce66675f
7
- data.tar.gz: 29d1a954a2789646406d258bbec22800d04a814449181e9b47bc404405294f6b7766c5cb97dbe98f49dcd27f6a131d6bf3e1ef862c3278ec285842c95b01ff34
6
+ metadata.gz: 66ef83bea0034a256195400078d2ee29ca1575fc94505dc98b769af5081939bf9ee087afcb0bb430d583cfcfb1354bc23ec78bafa180ae7bd3e21f10aa0cb303
7
+ data.tar.gz: 50a07fbf8f8cc651d3ac025b50f9248e10a0b309e6de189f361aee46d13d18bbbcd1ddaf96a84548ec8141bf164f38477ffd6153c8b33bf799149e2f45f58bf1
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # ActiveRecord::Migrations
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/activerecord/migrations`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ This gem provides opinionated support for ActiveRecord migrations in non-Rails applications. It's faster and better defined than the competing gems, but only supports ActiveRecord 5+.
6
4
 
7
5
  ## Installation
8
6
 
@@ -14,10 +12,29 @@ gem 'activerecord-migrations'
14
12
 
15
13
  ## Usage
16
14
 
17
- Add this to `tasks/db.rake`
15
+ Add something like this to `tasks/db.rake`
18
16
 
19
17
  ```ruby
20
- require 'activerecord/migrations'
18
+ task :environment do
19
+ # This must be a symbol... or establish_connection thinks it's a URL.
20
+ DATABASE_ENV = :development
21
+
22
+ ActiveRecord::Base.configurations = {
23
+ # This key must be a string or it will not be matched by ActiveRecord:
24
+ 'development' => {
25
+ 'adapter' => 'sqlite3',
26
+ # This key must be a string or rake tasks will fail (e.g. each_current_configuration fails):
27
+ 'database' => 'db/development.db'
28
+ }
29
+ }
30
+
31
+ # Connect to database:
32
+ unless ActiveRecord::Base.connected?
33
+ ActiveRecord::Base.establish_connection(DATABASE_ENV)
34
+ end
35
+ end
36
+
37
+ require 'active_record/migrations'
21
38
  ActiveRecord::Migrations.root = File.expand_path("../db", __dir__)
22
39
  ```
23
40
 
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'activerecord/migrations/version'
4
+ require 'active_record/migrations/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "activerecord-migrations"
@@ -0,0 +1,26 @@
1
+ # Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ require_relative "migrations/version"
22
+
23
+ module ActiveRecord
24
+ module Migrations
25
+ end
26
+ end
@@ -0,0 +1,36 @@
1
+ # Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ require_relative 'tasks/db'
22
+ require_relative 'tasks/db/migrations'
23
+
24
+ module ActiveRecord
25
+ module Migrations
26
+ class << self
27
+ attr_accessor :root
28
+ end
29
+
30
+ def self.database?
31
+ !ActiveRecord::Base.connection.data_sources.empty?
32
+ rescue ActiveRecord::NoDatabaseError
33
+ false
34
+ end
35
+ end
36
+ end
@@ -1,3 +1,22 @@
1
+ # Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
1
20
 
2
21
  namespace :db do
3
22
  task :load_config => :environment do
@@ -0,0 +1,41 @@
1
+ # Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ namespace :db do
22
+ namespace :migrations do
23
+ desc "Creates a new migration file with the specified name"
24
+ task :new, :name, :options do |t, args|
25
+ unless name = args[:name] || ENV['name']
26
+ abort "You must provide a name of the migration to generate"
27
+ end
28
+
29
+ if options = args[:options] || ENV['options']
30
+ options = options.split('/')
31
+ else
32
+ options = []
33
+ end
34
+
35
+ require "rails/generators"
36
+
37
+ parameters = [name] + options
38
+ Rails::Generators.invoke "active_record:migration", parameters, :destination_root => ActiveRecord::Migrations.root
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,25 @@
1
+ # Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ module ActiveRecord
22
+ module Migrations
23
+ VERSION = "1.0.0-rc2"
24
+ end
25
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-migrations
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre.rc1
4
+ version: 1.0.0.pre.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -94,11 +94,11 @@ files:
94
94
  - README.md
95
95
  - Rakefile
96
96
  - activerecord-migrations.gemspec
97
- - lib/activerecord/migrations.rb
98
- - lib/activerecord/migrations/tasks.rb
99
- - lib/activerecord/migrations/tasks/db.rb
100
- - lib/activerecord/migrations/tasks/db/migrations.rb
101
- - lib/activerecord/migrations/version.rb
97
+ - lib/active_record/migrations.rb
98
+ - lib/active_record/migrations/tasks.rb
99
+ - lib/active_record/migrations/tasks/db.rb
100
+ - lib/active_record/migrations/tasks/db/migrations.rb
101
+ - lib/active_record/migrations/version.rb
102
102
  homepage: https://github.com/ioquatix/activerecord-migrations
103
103
  licenses:
104
104
  - MIT
@@ -1,7 +0,0 @@
1
-
2
- require "activerecord/migrations/version"
3
-
4
- module ActiveRecord
5
- module Migrations
6
- end
7
- end
@@ -1,17 +0,0 @@
1
-
2
- require_relative 'tasks/db'
3
- require_relative 'tasks/db/migrations'
4
-
5
- module ActiveRecord
6
- module Migrations
7
- class << self
8
- attr_accessor :root
9
- end
10
-
11
- def self.database?
12
- !ActiveRecord::Base.connection.data_sources.empty?
13
- rescue ActiveRecord::NoDatabaseError
14
- false
15
- end
16
- end
17
- end
@@ -1,22 +0,0 @@
1
-
2
- namespace :db do
3
- namespace :migrations do
4
- desc "Creates a new migration file with the specified name"
5
- task :new, :name, :options do |t, args|
6
- unless name = args[:name] || ENV['name']
7
- abort "You must provide a name of the migration to generate"
8
- end
9
-
10
- if options = args[:options] || ENV['options']
11
- options = options.split('/')
12
- else
13
- options = []
14
- end
15
-
16
- require "rails/generators"
17
-
18
- parameters = [name] + options
19
- Rails::Generators.invoke "active_record:migration", parameters, :destination_root => ActiveRecord::Migrations.root
20
- end
21
- end
22
- end
@@ -1,5 +0,0 @@
1
- module ActiveRecord
2
- module Migrations
3
- VERSION = "1.0.0-rc1"
4
- end
5
- end