activerecord-migrations 1.0.0.pre.rc1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 11e8e2bd885b2c4bd85d7ef4c73b7202e87a6388
4
+ data.tar.gz: aad70b80eeb33529dcc54daa31e45b1b505d59bd
5
+ SHA512:
6
+ metadata.gz: 4d273de003666d8aedf3317623b2adc14179d2485da351478b3f63ffb62dd55eb626d55f391ab43757c9f144e6dd72d159f59e1d9c879caaa3bdc76bce66675f
7
+ data.tar.gz: 29d1a954a2789646406d258bbec22800d04a814449181e9b47bc404405294f6b7766c5cb97dbe98f49dcd27f6a131d6bf3e1ef862c3278ec285842c95b01ff34
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.2
5
+ before_install: gem install bundler -v 1.13.6
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in activerecord-migrations.gemspec
4
+ gemspec
5
+
6
+ group :development do
7
+ gem "sqlite3"
8
+ gem "mysql2"
9
+ end
data/README.md ADDED
@@ -0,0 +1,55 @@
1
+ # ActiveRecord::Migrations
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
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'activerecord-migrations'
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ Add this to `tasks/db.rake`
18
+
19
+ ```ruby
20
+ require 'activerecord/migrations'
21
+ ActiveRecord::Migrations.root = File.expand_path("../db", __dir__)
22
+ ```
23
+
24
+ ## Contributing
25
+
26
+ 1. Fork it
27
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
28
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
29
+ 4. Push to the branch (`git push origin my-new-feature`)
30
+ 5. Create new Pull Request
31
+
32
+ ## License
33
+
34
+ Released under the MIT license.
35
+
36
+ Copyright, 2016, by [Samuel G. D. Williams](http://www.codeotaku.com/samuel-williams).
37
+
38
+ Permission is hereby granted, free of charge, to any person obtaining a copy
39
+ of this software and associated documentation files (the "Software"), to deal
40
+ in the Software without restriction, including without limitation the rights
41
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
42
+ copies of the Software, and to permit persons to whom the Software is
43
+ furnished to do so, subject to the following conditions:
44
+
45
+ The above copyright notice and this permission notice shall be included in
46
+ all copies or substantial portions of the Software.
47
+
48
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
49
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
50
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
51
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
52
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
53
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
54
+ THE SOFTWARE.
55
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'activerecord/migrations/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "activerecord-migrations"
8
+ spec.version = ActiveRecord::Migrations::VERSION
9
+ spec.authors = ["Samuel Williams"]
10
+ spec.email = ["samuel.williams@oriontransfer.co.nz"]
11
+
12
+ spec.summary = %q{Provides a opinionated migration wrapper for ActiveRecord 5+}
13
+ spec.homepage = "https://github.com/ioquatix/activerecord-migrations"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
+ f.match(%r{^(test|spec|features)/})
18
+ end
19
+ spec.bindir = "exe"
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_dependency "activerecord", "~> 5.0"
24
+ spec.add_dependency "railties", "~> 5.0"
25
+
26
+ spec.add_development_dependency "bundler", "~> 1.13"
27
+ spec.add_development_dependency "rake", "~> 10.0"
28
+ spec.add_development_dependency "rspec", "~> 3.0"
29
+ end
@@ -0,0 +1,7 @@
1
+
2
+ require "activerecord/migrations/version"
3
+
4
+ module ActiveRecord
5
+ module Migrations
6
+ end
7
+ end
@@ -0,0 +1,17 @@
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
@@ -0,0 +1,53 @@
1
+
2
+ namespace :db do
3
+ task :load_config => :environment do
4
+ database_tasks = ActiveRecord::Tasks::DatabaseTasks
5
+
6
+ unless root = ActiveRecord::Migrations.root
7
+ abort "ActiveRecord::Migrations.root needs to be set!"
8
+ end
9
+
10
+ unless DATABASE_ENV
11
+ abort "DATABASE_ENV needs to be set!"
12
+ end
13
+
14
+ if ActiveRecord::Base.configurations.empty?
15
+ abort "ActiveRecord::Base.configurations needs to be setup!"
16
+ end
17
+
18
+ database_tasks.root = root
19
+ database_tasks.db_dir = File.join(root, 'db')
20
+ database_tasks.env = DATABASE_ENV.to_s
21
+ database_tasks.database_configuration = ActiveRecord::Base.configurations
22
+ database_tasks.migrations_paths = File.join(root, 'db/migrate')
23
+
24
+ database_tasks.send(:define_method, :load_seed) do
25
+ load File.join(root, 'db/seed.rb')
26
+ end
27
+ end
28
+
29
+ task 'Setup a new database if required and run migrations.'
30
+ task :deploy => :load_config do
31
+ database_tasks = ActiveRecord::Tasks::DatabaseTasks
32
+
33
+ schema_path = File.join(database_tasks.db_dir, 'schema.rb')
34
+ unless File.exist? schema_path
35
+ abort "Missing #{schema_path}, cannot deploy!"
36
+ end
37
+
38
+ if ActiveRecord::Migrations.database?
39
+ Rake::Task['db:migrate'].invoke
40
+ else
41
+ Rake::Task['db:setup'].invoke
42
+ end
43
+ end
44
+
45
+ task :connection_config => :environment do
46
+ require 'pp'
47
+
48
+ pp ActiveRecord::Base.connection_config
49
+ end
50
+ end
51
+
52
+ # Loading this AFTER we define our own load_config task is critical, we need to make sure things are set up correctly before we run the task of the same name from ActiveRecord.
53
+ load 'active_record/railties/databases.rake'
@@ -0,0 +1,22 @@
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
@@ -0,0 +1,5 @@
1
+ module ActiveRecord
2
+ module Migrations
3
+ VERSION = "1.0.0-rc1"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,126 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: activerecord-migrations
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0.pre.rc1
5
+ platform: ruby
6
+ authors:
7
+ - Samuel Williams
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-12-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activerecord
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '5.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '5.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: railties
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '5.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '5.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.13'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.13'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ description:
84
+ email:
85
+ - samuel.williams@oriontransfer.co.nz
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".gitignore"
91
+ - ".rspec"
92
+ - ".travis.yml"
93
+ - Gemfile
94
+ - README.md
95
+ - Rakefile
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
102
+ homepage: https://github.com/ioquatix/activerecord-migrations
103
+ licenses:
104
+ - MIT
105
+ metadata: {}
106
+ post_install_message:
107
+ rdoc_options: []
108
+ require_paths:
109
+ - lib
110
+ required_ruby_version: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ required_rubygems_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">"
118
+ - !ruby/object:Gem::Version
119
+ version: 1.3.1
120
+ requirements: []
121
+ rubyforge_project:
122
+ rubygems_version: 2.5.2
123
+ signing_key:
124
+ specification_version: 4
125
+ summary: Provides a opinionated migration wrapper for ActiveRecord 5+
126
+ test_files: []