gris 0.5.8 → 0.5.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +6 -5
- data/Gemfile.lock +1 -38
- data/gris.gemspec +0 -1
- data/lib/gris.rb +1 -0
- data/lib/gris/generators/templates/scaffold/config/initializers/active_record.rb +5 -3
- data/lib/gris/generators/templates/scaffold/db/seeds.rb +9 -0
- data/lib/gris/seed_loader.rb +12 -0
- data/lib/gris/version.rb +1 -1
- data/lib/tasks/db.rake +15 -5
- data/lib/tasks/routes.rake +2 -1
- data/spec/generators/scaffold_generator_spec.rb +5 -0
- data/spec/seed_loader_spec.rb +26 -0
- metadata +6 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa0597dd3271c7ee42e4a9687b4ef7c60cd87ed4
|
4
|
+
data.tar.gz: a6ec4d9e1d5a47e68ba1bb4f43d9bc8cfb08c026
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22fbda40978f237d530280d94d79204fd5efcf0e37bca3eae9cddfe06a2fd528ba9dd1ce77f70724b78efd1499c05d38a89a28498130ab7cd84a42e207d847e2
|
7
|
+
data.tar.gz: 89e7dc1d05839a9e83ae05f8f405f73c0f0628b8682e287014c57fa93bd42ef4b9e02227d422acd2df431fad338074400547f75a758798e074edd56669a67d26
|
data/.rubocop_todo.yml
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2015-
|
3
|
+
# on 2015-12-21 17:33:53 -0500 using RuboCop version 0.34.2.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
-
# Offense count:
|
9
|
+
# Offense count: 3
|
10
10
|
# Cop supports --auto-correct.
|
11
11
|
# Configuration parameters: AlignWith, SupportedStyles, AutoCorrect.
|
12
12
|
Lint/EndAlignment:
|
@@ -30,12 +30,12 @@ Metrics/ClassLength:
|
|
30
30
|
Metrics/CyclomaticComplexity:
|
31
31
|
Max: 11
|
32
32
|
|
33
|
-
# Offense count:
|
33
|
+
# Offense count: 83
|
34
34
|
# Configuration parameters: AllowURI, URISchemes.
|
35
35
|
Metrics/LineLength:
|
36
36
|
Max: 159
|
37
37
|
|
38
|
-
# Offense count:
|
38
|
+
# Offense count: 11
|
39
39
|
# Configuration parameters: CountComments.
|
40
40
|
Metrics/MethodLength:
|
41
41
|
Max: 32
|
@@ -46,7 +46,8 @@ Metrics/MethodLength:
|
|
46
46
|
Style/CaseIndentation:
|
47
47
|
Enabled: false
|
48
48
|
|
49
|
-
# Offense count:
|
49
|
+
# Offense count: 22
|
50
|
+
# Configuration parameters: Exclude.
|
50
51
|
Style/Documentation:
|
51
52
|
Enabled: false
|
52
53
|
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
gris (0.5.
|
5
|
-
active_record_migrations
|
4
|
+
gris (0.5.9)
|
6
5
|
activesupport (~> 4.2, >= 4.2.0)
|
7
6
|
chronic (~> 0.10.0)
|
8
7
|
dalli (~> 2.7)
|
@@ -21,23 +20,6 @@ PATH
|
|
21
20
|
GEM
|
22
21
|
remote: https://rubygems.org/
|
23
22
|
specs:
|
24
|
-
actionpack (4.2.4)
|
25
|
-
actionview (= 4.2.4)
|
26
|
-
activesupport (= 4.2.4)
|
27
|
-
rack (~> 1.6)
|
28
|
-
rack-test (~> 0.6.2)
|
29
|
-
rails-dom-testing (~> 1.0, >= 1.0.5)
|
30
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
31
|
-
actionview (4.2.4)
|
32
|
-
activesupport (= 4.2.4)
|
33
|
-
builder (~> 3.1)
|
34
|
-
erubis (~> 2.7.0)
|
35
|
-
rails-dom-testing (~> 1.0, >= 1.0.5)
|
36
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
37
|
-
active_record_migrations (4.2.4.1)
|
38
|
-
activerecord (= 4.2.4)
|
39
|
-
railties (= 4.2.4)
|
40
|
-
rake
|
41
23
|
activemodel (4.2.4)
|
42
24
|
activesupport (= 4.2.4)
|
43
25
|
builder (~> 3.1)
|
@@ -75,7 +57,6 @@ GEM
|
|
75
57
|
thread_safe (~> 0.3, >= 0.3.1)
|
76
58
|
diff-lcs (1.2.5)
|
77
59
|
equalizer (0.0.11)
|
78
|
-
erubis (2.7.0)
|
79
60
|
fakefs (0.6.7)
|
80
61
|
faraday (0.9.2)
|
81
62
|
multipart-post (>= 1.2, < 3)
|
@@ -131,16 +112,11 @@ GEM
|
|
131
112
|
logging (2.0.0)
|
132
113
|
little-plugger (~> 1.1)
|
133
114
|
multi_json (~> 1.10)
|
134
|
-
loofah (2.0.3)
|
135
|
-
nokogiri (>= 1.5.9)
|
136
|
-
mini_portile2 (2.0.0)
|
137
115
|
minitest (5.8.1)
|
138
116
|
multi_json (1.11.2)
|
139
117
|
multi_xml (0.5.5)
|
140
118
|
multipart-post (2.0.0)
|
141
119
|
net-http-digest_auth (1.4)
|
142
|
-
nokogiri (1.6.7.1)
|
143
|
-
mini_portile2 (~> 2.0.0.rc2)
|
144
120
|
parser (2.2.2.6)
|
145
121
|
ast (>= 1.1, < 3.0)
|
146
122
|
powerpack (0.1.1)
|
@@ -154,19 +130,6 @@ GEM
|
|
154
130
|
racksh (1.0.0)
|
155
131
|
rack (>= 1.0)
|
156
132
|
rack-test (>= 0.5)
|
157
|
-
rails-deprecated_sanitizer (1.0.3)
|
158
|
-
activesupport (>= 4.2.0.alpha)
|
159
|
-
rails-dom-testing (1.0.7)
|
160
|
-
activesupport (>= 4.2.0.beta, < 5.0)
|
161
|
-
nokogiri (~> 1.6.0)
|
162
|
-
rails-deprecated_sanitizer (>= 1.0.1)
|
163
|
-
rails-html-sanitizer (1.0.2)
|
164
|
-
loofah (~> 2.0)
|
165
|
-
railties (4.2.4)
|
166
|
-
actionpack (= 4.2.4)
|
167
|
-
activesupport (= 4.2.4)
|
168
|
-
rake (>= 0.8.7)
|
169
|
-
thor (>= 0.18.1, < 2.0)
|
170
133
|
rainbow (2.0.0)
|
171
134
|
rake (10.4.2)
|
172
135
|
representable (2.3.0)
|
data/gris.gemspec
CHANGED
@@ -32,7 +32,6 @@ Gem::Specification.new do |s|
|
|
32
32
|
s.add_runtime_dependency 'chronic', '~> 0.10.0'
|
33
33
|
s.add_runtime_dependency 'dalli', '~> 2.7'
|
34
34
|
s.add_runtime_dependency 'indefinite_article', '~> 0.2'
|
35
|
-
s.add_runtime_dependency 'active_record_migrations'
|
36
35
|
|
37
36
|
s.add_development_dependency 'bundler', '~> 1'
|
38
37
|
s.add_development_dependency 'rspec', '~> 3.3'
|
data/lib/gris.rb
CHANGED
@@ -22,6 +22,7 @@ require 'gris/middleware/error_handlers'
|
|
22
22
|
require 'gris/output_formatters/paginated_presenter'
|
23
23
|
require 'gris/output_formatters/presenter'
|
24
24
|
require 'gris/output_formatters/presenter_link_helpers'
|
25
|
+
require 'gris/seed_loader'
|
25
26
|
require 'gris/setup'
|
26
27
|
require 'gris/version'
|
27
28
|
|
@@ -1,8 +1,10 @@
|
|
1
1
|
if ENV['DATABASE_URL']
|
2
|
-
ActiveRecord::Base.establish_connection
|
2
|
+
ActiveRecord::Base.establish_connection ENV['DATABASE_URL']
|
3
3
|
else
|
4
|
-
|
5
|
-
ActiveRecord::Base.establish_connection
|
4
|
+
configurations = YAML.load ERB.new(File.read('./config/database.yml')).result
|
5
|
+
ActiveRecord::Base.establish_connection configurations[Gris.env]
|
6
|
+
ActiveRecord::Base.configurations = configurations
|
6
7
|
end
|
8
|
+
|
7
9
|
# prevent deprecation warning
|
8
10
|
ActiveRecord::Base.raise_in_transactional_callbacks = true
|
@@ -0,0 +1,9 @@
|
|
1
|
+
require './config/application' if File.file?('config/application.rb')
|
2
|
+
|
3
|
+
# This file should contain all the record creation needed to seed the database with its default values.
|
4
|
+
# The data can then be loaded with the rake db:seed.
|
5
|
+
#
|
6
|
+
# Examples:
|
7
|
+
#
|
8
|
+
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
|
9
|
+
# Mayor.create(name: 'Emanuel', city: cities.first)
|
data/lib/gris/version.rb
CHANGED
data/lib/tasks/db.rake
CHANGED
@@ -1,9 +1,19 @@
|
|
1
|
-
if
|
2
|
-
|
1
|
+
if Module.const_defined?(:ActiveRecord) &&
|
2
|
+
(File.file?('config/database.yml') || ENV['DATABASE_URL']) &&
|
3
|
+
File.file?('config/initializers/active_record.rb')
|
3
4
|
|
4
|
-
|
5
|
-
|
5
|
+
require 'erb'
|
6
|
+
require './config/initializers/active_record'
|
7
|
+
include ActiveRecord::Tasks
|
8
|
+
|
9
|
+
DatabaseTasks.env = Gris.env
|
10
|
+
DatabaseTasks.db_dir = 'db'
|
11
|
+
DatabaseTasks.migrations_paths = "#{DatabaseTasks.db_dir}/migrate"
|
12
|
+
DatabaseTasks.seed_loader = Gris::SeedLoader.new "./#{DatabaseTasks.db_dir}/seeds.rb"
|
13
|
+
DatabaseTasks.database_configuration = ActiveRecord::Base.configurations
|
14
|
+
|
15
|
+
task :environment do
|
6
16
|
end
|
7
17
|
|
8
|
-
|
18
|
+
load 'active_record/railties/databases.rake'
|
9
19
|
end
|
data/lib/tasks/routes.rake
CHANGED
@@ -3,10 +3,11 @@ unless defined?(Rails)
|
|
3
3
|
task routes: :environment do
|
4
4
|
require './config/application.rb'
|
5
5
|
ApplicationEndpoint.routes.each do |api|
|
6
|
+
version = api.route_version.ljust(20)
|
6
7
|
method = api.route_method.ljust(10)
|
7
8
|
path = api.route_path.ljust(40)
|
8
9
|
description = api.route_description
|
9
|
-
puts "
|
10
|
+
puts "#{version} #{method} #{path} # #{description}"
|
10
11
|
end
|
11
12
|
end
|
12
13
|
end
|
@@ -44,6 +44,11 @@ describe Gris::Generators::ScaffoldGenerator do
|
|
44
44
|
expect(database_config_file).to match(/adapter: postgresql/)
|
45
45
|
end
|
46
46
|
|
47
|
+
it 'generates a db/seeds.rb file' do
|
48
|
+
seed_file = File.read("#{app_path}/db/seeds.rb")
|
49
|
+
expect(seed_file).to match(/all the record creation needed to seed the database/)
|
50
|
+
end
|
51
|
+
|
47
52
|
it 'adds ruby 2.2.3 to Gemfile' do
|
48
53
|
gemfile = File.read("#{app_path}/Gemfile")
|
49
54
|
expect(gemfile).to match(/ruby '2.2.3'/)
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Gris::SeedLoader do
|
4
|
+
context '#load_seed' do
|
5
|
+
context 'without an existing seed file' do
|
6
|
+
let(:loader) { Gris::SeedLoader.new('blah') }
|
7
|
+
|
8
|
+
it 'raises a RuntimeError' do
|
9
|
+
expect do
|
10
|
+
loader.load_seed
|
11
|
+
end.to raise_error(RuntimeError, "Seed file 'blah' does not exist.")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'with an existing seed file' do
|
16
|
+
include_context 'with a generated app'
|
17
|
+
let(:loader) { Gris::SeedLoader.new('my_test_app/db/seeds.rb') }
|
18
|
+
|
19
|
+
it 'does not raise an error' do
|
20
|
+
expect do
|
21
|
+
loader.load_seed
|
22
|
+
end.to_not raise_error
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gris
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dylan Fareed
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -236,20 +236,6 @@ dependencies:
|
|
236
236
|
- - "~>"
|
237
237
|
- !ruby/object:Gem::Version
|
238
238
|
version: '0.2'
|
239
|
-
- !ruby/object:Gem::Dependency
|
240
|
-
name: active_record_migrations
|
241
|
-
requirement: !ruby/object:Gem::Requirement
|
242
|
-
requirements:
|
243
|
-
- - ">="
|
244
|
-
- !ruby/object:Gem::Version
|
245
|
-
version: '0'
|
246
|
-
type: :runtime
|
247
|
-
prerelease: false
|
248
|
-
version_requirements: !ruby/object:Gem::Requirement
|
249
|
-
requirements:
|
250
|
-
- - ">="
|
251
|
-
- !ruby/object:Gem::Version
|
252
|
-
version: '0'
|
253
239
|
- !ruby/object:Gem::Dependency
|
254
240
|
name: bundler
|
255
241
|
requirement: !ruby/object:Gem::Requirement
|
@@ -376,6 +362,7 @@ files:
|
|
376
362
|
- lib/gris/generators/templates/scaffold/config/puma.rb
|
377
363
|
- lib/gris/generators/templates/scaffold/config/secrets.yml.tt
|
378
364
|
- lib/gris/generators/templates/scaffold/db/schema.rb
|
365
|
+
- lib/gris/generators/templates/scaffold/db/seeds.rb
|
379
366
|
- lib/gris/generators/templates/scaffold/spec/endpoints/cors_spec.rb.tt
|
380
367
|
- lib/gris/generators/templates/scaffold/spec/spec_helper.rb
|
381
368
|
- lib/gris/generators/templates/scaffold/spec/support/app_helper.rb
|
@@ -390,6 +377,7 @@ files:
|
|
390
377
|
- lib/gris/output_formatters/presenter_link_helpers.rb
|
391
378
|
- lib/gris/rspec_extensions/active_record_shared_connection.rb
|
392
379
|
- lib/gris/rspec_extensions/response_helpers.rb
|
380
|
+
- lib/gris/seed_loader.rb
|
393
381
|
- lib/gris/setup.rb
|
394
382
|
- lib/gris/version.rb
|
395
383
|
- lib/tasks/db.rake
|
@@ -409,6 +397,7 @@ files:
|
|
409
397
|
- spec/middleware/error_handlers_spec.rb
|
410
398
|
- spec/output_formatters/presenter_link_helpers_spec.rb
|
411
399
|
- spec/secrets_spec.rb
|
400
|
+
- spec/seed_loader_spec.rb
|
412
401
|
- spec/spec_helper.rb
|
413
402
|
- spec/support/caching_helper.rb
|
414
403
|
- spec/support/integration_setup.rb
|
@@ -457,6 +446,7 @@ test_files:
|
|
457
446
|
- spec/middleware/error_handlers_spec.rb
|
458
447
|
- spec/output_formatters/presenter_link_helpers_spec.rb
|
459
448
|
- spec/secrets_spec.rb
|
449
|
+
- spec/seed_loader_spec.rb
|
460
450
|
- spec/spec_helper.rb
|
461
451
|
- spec/support/caching_helper.rb
|
462
452
|
- spec/support/integration_setup.rb
|