grape-activerecord 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a43c454c0c8e5230e134d511464e14c2a4c062cc
4
- data.tar.gz: 1e20319511f7e845eba87ee9b4c094edf97efc5f
3
+ metadata.gz: 9d00ef2f533d9024567eb6a5d47eb1fe438b4bed
4
+ data.tar.gz: b570d2561ed6e6892c94c1360e4ae31890991d2e
5
5
  SHA512:
6
- metadata.gz: 7c66769c829618a12fe5f451b21e624b13675c90f02f305b136ecc6c60635b069500a561bd71a878063976c64307b3b953c3fe2e1966059fde51060849038afc
7
- data.tar.gz: 266665d7de890be4d804296ff2eb9396da0fa1478d54a7d6d769c5b9343a979b61244ee7a227993ad7bb343addf96497c73a7c7c7fdbea9ae45f53b5c9fa7e90
6
+ metadata.gz: a0bd46dddaba9b5a42b92638bd3f41b000b0b49065b21f5a141839d0fb7ac90cb61dcb8ee4e79902e849b57006dacd790dce6159eb199131364ea6ece8376ef9
7
+ data.tar.gz: 46a6ecb3873c69fe447f4764d5abd14a13bec5156f5fb337b57fc47d9540e4a5810392f05f96ce9d2a8e2937cfd9a398edcc6b4466aeda54d61a2269858cd5cf
@@ -30,25 +30,23 @@ If you don't specify any configuration, grape-activerecord will first look in DA
30
30
  This will establish the database connections and correctly return used connections to the pool after each request.
31
31
  NOTE If you're mounting sub Grape apps, you need only include grape-activerecord in the root app.
32
32
 
33
- === Add ActiveRecord tasks to your Rakefile
33
+ === Example Rakefile with ActiveRecord tasks
34
34
 
35
- # Add at the bottom of your Rakefile
36
- require 'grape/activerecord/rake'
35
+ require 'bundler/setup'
36
+ require 'grape/activerecord/rake'
37
+
38
+ namespace :db
39
+ # Some db tasks require your app code to be loaded
40
+ task :environment do
41
+ require_relative 'app'
42
+ end
43
+ end
37
44
 
38
45
  This will give you most of the standard "db:" tasks you get in Rails. Run "bundle exec rake -T" to get a full list.
39
46
  Note that unlike in Rails, creating a new migration is also a rake task:
40
47
 
41
48
  bundle exec rake db:create_migration NAME=create_widgets
42
49
 
43
- === Customize ActiveRecord rake tasks config
44
-
45
- # The defaults are the same as Rails'
46
- ActiveRecord::Tasks::DatabaseTasks.tap do |config|
47
- config.db_dir = 'db'
48
- config.migrations_paths = ['db/migrate']
49
- config.fixtures_path = 'test/fixtures'
50
- end
51
-
52
50
  === Example app
53
51
 
54
52
  Look under /examples for some example apps.
@@ -1,7 +1,3 @@
1
1
  load "active_record/railties/databases.rake"
2
-
3
- Grape::ActiveRecord.setup!
4
2
  require "grape/activerecord/rake/activerecord_#{ActiveRecord::VERSION::MAJOR}"
5
3
  load "grape/activerecord/tasks.rake"
6
-
7
- ActiveRecord::Base.logger = nil
@@ -1,18 +1,27 @@
1
- ActiveRecord::Tasks::DatabaseTasks.tap do |config|
2
- config.root = Rake.application.original_dir
3
- config.env = Grape::ActiveRecord::RACK_ENV.to_s
4
- config.db_dir = 'db'
5
- config.migrations_paths = ['db/migrate']
6
- config.fixtures_path = 'test/fixtures'
7
- config.database_configuration = ActiveRecord::Base.configurations
8
- config.seed_loader = Object.new
9
- config.seed_loader.instance_eval do
10
- def load_seed
11
- load "#{ActiveRecord::Tasks::DatabaseTasks.db_dir}/seeds.rb"
1
+ Rake::Task['db:load_config'].clear
2
+ Rake::Task.define_task('db:load_config') do
3
+ require 'grape/activerecord'
4
+ Grape::ActiveRecord.setup!
5
+ ActiveRecord::Base.logger = nil
6
+
7
+ ActiveRecord::Tasks::DatabaseTasks.tap do |config|
8
+ config.root = Rake.application.original_dir
9
+ config.env = Grape::ActiveRecord::RACK_ENV
10
+ config.db_dir = 'db'
11
+ config.migrations_paths = ['db/migrate']
12
+ config.fixtures_path = 'test/fixtures'
13
+ config.database_configuration = ActiveRecord::Base.configurations
14
+ config.seed_loader = Object.new
15
+ config.seed_loader.instance_eval do
16
+ def load_seed
17
+ load "#{ActiveRecord::Tasks::DatabaseTasks.db_dir}/seeds.rb"
18
+ end
12
19
  end
13
20
  end
14
21
  end
15
22
 
16
- Rake::Task['db:load_config'].clear
17
- Rake::Task.define_task('db:environment')
23
+ Rake::Task.define_task('db:environment') do
24
+ Rake::Task['db:load_config'].invoke
25
+ end
26
+
18
27
  Rake::Task['db:test:deprecated'].clear if Rake::Task.task_defined?('db:test:deprecated')
@@ -1,6 +1,6 @@
1
1
  module Grape
2
2
  module ActiveRecord
3
3
  # Gem version
4
- VERSION = '0.0.2'
4
+ VERSION = '0.0.3'
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape-activerecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordan Hollinger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-22 00:00:00.000000000 Z
11
+ date: 2014-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grape