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 +4 -4
- data/README.md +1 -1
- data/lib/djoini/version.rb +1 -1
- data/lib/tasks/load.rake +19 -12
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b700f33baed8016b867a71927f601d31ec5e9d70
|
4
|
+
data.tar.gz: d26e380685d6218174267720999183cb4337325b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
104
|
+
Djoini.configure do |config|
|
105
105
|
config.fixtures_folder = 'path'
|
106
106
|
config.fixtures_type = 'ini/json/mixed'
|
107
107
|
end
|
data/lib/djoini/version.rb
CHANGED
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
|
-
|
19
|
-
_loader = Djoini::Files.new
|
31
|
+
fail unless File.file?(_db_config_path)
|
20
32
|
|
21
|
-
|
22
|
-
|
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
|