subroutine-factory 0.1.6 → 0.1.7

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
- SHA1:
3
- metadata.gz: 24d648affb53fc86b2f122467fd39622e4cb24ce
4
- data.tar.gz: 1b240333481df189a3b021fcde9df9d7bef49394
2
+ SHA256:
3
+ metadata.gz: 1b14771d9c6ef402e75be72a97d4fe69e39c62dd17a73313db4ff2ba0ca94ff8
4
+ data.tar.gz: 302c8b922d9f59957637c3698f5f4707a6e08155a610d5e19747272e0bcad993
5
5
  SHA512:
6
- metadata.gz: 5d074064071df20e58c74bc13d311a8e00fb0efbd68d6b0e9adc06be52068c127e4244a5d8954c319e0da0e1a969a5022ba97e6916d3dc46b366710e26eab458
7
- data.tar.gz: 6545d9a5c54172aa307b5b1fe2d6bad11901800d21d7cd926d1a534f4ab346aa160f0f01c1e0e744183cad906d2b3fbb68116223399d90078e1991e6f8409db5
6
+ metadata.gz: ce4b512c59cae0c7526a78e15ef5f38a7d5ddc9f6a4064fd814c3503e9234065724f355bd94765df7490c53014ac86bad28c03feb4a7c2817e8d084d08215faa
7
+ data.tar.gz: 9928f39fc0498d13806f9212a4de3343051d542f67ed449b1a8a20578e06bf22ce198153271da02f873e705b0f67f6327c0718a7bb9985525dd0ce05587f985c
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.5.1
data/.travis.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  language: ruby
2
2
 
3
3
  rvm:
4
- - 2.1.1
4
+ - 2.5.1
@@ -5,6 +5,7 @@ module Subroutine
5
5
  class Config
6
6
 
7
7
  delegate :sequence, to: "::Subroutine::Factory"
8
+ delegate :random, to: "::Subroutine::Factory"
8
9
 
9
10
  attr_reader :options
10
11
 
@@ -1,5 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Subroutine
2
4
  module Factory
3
- VERSION = "0.1.6"
5
+
6
+ VERSION = "0.1.7"
7
+
4
8
  end
5
9
  end
@@ -1,4 +1,7 @@
1
- require 'subroutine'
1
+ # frozen_string_literal: true
2
+
3
+ require "securerandom"
4
+ require "subroutine"
2
5
  require "subroutine/factory/version"
3
6
  require "subroutine/factory/config"
4
7
  require "subroutine/factory/builder"
@@ -29,7 +32,8 @@ module Subroutine
29
32
  def self.get_config!(name)
30
33
  config = get_config(name)
31
34
  raise "Unknown Subroutine::Factory `#{name}`" unless config
32
- return config
35
+
36
+ config
33
37
  end
34
38
 
35
39
  def self.create(name, *args)
@@ -47,15 +51,26 @@ module Subroutine
47
51
 
48
52
  def self.sequence(&lambda)
49
53
  if block_given?
50
- Proc.new{|*options|
54
+ proc do |*options|
51
55
  @@sequence += 1
52
56
  lambda.call(*[@@sequence, *options].compact)
53
- }
57
+ end
54
58
  else
55
59
  @@sequence += 1
56
60
  end
57
61
  end
58
62
 
63
+ def self.random(length: 8, &lambda)
64
+ if block_given?
65
+ proc do |*options|
66
+ x = ::SecureRandom.hex[0...length]
67
+ lambda.call(*[x, *options].compact)
68
+ end
69
+ else
70
+ ::SecureRandom.hex[0...length]
71
+ end
72
+ end
73
+
59
74
  def self.set_sequence(n)
60
75
  @@sequence = n
61
76
  end
@@ -30,8 +30,8 @@ Gem::Specification.new do |spec|
30
30
  spec.add_dependency "subroutine"
31
31
  spec.add_dependency "activesupport", ">= 3.0"
32
32
 
33
- spec.add_development_dependency "bundler", "~> 1.10"
34
- spec.add_development_dependency "rake", "~> 10.0"
33
+ spec.add_development_dependency "bundler"
34
+ spec.add_development_dependency "rake"
35
35
  spec.add_development_dependency "minitest"
36
36
  spec.add_development_dependency "minitest-reporters"
37
37
 
metadata CHANGED
@@ -1,97 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: subroutine-factory
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Nelson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-06-08 00:00:00.000000000 Z
11
+ date: 2019-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: subroutine
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '3.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '1.10'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '1.10'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '10.0'
61
+ version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '10.0'
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: minitest
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: minitest-reporters
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  description: Test factories for ops using Subroutine Ops
@@ -101,8 +101,9 @@ executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
- - .gitignore
105
- - .travis.yml
104
+ - ".gitignore"
105
+ - ".ruby-version"
106
+ - ".travis.yml"
106
107
  - Gemfile
107
108
  - LICENSE.txt
108
109
  - README.md
@@ -126,17 +127,17 @@ require_paths:
126
127
  - lib
127
128
  required_ruby_version: !ruby/object:Gem::Requirement
128
129
  requirements:
129
- - - '>='
130
+ - - ">="
130
131
  - !ruby/object:Gem::Version
131
132
  version: '0'
132
133
  required_rubygems_version: !ruby/object:Gem::Requirement
133
134
  requirements:
134
- - - '>='
135
+ - - ">="
135
136
  - !ruby/object:Gem::Version
136
137
  version: '0'
137
138
  requirements: []
138
139
  rubyforge_project:
139
- rubygems_version: 2.0.14.1
140
+ rubygems_version: 2.7.7
140
141
  signing_key:
141
142
  specification_version: 4
142
143
  summary: Test factories for ops using Subroutine Ops