data_set 1.0.1 → 1.1.0

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: b580eff673ead5a85df7748f229391aae3e8dc76
4
- data.tar.gz: 2eaf514ca88b8717f83c3153cfa8964d10c314ae
3
+ metadata.gz: caa18f4d914cda971f5e591e08c0c464a48c120b
4
+ data.tar.gz: 2ca5ae69c875af99ddab7b734f891884490e4df4
5
5
  SHA512:
6
- metadata.gz: db7ca083500e5f5eaedd33de3ba84ea60a713254dda551d394642b0384ea34b07bc972059f36b28c68cec56201af5e60233f4e947e6e5d2c6bbd265222a9d26b
7
- data.tar.gz: bdf3f5cf3117ac4392ae10a855f3d88750ab6f41416e55cc87788e2d558bc2b196b650efc906621d4f9c53930461ee990be4e9084a1d251f1b8bcae9c0856407
6
+ metadata.gz: 9030f179a10cb4241af98e38d22950aaa8453b811dad50e342f9a231d96dc93ddc81ab66c5dd2dfa09eb5456770500ad5104a8429c70b521b999026d945fa714
7
+ data.tar.gz: d1e1f21aa566a99c9b742cc69cad0dac2d9d93c35f1b378dbb4d7d7f3567049109b271560413d8d7a855210a52844ad16ef3a6c47704a92b8c07864615b8811f
data/.hound.yml CHANGED
@@ -1,5 +1,6 @@
1
1
  AllCops:
2
2
  Exclude:
3
+ - features/step_definitions/**/*
3
4
  - data_set.gemspec
4
5
  - test/*.rb
5
6
  - spec/**/*
@@ -30,15 +31,15 @@ Style/SignalException:
30
31
  Enabled: false
31
32
 
32
33
  # This never works for validations.
33
- Style/AlignHash:
34
+ Layout/AlignHash:
34
35
  EnforcedLastArgumentHashStyle: ignore_implicit
35
36
 
36
37
  # Align multi-line params with previous line.
37
- Style/AlignParameters:
38
+ Layout/AlignParameters:
38
39
  EnforcedStyle: with_fixed_indentation
39
40
 
40
41
  # Indent `when` clause one step from `case`.
41
- Style/CaseIndentation:
42
+ Layout/CaseIndentation:
42
43
  IndentOneStep: true
43
44
 
44
45
  # Don't force bad var names for reduce/inject loops.
@@ -46,7 +47,7 @@ Style/SingleLineBlockParams:
46
47
  Enabled: false
47
48
 
48
49
  # For method chains, keep the dot with the method name.
49
- Style/DotPosition:
50
+ Layout/DotPosition:
50
51
  EnforcedStyle: leading
51
52
 
52
53
  # Stop nesting so hard.
@@ -60,3 +61,7 @@ Metrics/MethodLength:
60
61
  # Encourage fewer parameters.
61
62
  Metrics/ParameterLists:
62
63
  Max: 4
64
+
65
+ # Slightly higher cyclomatic complexity.
66
+ Metrics/CyclomaticComplexity:
67
+ Max: 7
data/Rakefile CHANGED
@@ -3,6 +3,7 @@ require "bundler/gem_tasks"
3
3
  require "rdoc/task"
4
4
  require "rubocop/rake_task"
5
5
  require "rspec/core/rake_task"
6
+ require "cucumber/rake/task"
6
7
 
7
8
  RuboCop::RakeTask.new
8
9
 
@@ -13,14 +14,20 @@ namespace :spec do
13
14
  end
14
15
 
15
16
  RSpec::Core::RakeTask.new(all: :clean) do |config|
16
- options = %w(--color)
17
- options += %w(--format documentation)
18
- options += %w(--format html --out spec/reports/unit-test-report.html)
17
+ options = %w[--color]
18
+ options += %w[--format documentation]
19
+ options += %w[--format html --out spec/reports/unit-test-report.html]
19
20
 
20
21
  config.rspec_opts = options
21
22
  end
22
23
  end
23
24
 
25
+ desc "Run all feature specs"
26
+ task :features do
27
+ Cucumber::Rake::Task.new(:features) do |t|
28
+ end
29
+ end
30
+
24
31
  Rake::RDocTask.new do |rdoc|
25
32
  rdoc.rdoc_dir = 'doc'
26
33
  rdoc.main = 'README.md'
@@ -28,4 +35,4 @@ Rake::RDocTask.new do |rdoc|
28
35
  rdoc.rdoc_files.include('README*', 'lib/**/*.rb')
29
36
  end
30
37
 
31
- task default: ['spec:all', :rubocop]
38
+ task default: ['spec:all', 'features', :rubocop]
@@ -0,0 +1 @@
1
+ base_url: 'http://testerstories.com'
@@ -0,0 +1,23 @@
1
+ base_url: 'http://testerstories.com'
2
+
3
+ login:
4
+ username: tester
5
+ password: testing
6
+
7
+ stardate:
8
+ contexts:
9
+ tos: the original series
10
+ tng: the next generation
11
+
12
+ port: 9292
13
+ euler_number: 2.718
14
+
15
+ truthhood: true
16
+ falsehood: false
17
+
18
+ symbolic: :symbol
19
+
20
+ invalid_conditions:
21
+ - only letters
22
+ - some letters
23
+ - less than four numbers
@@ -0,0 +1 @@
1
+ from_the_env: read from the env
@@ -24,6 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency "bundler", "~> 1.13"
25
25
  spec.add_development_dependency "rake", "~> 10.0"
26
26
  spec.add_development_dependency "rspec", "~> 3.0"
27
+ spec.add_development_dependency "cucumber", "~> 3.0"
27
28
  spec.add_development_dependency "rubocop"
28
29
  spec.add_development_dependency "pry"
29
30
 
@@ -7,6 +7,7 @@ module DataSet
7
7
  key = args.first
8
8
  value = @data_source[key.to_s]
9
9
  value = args[1] if value.nil?
10
+ value = yield(key.to_s) if value.nil? && block
10
11
  super if value.nil?
11
12
  value = DataSet::DataElement.new(value) unless type_known?(value)
12
13
  value
@@ -19,14 +20,19 @@ module DataSet
19
20
  def load_data_source
20
21
  @data_source = nil
21
22
  path = "#{data_path}/#{ENV['DATA_SET_FILE']}"
22
- @yml = YAML.load_file path if ENV['DATA_SET_FILE']
23
- DataSet.load('default.yml') if @data_set.nil?
23
+ if ENV['DATA_SET_FILE']
24
+ @data_source = ::YAML.safe_load(ERB.new(
25
+ File.read(path)
26
+ ).result(binding))
27
+ end
28
+ DataSet.load('default.yml') if @data_source.nil?
24
29
  end
25
30
 
26
31
  private
27
32
 
28
33
  def type_known?(value)
29
- known_types = [String, Integer, TrueClass, FalseClass, Symbol]
34
+ known_types = [String, Integer, TrueClass, FalseClass,
35
+ Symbol, Float, Array]
30
36
  known_types.any? { |type| value.is_a?(type) }
31
37
  end
32
38
  end
@@ -7,5 +7,9 @@ module DataSet
7
7
  def initialize(value)
8
8
  @data_source = value
9
9
  end
10
+
11
+ def to_hash
12
+ @data_source
13
+ end
10
14
  end
11
15
  end
@@ -1,3 +1,3 @@
1
1
  module DataSet
2
- VERSION = "1.0.1".freeze
2
+ VERSION = "1.1.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: data_set
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Nyman
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-27 00:00:00.000000000 Z
11
+ date: 2017-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: cucumber
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: rubocop
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -112,6 +126,9 @@ files:
112
126
  - Rakefile
113
127
  - bin/console
114
128
  - bin/setup
129
+ - data/default.yml
130
+ - data/yaml/test_data.yml
131
+ - data/yaml/test_sample.yml
115
132
  - data_set.gemspec
116
133
  - lib/data_set.rb
117
134
  - lib/data_set/data_accessor.rb
@@ -122,7 +139,7 @@ licenses:
122
139
  - MIT
123
140
  metadata: {}
124
141
  post_install_message: "\n(::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)\n
125
- \ DataSet 1.0.1 has been installed.\n(::) (::) (::) (::) (::) (::) (::) (::) (::)
142
+ \ DataSet 1.1.0 has been installed.\n(::) (::) (::) (::) (::) (::) (::) (::) (::)
126
143
  (::) (::) (::)\n "
127
144
  rdoc_options: []
128
145
  require_paths:
@@ -139,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
156
  version: '0'
140
157
  requirements: []
141
158
  rubyforge_project:
142
- rubygems_version: 2.6.10
159
+ rubygems_version: 2.6.13
143
160
  signing_key:
144
161
  specification_version: 4
145
162
  summary: Provides configuration specification and retrieval using YAML files.