spinning_wheel 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +75 -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/spinning_wheel.rb +32 -0
- data/lib/spinning_wheel/fabric.rb +35 -0
- data/lib/spinning_wheel/syntax.rb +17 -0
- data/lib/spinning_wheel/version.rb +3 -0
- data/spinning_wheel.gemspec +33 -0
- metadata +149 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 898b043353fda422c4c8f069954e83a0def2a5436027ec8161f15efdcccb1b3c
|
4
|
+
data.tar.gz: 2b9590e7f620ab5a6893faef4f6c9827b14aaa6d5b92bce7341c12e4c8293986
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4e16c81342527a7861c29ce98533f3de448a740ac1b05241a86ce55837cbcdb32cd24134af548343368bac989a35282a540aef5d4e70242abd8992a9574e51c2
|
7
|
+
data.tar.gz: 5e6edcc4debb99f38ff9ee0cc1e2e7e3453f463320b6e66a92d55c8fe20e2317e2eddebcddb478477fc8eec373c392a090a1ca19daeb898659ae5a8ff61c005f
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
spinning_wheel (0.1.0)
|
5
|
+
activesupport (~> 5.0, >= 5.0.0.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activesupport (5.2.3)
|
11
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
|
+
i18n (>= 0.7, < 2)
|
13
|
+
minitest (~> 5.1)
|
14
|
+
tzinfo (~> 1.1)
|
15
|
+
coderay (1.1.2)
|
16
|
+
concurrent-ruby (1.1.5)
|
17
|
+
diff-lcs (1.3)
|
18
|
+
equatable (0.5.0)
|
19
|
+
i18n (1.6.0)
|
20
|
+
concurrent-ruby (~> 1.0)
|
21
|
+
method_source (0.9.2)
|
22
|
+
minitest (5.11.3)
|
23
|
+
necromancer (0.4.0)
|
24
|
+
pastel (0.7.2)
|
25
|
+
equatable (~> 0.5.0)
|
26
|
+
tty-color (~> 0.4.0)
|
27
|
+
pry (0.12.2)
|
28
|
+
coderay (~> 1.1.0)
|
29
|
+
method_source (~> 0.9.0)
|
30
|
+
rake (10.5.0)
|
31
|
+
rspec (3.8.0)
|
32
|
+
rspec-core (~> 3.8.0)
|
33
|
+
rspec-expectations (~> 3.8.0)
|
34
|
+
rspec-mocks (~> 3.8.0)
|
35
|
+
rspec-core (3.8.0)
|
36
|
+
rspec-support (~> 3.8.0)
|
37
|
+
rspec-expectations (3.8.2)
|
38
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
39
|
+
rspec-support (~> 3.8.0)
|
40
|
+
rspec-mocks (3.8.0)
|
41
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
42
|
+
rspec-support (~> 3.8.0)
|
43
|
+
rspec-support (3.8.0)
|
44
|
+
thread_safe (0.3.6)
|
45
|
+
timers (4.3.0)
|
46
|
+
tty-color (0.4.3)
|
47
|
+
tty-cursor (0.6.1)
|
48
|
+
tty-prompt (0.18.1)
|
49
|
+
necromancer (~> 0.4.0)
|
50
|
+
pastel (~> 0.7.0)
|
51
|
+
timers (~> 4.0)
|
52
|
+
tty-cursor (~> 0.6.0)
|
53
|
+
tty-reader (~> 0.5.0)
|
54
|
+
tty-reader (0.5.0)
|
55
|
+
tty-cursor (~> 0.6.0)
|
56
|
+
tty-screen (~> 0.6.4)
|
57
|
+
wisper (~> 2.0.0)
|
58
|
+
tty-screen (0.6.5)
|
59
|
+
tzinfo (1.2.5)
|
60
|
+
thread_safe (~> 0.1)
|
61
|
+
wisper (2.0.0)
|
62
|
+
|
63
|
+
PLATFORMS
|
64
|
+
ruby
|
65
|
+
|
66
|
+
DEPENDENCIES
|
67
|
+
bundler (~> 1.16)
|
68
|
+
pry (~> 0.12.0)
|
69
|
+
rake (~> 10.0)
|
70
|
+
rspec (~> 3.0)
|
71
|
+
spinning_wheel!
|
72
|
+
tty-prompt (~> 0.18)
|
73
|
+
|
74
|
+
BUNDLED WITH
|
75
|
+
1.16.3
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Felix Langenegger
|
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
|
+
# SpinningWheel
|
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/spinning_wheel`. 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 'spinning_wheel'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install spinning_wheel
|
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]/spinning_wheel.
|
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 "spinning_wheel"
|
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
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'active_support/inflector'
|
2
|
+
|
3
|
+
spec = Gem::Specification.find_by_name("spinning_wheel")
|
4
|
+
gem_root = spec.gem_dir
|
5
|
+
|
6
|
+
Dir[File.join(gem_root, "lib", "spinning_wheel", "**/*.rb")].sort.each do |file|
|
7
|
+
require file
|
8
|
+
end
|
9
|
+
|
10
|
+
module SpinningWheel
|
11
|
+
|
12
|
+
@fabrics = Hash.new
|
13
|
+
|
14
|
+
def self.create(name)
|
15
|
+
@fabrics[name].build
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.register_fabric(fabric)
|
19
|
+
@fabrics[fabric.name] = fabric
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# def initialize(&block)
|
24
|
+
# instance_eval(&block)
|
25
|
+
# end
|
26
|
+
|
27
|
+
# def fabric(options, &block)
|
28
|
+
# fabric
|
29
|
+
# # fabric = SpinningWheel::Fabric.new(options)
|
30
|
+
# # object = fabric.create(&block)
|
31
|
+
# # register(fabric.name, object)
|
32
|
+
# end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module SpinningWheel
|
2
|
+
class Fabric
|
3
|
+
|
4
|
+
attr_reader :name, :class_name
|
5
|
+
|
6
|
+
def initialize(name:, class_name:, &block)
|
7
|
+
@name = name
|
8
|
+
@class_name = class_name
|
9
|
+
@attributes = {}
|
10
|
+
@block = block
|
11
|
+
end
|
12
|
+
|
13
|
+
def build
|
14
|
+
@klass = @class_name.constantize
|
15
|
+
instance_eval(&@block)
|
16
|
+
parameters = @klass.instance_method(:initialize).parameters
|
17
|
+
required_parametes = []
|
18
|
+
parameters.each do |parameter|
|
19
|
+
if parameter[0] == :req
|
20
|
+
required_parametes << parameter[1]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
if required_parametes == @attributes.keys
|
24
|
+
@klass.new(*@attributes.values)
|
25
|
+
else
|
26
|
+
@klass.new(**@attributes)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def method_missing(name, *args, &block)
|
31
|
+
@attributes[name] = block.call
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module SpinningWheel
|
2
|
+
def self.define(&block)
|
3
|
+
DSL.run(block)
|
4
|
+
end
|
5
|
+
|
6
|
+
class DSL
|
7
|
+
def self.run(block)
|
8
|
+
new.instance_eval(&block)
|
9
|
+
end
|
10
|
+
|
11
|
+
def fabric(name:, class_name:, &block)
|
12
|
+
fabric = SpinningWheel::Fabric.
|
13
|
+
new(name: name, class_name: class_name, &block)
|
14
|
+
SpinningWheel.register_fabric(fabric)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "spinning_wheel/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "spinning_wheel"
|
8
|
+
spec.version = SpinningWheel::VERSION
|
9
|
+
spec.authors = ["Felix Langenegger"]
|
10
|
+
spec.email = ["felix.langenegger@fadendaten.ch"]
|
11
|
+
|
12
|
+
spec.summary = %q{Write a short summary, because RubyGems requires one.}
|
13
|
+
spec.description = %q{Write a longer description or delete this line.}
|
14
|
+
spec.homepage = "https://fadendaten.ch"
|
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_runtime_dependency 'activesupport', '~> 5.0', '>= 5.0.0.0'
|
27
|
+
|
28
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
29
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
30
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
31
|
+
spec.add_development_dependency 'pry', '~> 0.12.0'
|
32
|
+
spec.add_development_dependency 'tty-prompt', '~> 0.18'
|
33
|
+
end
|
metadata
ADDED
@@ -0,0 +1,149 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: spinning_wheel
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Felix Langenegger
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-05-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - "~>"
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: '5.0'
|
19
|
+
- - ">="
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 5.0.0.0
|
22
|
+
name: activesupport
|
23
|
+
prerelease: false
|
24
|
+
type: :runtime
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '5.0'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 5.0.0.0
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - "~>"
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '1.16'
|
39
|
+
name: bundler
|
40
|
+
prerelease: false
|
41
|
+
type: :development
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '1.16'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - "~>"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '10.0'
|
53
|
+
name: rake
|
54
|
+
prerelease: false
|
55
|
+
type: :development
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '10.0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
requirement: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - "~>"
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '3.0'
|
67
|
+
name: rspec
|
68
|
+
prerelease: false
|
69
|
+
type: :development
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '3.0'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
requirement: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - "~>"
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: 0.12.0
|
81
|
+
name: pry
|
82
|
+
prerelease: false
|
83
|
+
type: :development
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: 0.12.0
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
requirement: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - "~>"
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0.18'
|
95
|
+
name: tty-prompt
|
96
|
+
prerelease: false
|
97
|
+
type: :development
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0.18'
|
103
|
+
description: Write a longer description or delete this line.
|
104
|
+
email:
|
105
|
+
- felix.langenegger@fadendaten.ch
|
106
|
+
executables: []
|
107
|
+
extensions: []
|
108
|
+
extra_rdoc_files: []
|
109
|
+
files:
|
110
|
+
- ".gitignore"
|
111
|
+
- ".rspec"
|
112
|
+
- ".travis.yml"
|
113
|
+
- Gemfile
|
114
|
+
- Gemfile.lock
|
115
|
+
- LICENSE.txt
|
116
|
+
- README.md
|
117
|
+
- Rakefile
|
118
|
+
- bin/console
|
119
|
+
- bin/setup
|
120
|
+
- lib/spinning_wheel.rb
|
121
|
+
- lib/spinning_wheel/fabric.rb
|
122
|
+
- lib/spinning_wheel/syntax.rb
|
123
|
+
- lib/spinning_wheel/version.rb
|
124
|
+
- spinning_wheel.gemspec
|
125
|
+
homepage: https://fadendaten.ch
|
126
|
+
licenses:
|
127
|
+
- MIT
|
128
|
+
metadata: {}
|
129
|
+
post_install_message:
|
130
|
+
rdoc_options: []
|
131
|
+
require_paths:
|
132
|
+
- lib
|
133
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
requirements: []
|
144
|
+
rubyforge_project:
|
145
|
+
rubygems_version: 2.7.6
|
146
|
+
signing_key:
|
147
|
+
specification_version: 4
|
148
|
+
summary: Write a short summary, because RubyGems requires one.
|
149
|
+
test_files: []
|