sinatra-activerecord 2.0.0.rc → 2.0.0.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5a793e2e9766107769c69e570aad46e5d3388c3
|
4
|
+
data.tar.gz: 1f1a0f0bcc4a133ded8adbf47625747b54bf6635
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64bf50a0e2d7bd17fdb0dbb4d08eac01cf669eb773e9d497cfc6cc31e5f351ac5e6c616b75b8cb5ae72619b691bfb4f7d0d6616c770e0cd6618a969fc5913315
|
7
|
+
data.tar.gz: 1e53a2d583f2dba949d4cfc5ce6e32f693c7c8701715378ddf918535785ba31762d828d13fdf1ad3a1baf4b6aa32fa17a44d9e478d511b8db2f86fb7484c4612
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "active_support/string_inquirer"
|
2
|
+
|
3
|
+
module Rails
|
4
|
+
extend self
|
5
|
+
|
6
|
+
def root
|
7
|
+
Pathname.new(Rake.application.original_dir)
|
8
|
+
end
|
9
|
+
|
10
|
+
def env
|
11
|
+
ActiveSupport::StringInquirer.new(ENV["RACK_ENV"] || "development")
|
12
|
+
end
|
13
|
+
|
14
|
+
def application
|
15
|
+
seed_loader = Object.new
|
16
|
+
seed_loader.instance_eval do
|
17
|
+
def load_seed
|
18
|
+
load "db/seeds.rb"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
seed_loader
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
Rake::Task.define_task("db:environment")
|
26
|
+
Rake::Task["db:load_config"].clear
|
27
|
+
Rake::Task.define_task("db:rails_env")
|
@@ -0,0 +1,19 @@
|
|
1
|
+
seed_loader = Object.new
|
2
|
+
seed_loader.instance_eval do
|
3
|
+
def load_seed
|
4
|
+
load "#{ActiveRecord::Tasks::DatabaseTasks.db_dir}/seeds.rb"
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
ActiveRecord::Tasks::DatabaseTasks.tap do |config|
|
9
|
+
config.root = Rake.application.original_dir
|
10
|
+
config.env = ENV["RACK_ENV"] || "development"
|
11
|
+
config.db_dir = "db"
|
12
|
+
config.migrations_paths = ["db/migrate"]
|
13
|
+
config.fixtures_path = "test/fixtures"
|
14
|
+
config.seed_loader = seed_loader
|
15
|
+
config.database_configuration = ActiveRecord::Base.configurations
|
16
|
+
end
|
17
|
+
|
18
|
+
Rake::Task.define_task("db:environment")
|
19
|
+
Rake::Task["db:test:deprecated"].clear if Rake::Task.task_defined?("db:test:deprecated")
|
@@ -1,51 +1,6 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
load "active_record/railties/databases.rake"
|
2
|
+
require "sinatra/activerecord/rake/activerecord_#{ActiveRecord::VERSION::MAJOR}"
|
3
3
|
|
4
|
-
|
5
|
-
seed_loader.instance_eval do
|
6
|
-
def load_seed
|
7
|
-
load "#{ActiveRecord::Tasks::DatabaseTasks.db_dir}/seeds.rb"
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
ActiveRecord::Tasks::DatabaseTasks.tap do |config|
|
12
|
-
config.root = Rake.application.original_dir
|
13
|
-
config.env = ENV["RACK_ENV"] || "development"
|
14
|
-
config.db_dir = "db"
|
15
|
-
config.migrations_paths = ["db/migrate"]
|
16
|
-
config.fixtures_path = "test/fixtures"
|
17
|
-
config.seed_loader = seed_loader
|
18
|
-
config.database_configuration = ActiveRecord::Base.configurations
|
19
|
-
end
|
20
|
-
|
21
|
-
when 3
|
22
|
-
|
23
|
-
require "active_support/string_inquirer"
|
24
|
-
|
25
|
-
module Rails
|
26
|
-
extend self
|
27
|
-
|
28
|
-
def root
|
29
|
-
Pathname.new(Rake.application.original_dir)
|
30
|
-
end
|
31
|
-
|
32
|
-
def env
|
33
|
-
ActiveSupport::StringInquirer.new(ENV["RACK_ENV"] || "development")
|
34
|
-
end
|
35
|
-
|
36
|
-
def application
|
37
|
-
seed_loader = Object.new
|
38
|
-
seed_loader.instance_eval do
|
39
|
-
def load_seed
|
40
|
-
load "db/seeds.rb"
|
41
|
-
end
|
42
|
-
end
|
43
|
-
seed_loader
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
end
|
4
|
+
load "sinatra/activerecord/tasks.rake"
|
48
5
|
|
49
6
|
ActiveRecord::Base.logger = nil
|
50
|
-
|
51
|
-
load 'sinatra/activerecord/tasks.rake'
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require "active_support/core_ext/string/strip"
|
2
2
|
require "pathname"
|
3
|
-
|
4
|
-
load "active_record/railties/databases.rake"
|
3
|
+
require "fileutils"
|
5
4
|
|
6
5
|
namespace :db do
|
7
6
|
desc "Create a migration (parameters: NAME, VERSION)"
|
@@ -14,12 +13,21 @@ namespace :db do
|
|
14
13
|
name = ENV["NAME"]
|
15
14
|
version = ENV["VERSION"] || Time.now.utc.strftime("%Y%m%d%H%M%S")
|
16
15
|
|
16
|
+
ActiveRecord::Migrator.migrations_paths.each do |directory|
|
17
|
+
next unless File.exists?(directory)
|
18
|
+
migration_files = Pathname(directory).children
|
19
|
+
if duplicate = migration_files.find { |path| path.basename.to_s.include?(name) }
|
20
|
+
puts "Another migration is already named \"#{name}\": #{duplicate}."
|
21
|
+
exit
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
17
25
|
filename = "#{version}_#{name}.rb"
|
18
26
|
dirname = ActiveRecord::Migrator.migrations_path
|
19
|
-
path =
|
27
|
+
path = File.join(dirname, filename)
|
20
28
|
|
21
|
-
|
22
|
-
|
29
|
+
FileUtils.mkdir_p(dirname)
|
30
|
+
File.write path, <<-MIGRATION.strip_heredoc
|
23
31
|
class #{name.camelize} < ActiveRecord::Migration
|
24
32
|
def change
|
25
33
|
end
|
@@ -28,13 +36,4 @@ namespace :db do
|
|
28
36
|
|
29
37
|
puts path
|
30
38
|
end
|
31
|
-
|
32
|
-
task :environment
|
33
|
-
|
34
|
-
Rake::Task["db:test:deprecated"].clear if Rake::Task.task_defined?("db:test:deprecated")
|
35
|
-
|
36
|
-
if ActiveRecord::VERSION::MAJOR == 3
|
37
|
-
Rake::Task["db:load_config"].clear
|
38
|
-
task :rails_env
|
39
|
-
end
|
40
39
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-activerecord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Blake Mizerany
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-04-
|
12
|
+
date: 2014-04-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sinatra
|
@@ -105,6 +105,8 @@ files:
|
|
105
105
|
- README.md
|
106
106
|
- lib/sinatra/activerecord.rb
|
107
107
|
- lib/sinatra/activerecord/rake.rb
|
108
|
+
- lib/sinatra/activerecord/rake/activerecord_3.rb
|
109
|
+
- lib/sinatra/activerecord/rake/activerecord_4.rb
|
108
110
|
- lib/sinatra/activerecord/tasks.rake
|
109
111
|
homepage: http://github.com/janko-m/sinatra-activerecord
|
110
112
|
licenses:
|
@@ -126,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
128
|
version: 1.3.1
|
127
129
|
requirements: []
|
128
130
|
rubyforge_project:
|
129
|
-
rubygems_version: 2.2.
|
131
|
+
rubygems_version: 2.2.2
|
130
132
|
signing_key:
|
131
133
|
specification_version: 4
|
132
134
|
summary: Extends Sinatra with ActiveRecord helpers.
|