mockolate 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +35 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/mockolate.rb +11 -0
- data/lib/mockolate/parameters.rb +15 -0
- data/lib/mockolate/parameters/attributes.rb +15 -0
- data/lib/mockolate/parameters/attributes/macros.rb +35 -0
- data/lib/mockolate/parameters/attributes/parser.rb +30 -0
- data/lib/mockolate/parameters/attributes/types.rb +21 -0
- data/lib/mockolate/parameters/generator.rb +15 -0
- data/lib/mockolate/parameters/hooks.rb +28 -0
- data/lib/mockolate/version.rb +5 -0
- data/mockolate.gemspec +29 -0
- metadata +105 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: af8d46e40e4912a888bd6e2fc702d57855588736f628e1b72fe8496423dadc11
|
4
|
+
data.tar.gz: 7677af9ed20ef12cbd2d16b3589bbb3ee38557882ce1b3b6581d406d54497f18
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 02ee6e2d51b825eaac270d50b51aa21e01529227fe0dbf700fc19f072d80711775faaa09a17692e8f9bd047ce699755a081f719383d7c34108790b081531726a
|
7
|
+
data.tar.gz: 50b2edfa9071d1778bad47e69794d588cec66aa343e58aeb1fa40cf2a391f322a779b25d23182dba15bbec81b9fd169fb9fc0502e39706f32a9fa844b7666f7f
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
mockolate (0.0.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
diff-lcs (1.3)
|
10
|
+
rake (10.5.0)
|
11
|
+
rspec (3.9.0)
|
12
|
+
rspec-core (~> 3.9.0)
|
13
|
+
rspec-expectations (~> 3.9.0)
|
14
|
+
rspec-mocks (~> 3.9.0)
|
15
|
+
rspec-core (3.9.0)
|
16
|
+
rspec-support (~> 3.9.0)
|
17
|
+
rspec-expectations (3.9.0)
|
18
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
19
|
+
rspec-support (~> 3.9.0)
|
20
|
+
rspec-mocks (3.9.0)
|
21
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
22
|
+
rspec-support (~> 3.9.0)
|
23
|
+
rspec-support (3.9.0)
|
24
|
+
|
25
|
+
PLATFORMS
|
26
|
+
ruby
|
27
|
+
|
28
|
+
DEPENDENCIES
|
29
|
+
bundler (~> 2.0)
|
30
|
+
mockolate!
|
31
|
+
rake (~> 10.0)
|
32
|
+
rspec (~> 3.0)
|
33
|
+
|
34
|
+
BUNDLED WITH
|
35
|
+
2.0.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Farhad
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# mockolate
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/mockolate`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'mockolate'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install mockolate
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/mockolate.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "mockolate"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/mockolate.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "mockolate/parameters/generator"
|
4
|
+
require "mockolate/parameters/attributes"
|
5
|
+
require "mockolate/parameters/hooks"
|
6
|
+
|
7
|
+
class Mockolate::Parameters
|
8
|
+
# include Mockolate::Parameters::Generator
|
9
|
+
# include Mockolate::Parameters::Attributes
|
10
|
+
include Mockolate::Parameters::Hooks
|
11
|
+
|
12
|
+
def self.inherited(base)
|
13
|
+
initialize!(base)
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "mockolate/parameters/attributes/macros"
|
4
|
+
|
5
|
+
class Mockolate::Parameters
|
6
|
+
module Attributes
|
7
|
+
include Mockolate::Parameters::Attributes::Macros
|
8
|
+
# def self.included(base)
|
9
|
+
# # base.include Mockolate::Parameters::Attributes::Macros
|
10
|
+
# end
|
11
|
+
|
12
|
+
# module ClassMethods
|
13
|
+
# end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "mockolate/parameters/attributes/parser"
|
4
|
+
|
5
|
+
module Mockolate::Parameters::Attributes
|
6
|
+
# This module includes main macros definitions
|
7
|
+
module Macros
|
8
|
+
def self.included(base)
|
9
|
+
base.extend ClassMethods
|
10
|
+
end
|
11
|
+
|
12
|
+
module ClassMethods
|
13
|
+
include Mockolate::Parameters::Attributes::Parser
|
14
|
+
|
15
|
+
# Handles single attribute which may have constant values
|
16
|
+
# @param attr [String] key of attribute
|
17
|
+
# @yield block
|
18
|
+
def attribute(attr, &block)
|
19
|
+
parse!(attr, &block)
|
20
|
+
# class_variable_get(:@@_public_attributes).merge
|
21
|
+
end
|
22
|
+
|
23
|
+
# Handles multiple attributes
|
24
|
+
# @param attrs [Array<String>] key of attribute
|
25
|
+
def attributes(*attrs)
|
26
|
+
parse!(attrs)
|
27
|
+
# attr.each do |attr|
|
28
|
+
# return parse_hash(attr) if attr.is_a? Hash
|
29
|
+
# parse_symbol
|
30
|
+
# end
|
31
|
+
# class_variable_get(:@@_public_attributes).push *attrs
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "mockolate/parameters/attributes/types"
|
4
|
+
|
5
|
+
module Mockolate::Parameters::Attributes
|
6
|
+
module Parser
|
7
|
+
include Mockolate::Parameters::Attributes::Types
|
8
|
+
|
9
|
+
def parse!(obj, &block)
|
10
|
+
return _parse_attribute_from_symbol(obj, &block) if obj.kind_of? Symbol
|
11
|
+
return _parse_attributes_from_array(obj) if obj.kind_of? Array
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
def _parse_attributes_from_array(attrs)
|
16
|
+
attrs.map do |attr|
|
17
|
+
_parse_attribute_from_symbol(attr)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def _parse_attribute_from_symbol(sym, type = :string, &block)
|
22
|
+
return yield if block_given?
|
23
|
+
|
24
|
+
class_variable_get(:@@_public_attributes).merge!({sym => method(type).call(sym)})
|
25
|
+
end
|
26
|
+
|
27
|
+
def _parse_attribute_from_hash(obj)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mockolate::Parameters::Attributes
|
4
|
+
module Types
|
5
|
+
def string(name)
|
6
|
+
# class_variable_get(:@@_public_attributes).merge!(
|
7
|
+
{value: '', type: :string}
|
8
|
+
# )
|
9
|
+
end
|
10
|
+
|
11
|
+
def integer(name)
|
12
|
+
class_variable_get(:@@_public_attributes).merge!(
|
13
|
+
name.to_sym => {value: 0, type: :integer}
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
# def type_hander(&block)
|
18
|
+
|
19
|
+
# end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# frozen_string_literal: true
|
4
|
+
|
5
|
+
class Mockolate::Parameters
|
6
|
+
module Hooks
|
7
|
+
def self.included(base)
|
8
|
+
base.extend ClassInitializers
|
9
|
+
end
|
10
|
+
|
11
|
+
module ClassInitializers
|
12
|
+
# Function runs after a class inherited from Mockolate::Parameters
|
13
|
+
# @params [Class] class to override
|
14
|
+
def initialize!(base)
|
15
|
+
base.class_eval do
|
16
|
+
# Included modules
|
17
|
+
include Mockolate::Parameters::Attributes::Macros
|
18
|
+
# include Mockolate::Parameters::Generator
|
19
|
+
# include Mockolate::Parameters::Attributes
|
20
|
+
|
21
|
+
# class variables and attributes
|
22
|
+
class_variable_set :@@_public_attributes, {}
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
data/mockolate.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "mockolate/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "mockolate"
|
8
|
+
spec.version = Mockolate::VERSION
|
9
|
+
spec.authors = ["Farhad"]
|
10
|
+
spec.email = ["farhad9801@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Like chocolate, but, way sweeter}
|
13
|
+
spec.description = %q{Multi purpose mock, dummy objects, dummy responses generator library}
|
14
|
+
# spec.homepage = "TODO: Put your gem's website or public repo URL here."
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Specify which files should be added to the gem when it is released.
|
18
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
19
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
20
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
|
+
end
|
22
|
+
spec.bindir = "exe"
|
23
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
|
+
spec.require_paths = ["lib"]
|
25
|
+
|
26
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
27
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
28
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mockolate
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Farhad
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-12-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
description: Multi purpose mock, dummy objects, dummy responses generator library
|
56
|
+
email:
|
57
|
+
- farhad9801@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- ".travis.yml"
|
65
|
+
- Gemfile
|
66
|
+
- Gemfile.lock
|
67
|
+
- LICENSE.txt
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
70
|
+
- bin/console
|
71
|
+
- bin/setup
|
72
|
+
- lib/mockolate.rb
|
73
|
+
- lib/mockolate/parameters.rb
|
74
|
+
- lib/mockolate/parameters/attributes.rb
|
75
|
+
- lib/mockolate/parameters/attributes/macros.rb
|
76
|
+
- lib/mockolate/parameters/attributes/parser.rb
|
77
|
+
- lib/mockolate/parameters/attributes/types.rb
|
78
|
+
- lib/mockolate/parameters/generator.rb
|
79
|
+
- lib/mockolate/parameters/hooks.rb
|
80
|
+
- lib/mockolate/version.rb
|
81
|
+
- mockolate.gemspec
|
82
|
+
homepage:
|
83
|
+
licenses:
|
84
|
+
- MIT
|
85
|
+
metadata: {}
|
86
|
+
post_install_message:
|
87
|
+
rdoc_options: []
|
88
|
+
require_paths:
|
89
|
+
- lib
|
90
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
requirements: []
|
101
|
+
rubygems_version: 3.0.6
|
102
|
+
signing_key:
|
103
|
+
specification_version: 4
|
104
|
+
summary: Like chocolate, but, way sweeter
|
105
|
+
test_files: []
|