Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mbleigh/seed-fu
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2,3,2
Choose a base ref
...
head repository: mbleigh/seed-fu
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Apr 16, 2014

  1. Add Capistrano3 support

    Add rake task for capistrano3.
    shishi committed Apr 16, 2014
    Copy the full SHA
    a47f53c View commit details

Commits on Jun 17, 2014

  1. Copy the full SHA
    a0ccc59 View commit details

Commits on Jul 15, 2014

  1. Merge pull request #71 from shishi/add_cap3_support

    Add Capistrano3 support
    aserafin committed Jul 15, 2014
    Copy the full SHA
    b62858b View commit details
  2. bump version to 2.3.2

    aserafin committed Jul 15, 2014
    Copy the full SHA
    192bf48 View commit details

Commits on Dec 22, 2014

  1. Update dependencies for Rails 4.2

    Karolis Mazukna committed Dec 22, 2014
    1
    Copy the full SHA
    0d958e8 View commit details
  2. fix tests for 4.2

    Karolis Mazukna committed Dec 22, 2014
    Copy the full SHA
    38e328b View commit details

Commits on Dec 24, 2014

  1. Merge pull request #87 from Nikamura/master

    Update dependencies for Rails 4.2
    aserafin committed Dec 24, 2014
    Copy the full SHA
    131ccdf View commit details
  2. bump version to 2.3.4

    aserafin committed Dec 24, 2014
    Copy the full SHA
    92ac270 View commit details

Commits on Dec 29, 2014

  1. Copy the full SHA
    25881e3 View commit details

Commits on Mar 5, 2015

  1. Copy the full SHA
    6e96d63 View commit details

Commits on Mar 29, 2015

  1. Merge pull request #92 from y-yagi/rails_4_2_x

    update dependencies for Rails 4.2.x
    aserafin committed Mar 29, 2015
    Copy the full SHA
    ca7f1e6 View commit details
  2. bump version to 2.3.5

    aserafin committed Mar 29, 2015
    3
    Copy the full SHA
    b5b32f0 View commit details
  3. Update CHANGELOG.md

    aserafin committed Mar 29, 2015
    Copy the full SHA
    a13ce36 View commit details

Commits on Nov 10, 2015

  1. removing rails 4 limitation

    Derick Matamoros committed Nov 10, 2015
    Copy the full SHA
    264801c View commit details

Commits on Mar 18, 2016

  1. Merge pull request #99 from cimtico/rails_5

    allow newer rails
    aserafin committed Mar 18, 2016
    Copy the full SHA
    8468169 View commit details
  2. Merge pull request #89 from Valve/remove-implicit-ordering

    Remove implicit ordering when searching existing row by constraint
    aserafin committed Mar 18, 2016
    Copy the full SHA
    2ff039c View commit details

Commits on Mar 22, 2016

  1. add MIT license to gemspec

    fzipi committed Mar 22, 2016
    Copy the full SHA
    f9be330 View commit details

Commits on Apr 18, 2016

  1. Copy the full SHA
    8def918 View commit details

Commits on Jul 1, 2016

  1. Merge pull request #103 from fzipi/add-gemspec-license

    add MIT license to gemspec
    aserafin authored Jul 1, 2016
    Copy the full SHA
    154e6b4 View commit details
  2. allow rails 5 in Gemfile

    aserafin committed Jul 1, 2016
    Copy the full SHA
    bbcb75a View commit details
  3. Copy the full SHA
    61361bf View commit details
  4. Merge pull request #106 from sickate/master

    add PostGIS adapter name detection
    aserafin authored Jul 1, 2016
    Copy the full SHA
    9d393b2 View commit details

Commits on Oct 25, 2017

  1. Support PostgreSQL 10

    ppworks committed Oct 25, 2017
    Copy the full SHA
    66ad1f8 View commit details

Commits on Nov 24, 2017

  1. Merge pull request #121 from ppworks/support-postgresql10

    Support PostgreSQL 10
    aserafin authored Nov 24, 2017
    Copy the full SHA
    52072e7 View commit details
  2. bump version to 2.3.7

    aserafin committed Nov 24, 2017
    Copy the full SHA
    9a5913f View commit details

Commits on Jan 15, 2018

  1. Copy the full SHA
    0ad8e46 View commit details

Commits on Apr 7, 2018

  1. Merge pull request #125 from mnaberez/postgresql_version

    Restore support for PostgreSQL with Rails versions before 5.0.0
    aserafin authored Apr 7, 2018
    Copy the full SHA
    ba11d38 View commit details
  2. bump version to 2.3.9

    aserafin committed Apr 7, 2018
    Copy the full SHA
    34c054c View commit details
Showing with 81 additions and 14 deletions.
  1. +35 −0 CHANGELOG.md
  2. +1 −1 Gemfile
  3. +10 −1 README.md
  4. +1 −0 lib/seed-fu/capistrano3.rb
  5. +15 −6 lib/seed-fu/seeder.rb
  6. +1 −1 lib/seed-fu/version.rb
  7. +12 −0 lib/tasks/seed_fu_capistrano3.rake
  8. +6 −5 seed-fu.gemspec
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
Version 2.3.8
-------------

Bug fixes:

* Restored support for PostgreSQL with Rails versions before 5.0.0 broken in Seed Fu 2.3.7.

Version 2.3.7
-------------

Features:

* Postgresql >= 10.0 support

Version 2.3.6
-------------

Features:

* Rails 5.0 support

Version 2.3.5
-------------

Features:

* Rails 4.2 support

Version 2.3.3
-------------

Features:

* Capistrano v3 support (by @shishi)

Version 2.3.2
-------------

2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
source 'http://rubygems.org'
gem 'rails', ">= 3.1", "< 4.1"
gem 'rails', ">= 3.1", "< 5.1"
gemspec
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -39,7 +39,7 @@ Basic Example
Installation
------------

### Rails 3.1, 3.2, 4.0, 4.1
### Rails 3.1, 3.2, 4.0, 4.1, 4.2, 5.0

Just add `gem 'seed-fu', '~> 2.3'` to your `Gemfile`

@@ -149,6 +149,15 @@ require 'seed-fu/capistrano'
after 'deploy:update_code', 'db:seed_fu'
```

If you use Capistrano3, you should require another file.

```ruby
require 'seed-fu/capistrano3'

# Trigger the task before publishing
before 'deploy:publishing', 'db:seed_fu'
```

Bugs / Feature requests
-----------------------

1 change: 1 addition & 0 deletions lib/seed-fu/capistrano3.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
load File.expand_path('../../tasks/seed_fu_capistrano3.rake', __FILE__)
21 changes: 15 additions & 6 deletions lib/seed-fu/seeder.rb
Original file line number Diff line number Diff line change
@@ -71,12 +71,12 @@ def seed_record(data)
else
record.assign_attributes(data)
end
record.save(:validate => false) || raise(ActiveRecord::RecordNotSaved)
record.save(:validate => false) || raise(ActiveRecord::RecordNotSaved, 'Record not saved!')
record
end

def find_or_initialize_record(data)
@model_class.where(constraint_conditions(data)).first ||
@model_class.where(constraint_conditions(data)).take ||
@model_class.new
end

@@ -85,15 +85,24 @@ def constraint_conditions(data)
end

def update_id_sequence
if @model_class.connection.adapter_name == "PostgreSQL"
if @model_class.connection.adapter_name == "PostgreSQL" or @model_class.connection.adapter_name == "PostGIS"
return if @model_class.primary_key.nil? || @model_class.sequence_name.nil?

quoted_id = @model_class.connection.quote_column_name(@model_class.primary_key)
sequence = @model_class.sequence_name

@model_class.connection.execute <<-EOS
SELECT setval('#{sequence}', (SELECT GREATEST(MAX(#{quoted_id})+(SELECT increment_by FROM #{sequence}), (SELECT min_value FROM #{sequence})) FROM #{@model_class.quoted_table_name}), false)
EOS
# TODO postgresql_version was made public in Rails 5.0.0, remove #send when support for earlier versions are dropped
if @model_class.connection.send(:postgresql_version) >= 100000
sql =<<-EOS
SELECT setval('#{sequence}', (SELECT GREATEST(MAX(#{quoted_id})+(SELECT seqincrement FROM pg_sequence WHERE seqrelid = '#{sequence}'::regclass), (SELECT seqmin FROM pg_sequence WHERE seqrelid = '#{sequence}'::regclass)) FROM #{@model_class.quoted_table_name}), false)
EOS
else
sql =<<-EOS
SELECT setval('#{sequence}', (SELECT GREATEST(MAX(#{quoted_id})+(SELECT increment_by FROM #{sequence}), (SELECT min_value FROM #{sequence})) FROM #{@model_class.quoted_table_name}), false)
EOS
end

@model_class.connection.execute sql
end
end
end
2 changes: 1 addition & 1 deletion lib/seed-fu/version.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module SeedFu
# The current version of Seed Fu
VERSION = '2.3.2'
VERSION = '2.3.9'
end
12 changes: 12 additions & 0 deletions lib/tasks/seed_fu_capistrano3.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace :db do
desc 'Load seed data into database'
task :seed_fu do
on roles(:db) do
within release_path do
with rails_env: fetch(:rails_env) do
execute :bundle, :exec, :rake, 'db:seed_fu'
end
end
end
end
end
11 changes: 6 additions & 5 deletions seed-fu.gemspec
Original file line number Diff line number Diff line change
@@ -8,19 +8,20 @@ Gem::Specification.new do |s|
s.name = "seed-fu"
s.version = SeedFu::VERSION
s.platform = Gem::Platform::RUBY
s.licenses = ['MIT']
s.authors = ["Michael Bleigh", "Jon Leighton"]
s.email = ["michael@intridea.com", "j@jonathanleighton.com"]
s.homepage = "http://github.com/mbleigh/seed-fu"
s.summary = "Easily manage seed data in your Active Record application"
s.description = "Seed Fu is an attempt to once and for all solve the problem of inserting and maintaining seed data in a database. It uses a variety of techniques gathered from various places around the web and combines them to create what is hopefully the most robust seed data system around."

s.add_dependency "activerecord", [">= 3.1", "< 4.2"]
s.add_dependency "activesupport", [">= 3.1", "< 4.2"]
s.add_dependency "activerecord", [">= 3.1"]
s.add_dependency "activesupport", [">= 3.1"]

s.add_development_dependency "rspec", "~> 2.0"
s.add_development_dependency "pg"
s.add_development_dependency "mysql2"
s.add_development_dependency "sqlite3"
s.add_development_dependency "pg", '~> 0'
s.add_development_dependency "mysql2", '~> 0'
s.add_development_dependency "sqlite3", '~> 0'

s.files = Dir.glob("{lib}/**/*") + %w(LICENSE README.md CHANGELOG.md)
s.require_path = 'lib'