djoini 0.1.7 → 0.1.8

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: a9f9dcce9a2cea1657efbb11e8c3ad0a27c93b21
4
- data.tar.gz: 5cc72c0b04dbd0fa902eb8874af83ad367290a7f
3
+ metadata.gz: b700f33baed8016b867a71927f601d31ec5e9d70
4
+ data.tar.gz: d26e380685d6218174267720999183cb4337325b
5
5
  SHA512:
6
- metadata.gz: 3bfd808f9adc29ef62bb575b405895eec3e06b10f085c291f06089885f70be270f8a01c88324fa01c6af742c33d4ecd02c77dad20e8d71b1310382a1018d6b2d
7
- data.tar.gz: d7eee8957d3788e1e796187eb322b3f4be27650c89dab67881c6f471e996c4ab6bbfb10c99ca66e7ae684c90dc50c4b1aa1adb10d2b27c8dc7b3d3219d75b3c2
6
+ metadata.gz: 7761346fc6c2e014235a29c3a42b223a139ad7555c37ebdd1a573e19770c1ccea542ea18121ef0c1bf7c3dad4d29a501614527040fa879a7d59994a1487628a9
7
+ data.tar.gz: d3cae05b55ae0aa9eef74732cc18613d897baa8a1082f86c6cac6bad4778a1b01d243db516550a26e5c763885e60d08f033a220df1feb9e04f0f00bb0d449530
data/README.md CHANGED
@@ -101,7 +101,7 @@ bundle exec rake djoini:load type=ini
101
101
  To specify location of fixtures use configuration module:
102
102
 
103
103
  ```ruby
104
- Djoini.config do |config|
104
+ Djoini.configure do |config|
105
105
  config.fixtures_folder = 'path'
106
106
  config.fixtures_type = 'ini/json/mixed'
107
107
  end
@@ -1,3 +1,3 @@
1
1
  module Djoini
2
- VERSION = '0.1.7'
2
+ VERSION = '0.1.8'
3
3
  end
data/lib/tasks/load.rake CHANGED
@@ -4,26 +4,33 @@ namespace :djoini do
4
4
  task :load do |_, args|
5
5
  require_relative '../djoini'
6
6
 
7
+ load_configuration
8
+
9
+ load_database
10
+
11
+ _loader = Djoini::Files.new
12
+
13
+ _type = args[:type] || Djoini.configuration.fixtures_type
14
+
15
+ _loader.load_files(_type)
16
+ end
17
+
18
+ def load_configuration
7
19
  _config_path = File.join(Dir.pwd, '/config/initializers/djoini.rb')
20
+
8
21
  require _config_path if File.file?(_config_path)
9
22
  # To make sure configure was called if initializer wasn't found
10
23
  Djoini.configure {}
24
+ end
11
25
 
26
+ def load_database
12
27
  require 'yaml'
28
+
13
29
  _db_config_path = File.join(Dir.pwd, '/config/database.yml')
14
- fail unless File.file?(_db_config_path)
15
- _conn_info = YAML.load(File.read(_db_config_path))
16
- Djoini::Connection.instance.establish_connection(_conn_info['postgres'])
17
30
 
18
- # Path taken from configuration
19
- _loader = Djoini::Files.new
31
+ fail unless File.file?(_db_config_path)
20
32
 
21
- if args[:type] == 'ini' || Djoini.configuration.fixtures_type == 'ini'
22
- _loader.load_files('ini')
23
- elsif args[:type] == 'json' || Djoini.configuration.fixtures_type == 'json'
24
- _loader.load_files('json')
25
- else
26
- _loader.load_files
27
- end
33
+ _conn_config = YAML.load(File.read(_db_config_path))
34
+ Djoini::Connection.instance.establish_connection(_conn_config['postgres'])
28
35
  end
29
36
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: djoini
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - faul