seedify 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e30b80245438020aa56db7572c512e6ca73e7963
4
- data.tar.gz: 8305c4c190fa2b0b8a00ef283d84f2579a1842e0
3
+ metadata.gz: e30b412c681fb0bbe203e5f727f6e8fe07244899
4
+ data.tar.gz: 9e3756126a3fc222f419ef3c9fbb63388701ad80
5
5
  SHA512:
6
- metadata.gz: a4b44586fd7466317f4e6fff838e5daf8b4ecb8e05594edcba16ee7c9d407916031e9c751cef0c51e948077d7e730cc706bbaef1ad67182840f6ce3c24347d94
7
- data.tar.gz: fccdcef4b2ecc48aa17ac3910347fb51ee3fed97f7650a02813afab5d672bb9ab0b2d6b519de0a27f917e5a031e72c6c8f8979d97c64221737308c293ccebde6
6
+ metadata.gz: 240aa1ee3cf2dd37aaa612f63f4f1502d4e8502753e0ac3dc8d00754aa59601357e9ca690a97a66479bfc1372bb4ef6747dc1ad43a7b2024c9c9e761e7cf6ced
7
+ data.tar.gz: 3cb870b74192c11a3c0c8277ebe5524435280810de7efadd1ffe0b29b4ccf67fe0a5ef69098e85ca8985c4292d2816848b114d9879c8873a4024c1ff83351aa2
data/README.md CHANGED
@@ -4,6 +4,7 @@
4
4
  [![Downloads](https://img.shields.io/gem/dt/seedify.svg?style=flat-square)](https://rubygems.org/gems/seedify)
5
5
  [![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/visualitypl/seedify.svg?style=flat-square)](https://scrutinizer-ci.com/g/visualitypl/seedify/?branch=master)
6
6
  [![Code Climate](https://img.shields.io/codeclimate/github/visualitypl/seedify.svg?style=flat-square)](https://codeclimate.com/github/visualitypl/seedify)
7
+ [![Test Coverage](https://img.shields.io/codeclimate/coverage/github/visualitypl/seedify.svg?style=flat-square)](https://codeclimate.com/github/visualitypl/seedify)
7
8
 
8
9
  Let your seed code become a first-class member of the Rails app and put it into seed objects. **seedify** allows to implement and organize seeds in object-oriented fashion, putting them into `app/seeds` alongside the controllers, models etc. It also provides handy syntax for command line parameters and progress logging.
9
10
 
data/lib/seedify.rb CHANGED
@@ -1,7 +1,9 @@
1
- require 'seedify/railtie'
1
+ require 'active_support'
2
+
2
3
  require 'seedify/param_reader'
3
4
  require 'seedify/base'
4
5
  require 'seedify/logger'
5
6
  require 'seedify/storage'
6
7
  require 'seedify/param_value'
7
8
  require 'seedify/call_stack'
9
+ require 'seedify/railtie' if defined?(Rails)
data/lib/seedify/base.rb CHANGED
@@ -14,7 +14,7 @@ module Seedify
14
14
  end
15
15
 
16
16
  def self.params(overrides)
17
- stacked_params = (Seedify::CallStack.last.try(:params) || {}).merge(overrides)
17
+ stacked_params = ((last = Seedify::CallStack.last) ? last.params : {}).merge(overrides)
18
18
  defined_params = get_param_readers.map do |param_name, options|
19
19
  [param_name, Seedify::ParamValue.get(param_name, options)]
20
20
  end.to_h
@@ -25,7 +25,7 @@ module Seedify
25
25
  def get_type_casted_value(value, type)
26
26
  case type.to_s
27
27
  when 'boolean'
28
- value.to_s.in?(%{1 true})
28
+ %w{1 true}.include?(value.to_s)
29
29
  when 'integer'
30
30
  (value || 0).to_i
31
31
  else
@@ -6,8 +6,8 @@ module Seedify
6
6
  end
7
7
 
8
8
  def seed_list
9
- @all_seeds ||= Dir[seed_directory.join('**', '*_seed.rb')].map do |file|
10
- file.sub(/^#{seed_directory.to_s + "/"}/, '').sub(/#{".rb"}$/, '').classify
9
+ @all_seeds ||= Dir[File.join(seed_directory, '**', '*_seed.rb')].map do |file|
10
+ ActiveSupport::Inflector.classify(file.sub(/^#{seed_directory.to_s + "/"}/, '').sub(/#{".rb"}$/, ''))
11
11
  end
12
12
  end
13
13
 
@@ -1,3 +1,3 @@
1
1
  module Seedify
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seedify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karol Słuszniak
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0.9'
97
+ - !ruby/object:Gem::Dependency
98
+ name: activesupport
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '3.0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '3.0'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: rails
99
113
  requirement: !ruby/object:Gem::Requirement