fix-db-schema-conflicts 1.0.0 → 1.0.1

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: 9bb17cf2511680d97239cd9bac03e1a9b9837799
4
- data.tar.gz: 2d3eb7a8c6cf284803b904b1b91dfcbad8c83e22
3
+ metadata.gz: 7cf377dd87148b7e42c99528125d9afefd6789a5
4
+ data.tar.gz: 70e527ce5f16ad2c910cda092c9226415e56a071
5
5
  SHA512:
6
- metadata.gz: 8cb87f442e2bc4bd0d1043015fb25006afb8c8ab64c541181bbef1363378e44d013548e2f97d12767c3de8d721185c0259b04177a294cf57e68ac3dbb47d09ca
7
- data.tar.gz: 0e93ce3899839f040af23a97dc309815cd84ddaf7658e268cb4323f34276ef4708b348b688a9aa3479a2e98348372e9fec193df374ef80ad035dcd652aed7431
6
+ metadata.gz: fd3738491c717b952c75fc9f635b8b110d5e45ae2acf4216381707145c8af5c58c71470affc29fac2df901c4cd1348f18b0db1351fbdf98fa94cfa7cfdf31814
7
+ data.tar.gz: 76bc1f6ea737e97ab0bd57308f96106492d8de667f6051eed463a002633a2436c258b65905b976a5a1187d861973301fdfe36f4c19d79bb12a526260139840e3
data/.gitignore CHANGED
@@ -12,3 +12,4 @@
12
12
  *.o
13
13
  *.a
14
14
  mkmf.log
15
+ *.gem
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
- # Fix::Db::Schema::Conflicts
1
+ # fix-db-schema-conflicts
2
2
 
3
- TODO: Write a gem description
3
+ It prevents db/schema.rb conflicts in your Rails projects when working with multiple team members.
4
4
 
5
5
  ## Installation
6
6
 
7
- Add this line to your application's Gemfile:
7
+ Add this line to your application's Gemfile in your development group:
8
8
 
9
9
  ```ruby
10
10
  gem 'fix-db-schema-conflicts'
@@ -14,13 +14,13 @@ And then execute:
14
14
 
15
15
  $ bundle
16
16
 
17
- Or install it yourself as:
17
+ ## Usage
18
18
 
19
- $ gem install fix-db-schema-conflicts
19
+ You don't have to do anything different. It should just work. Simply run `rake db:migrate` or `rake db:schema:dump` as you would before and `fix-db-schema-conflicts` will do the rest.
20
20
 
21
- ## Usage
21
+ ## How it works
22
22
 
23
- TODO: Write usage instructions here
23
+ This gem sorts the table, index, and foreign key names before outputting them to the schema.rb file. Additionally it runs Rubocop with the auto-correct flag to ensure a consistent output format. Then it runs `sed` to cleanup additional horizontal whitespace inserted by Rails.
24
24
 
25
25
  ## Contributing
26
26
 
@@ -1,3 +1,5 @@
1
+ require 'delegate'
2
+
1
3
  module ActiveRecord
2
4
  # = Active Record Schema Dumper
3
5
  #
@@ -1,3 +1,3 @@
1
1
  module FixDBSchemaConflicts
2
- VERSION='1.0.0'
2
+ VERSION='1.0.1'
3
3
  end
data/lib/tasks/db.rake CHANGED
@@ -2,7 +2,11 @@ namespace :db do
2
2
  namespace :schema do
3
3
  task :dump do
4
4
  puts "Dumping database schema with fix-db-schema-conflicts gem"
5
- filename = ENV['SCHEMA'] || File.join(ActiveRecord::Tasks::DatabaseTasks.db_dir, 'schema.rb')
5
+ filename = ENV['SCHEMA'] || if defined? ActiveRecord::Tasks::DatabaseTasks
6
+ File.join(ActiveRecord::Tasks::DatabaseTasks.db_dir, 'schema.rb')
7
+ else
8
+ "#{Rails.root}/db/schema.rb"
9
+ end
6
10
  rubocop_yml = File.expand_path('../../../.rubocop_schema.yml', __FILE__)
7
11
  `rubocop --auto-correct --config #{rubocop_yml} #{filename}`
8
12
  `sed -E -e 's/, +/, /g' #{filename} > db/schema.fixed.rb`
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fix-db-schema-conflicts
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jake Moffatt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-20 00:00:00.000000000 Z
11
+ date: 2014-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler