edgarj 0.01.19 → 0.01.20

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: f7dcfccb2029b1dc2b66cef4128f66f46ebdec25
4
- data.tar.gz: c9d75de9e737a204e8156e83c3d7d2c94c4d26fe
3
+ metadata.gz: 833876d738a4dc3b3cfee8d7efcfa9508c919dd3
4
+ data.tar.gz: 07c2604cc87942816f9192f48b06cea521164c21
5
5
  SHA512:
6
- metadata.gz: 2dd21b30f123b201fc72283fd9ab3403ce8041b05afe70e296e0430a6db73e4d9ccd16d3fae60ec0f5fd2adc95fce9f5d02f05cf9e4e046e37c17f1fb4d1eafc
7
- data.tar.gz: bdd1cd446d5d0677aef030079b7b868ef32e1460338b943ecabaec552ab33544da7ace552f87d66143225c3f067d4b4ff6d148677567b1fc5284597b3819505c
6
+ metadata.gz: 23fd1a75c050a3080a00fef62a777c2af74595e6d96bb694395e8cc773515045dba4a68362b3a5ad349339056657d95bd77fe16d3844d1de1469fe12b22a16f9
7
+ data.tar.gz: 411a8e75d0d93849a5447eb337ad623e40cc9e63f8f50fba16864895df36d7da13a57408e7e6c4ac883b0e97b4e67f5e88eeddaf50c1a256caa3404c978802cb
data/config/settings.yml CHANGED
@@ -3,3 +3,4 @@ edgarj:
3
3
  time_zone_for_timestamp_comparison: '9'
4
4
  work_dir: <%= Rails.root + 'tmp/edgarj' %>
5
5
  csv_dir: <%= Rails.root + 'tmp/edgarj/csv_download' %>
6
+ _overwrite_test: 'hello'
@@ -0,0 +1,10 @@
1
+ module RailsConfig
2
+ class Options < OpenStruct
3
+ def prepend_source!(source)
4
+ source = (Sources::YAMLSource.new(source)) if source.is_a?(String)
5
+
6
+ @config_sources ||= []
7
+ @config_sources.prepend(source)
8
+ end
9
+ end
10
+ end
data/lib/edgarj/engine.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  module Edgarj
2
2
  class Engine < ::Rails::Engine
3
+ require 'rails_config'
4
+ require 'core_ext/rails_config'
3
5
  require 'core_ext/active_record'
4
6
  require 'core_ext/resources'
5
7
  require 'edgarj/enum_cache'
@@ -12,8 +14,8 @@ module Edgarj
12
14
  # (rails_config default loads from only Rails.root/config/...)
13
15
  def self.load_config
14
16
  engine_config_dir = Pathname.new(File.expand_path('../../../config', __FILE__))
15
- Settings.add_source!((engine_config_dir + 'settings.yml').to_s)
16
- Settings.add_source!((engine_config_dir + "settings/#{Rails.env}.yml").to_s)
17
+ Settings.prepend_source!((engine_config_dir + 'settings.yml').to_s)
18
+ Settings.prepend_source!((engine_config_dir + "settings/#{Rails.env}.yml").to_s)
17
19
  Settings.reload!
18
20
  end
19
21
 
@@ -1,3 +1,3 @@
1
1
  module Edgarj
2
- VERSION = "0.01.19"
2
+ VERSION = "0.01.20"
3
3
  end
@@ -0,0 +1,5 @@
1
+ edgarj:
2
+ _overwrite_test: 'HELLO WORLD'
3
+
4
+ dummy_app:
5
+ hello: 'Hello, World'
@@ -0,0 +1,14 @@
1
+ require 'test_helper'
2
+
3
+ class AuthorTest < ActiveSupport::TestCase
4
+ test 'settings' do
5
+ # test rails-app settings
6
+ assert_equal 'Hello, World', Settings.dummy_app.hello
7
+
8
+ # test Edgarj's settings
9
+ assert_equal (Rails.root + 'tmp/edgarj/csv_download').to_s, Settings.edgarj.csv_dir.to_s
10
+
11
+ # test overritten Edgarj's settings by rails-app
12
+ assert_equal 'HELLO WORLD', Settings.edgarj._overwrite_test
13
+ end
14
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: edgarj
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.01.19
4
+ version: 0.01.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fuminori Ido
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-15 00:00:00.000000000 Z
11
+ date: 2014-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -275,6 +275,7 @@ files:
275
275
  - db/migrate/20140206222308_create_edgar_model_permissions.rb
276
276
  - db/migrate/20141209053055_rename_edgar_to_edgarj.rb
277
277
  - lib/core_ext/active_record.rb
278
+ - lib/core_ext/rails_config.rb
278
279
  - lib/core_ext/resources.rb
279
280
  - lib/edgarj.rb
280
281
  - lib/edgarj/engine.rb
@@ -339,6 +340,7 @@ files:
339
340
  - test/dummy/config/locales/en.yml
340
341
  - test/dummy/config/locales/ja.yml
341
342
  - test/dummy/config/routes.rb
343
+ - test/dummy/config/settings.yml
342
344
  - test/dummy/db/migrate/20131107120635_create_authors.rb
343
345
  - test/dummy/db/migrate/20131218011851_create_books.rb
344
346
  - test/dummy/db/migrate/20140201000000_add_user_group_id_to_authors.rb
@@ -354,6 +356,7 @@ files:
354
356
  - test/dummy/test/helpers/authors_helper_test.rb
355
357
  - test/dummy/test/unit/author_test.rb
356
358
  - test/dummy/test/unit/book_test.rb
359
+ - test/dummy/test/unit/rails_config_test.rb
357
360
  - test/edgar_test.rb
358
361
  - test/fixtures/authors.yml
359
362
  - test/fixtures/books.yml
@@ -451,6 +454,7 @@ test_files:
451
454
  - test/dummy/config/initializers/strong_parameter.rb
452
455
  - test/dummy/config/initializers/session_store.rb
453
456
  - test/dummy/config/routes.rb
457
+ - test/dummy/config/settings.yml
454
458
  - test/dummy/config/database.yml
455
459
  - test/dummy/config/boot.rb
456
460
  - test/dummy/public/favicon.ico
@@ -464,6 +468,7 @@ test_files:
464
468
  - test/dummy/db/migrate/20140201000000_add_user_group_id_to_authors.rb
465
469
  - test/dummy/db/migrate/20140807065420_create_users.rb
466
470
  - test/dummy/test/unit/author_test.rb
471
+ - test/dummy/test/unit/rails_config_test.rb
467
472
  - test/dummy/test/unit/book_test.rb
468
473
  - test/dummy/test/functional/books_controller_test.rb
469
474
  - test/dummy/test/functional/authors_controller_test.rb