mushin 0.30.0 → 0.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/exe/mushin +13 -13
- data/lib/mushin/version.rb +1 -1
- metadata +2 -13
- data/showcases/gamification_showcase/README.md +0 -9
- data/showcases/gamification_showcase/gameon/lib/gameon/builtin/badges.rb +0 -0
- data/showcases/gamification_showcase/gameon/lib/gameon/version.rb +0 -0
- data/showcases/gamification_showcase/gameon/lib/gameon.rb +0 -9
- data/showcases/gamification_showcase/points/points.rb +0 -1
- data/showcases/gamification_showcase/sample_app/app.rb +0 -0
- data/showcases/gamification_showcase/sample_app/ext/levels/levels.rb +0 -0
- data/showcases/sample1.rb +0 -92
- data/showcases/sample2.rb +0 -246
- data/showcases/sample3.rb +0 -122
- data/showcases/torrents_showcase/README.md +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67f6d5ca7b7743915f7837048ac95dd94059075b
|
4
|
+
data.tar.gz: 9b58836195c3c215ae76f232cbed607b6c3bb66a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c1cb416afdc4a6f5880a38dbaaae16f192a820efefdbdf6aa62a8a561c2b715ad9009545abf363e720b70a89dff5e6195ff9ac410d90fcf4e85efb5de766d2c
|
7
|
+
data.tar.gz: 5f41c089c7fecf43d505688e7f90497b6edcd40c7c028a26db1eafdcf6761c12ff09d673749f925c29c06ab145ee3b499838ff2232c2e60a359dab2080a3ab3f
|
data/exe/mushin
CHANGED
@@ -33,7 +33,7 @@ module Mushin
|
|
33
33
|
def __print_version
|
34
34
|
info = set_color(" INFO ", :green, :on_white, :bold)
|
35
35
|
message = " Mushin " + Mushin::VERSION
|
36
|
-
|
36
|
+
puts (info + message)
|
37
37
|
end
|
38
38
|
|
39
39
|
desc "g", "Generates a DSF via `mushin g dsf` or DSF Ext via `mushin g ext`"
|
@@ -44,14 +44,14 @@ module Mushin
|
|
44
44
|
when "domain", "dsf"
|
45
45
|
info = set_color(" INFO ", :green, :on_white, :bold)
|
46
46
|
message = " Generating a Mushin Domain-specific Framework! "
|
47
|
-
|
47
|
+
puts (info + message)
|
48
48
|
|
49
|
-
dsf_name = ask(set_color("Mushin Domain-specific Framework Name : ", :bold))
|
49
|
+
dsf_name = ask(set_color("Mushin Domain-specific Framework Name : ", :bold))
|
50
50
|
dsf_name = "Mushin::" + dsf_name
|
51
|
-
dsf_summary = ask(set_color("Mushin Domain-specific Framework Summary : ", :bold))
|
52
|
-
dsf_description = ask(set_color("Mushin Domain-specific Framework Description : ", :bold))
|
53
|
-
dsf_homepage = ask(set_color("Mushin Domain-specific Framework Homepage : ", :bold))
|
54
|
-
dsf_license = ask(set_color("Mushin Domain-specific Framework License : ", :bold))
|
51
|
+
dsf_summary = ask(set_color("Mushin Domain-specific Framework Summary : ", :bold))
|
52
|
+
dsf_description = ask(set_color("Mushin Domain-specific Framework Description : ", :bold))
|
53
|
+
dsf_homepage = ask(set_color("Mushin Domain-specific Framework Homepage : ", :bold))
|
54
|
+
dsf_license = ask(set_color("Mushin Domain-specific Framework License : ", :bold))
|
55
55
|
|
56
56
|
seprator
|
57
57
|
Mushin::Generator.new.generate_dsf name: dsf_name, summary: dsf_summary, description: dsf_description, homepage: dsf_homepage, license: dsf_license
|
@@ -59,14 +59,14 @@ module Mushin
|
|
59
59
|
when "extension", "ext"
|
60
60
|
info = set_color(" INFO ", :green, :on_white, :bold)
|
61
61
|
message = " Generating a Mushin Extension! "
|
62
|
-
|
62
|
+
puts (info + message)
|
63
63
|
|
64
|
-
ext_name = ask(set_color("Mushin Extension Name : ", :bold))
|
64
|
+
ext_name = ask(set_color("Mushin Extension Name : ", :bold))
|
65
65
|
ext_name = "Mushin::" + ext_name
|
66
|
-
ext_summary = ask(set_color("Mushin Extension Summary : ", :bold))
|
67
|
-
ext_description = ask(set_color("Mushin Extension Description : ", :bold))
|
68
|
-
ext_homepage = ask(set_color("Mushin Extension Homepage : ", :bold))
|
69
|
-
ext_license = ask(set_color("Mushin Extension License : ", :bold))
|
66
|
+
ext_summary = ask(set_color("Mushin Extension Summary : ", :bold))
|
67
|
+
ext_description = ask(set_color("Mushin Extension Description : ", :bold))
|
68
|
+
ext_homepage = ask(set_color("Mushin Extension Homepage : ", :bold))
|
69
|
+
ext_license = ask(set_color("Mushin Extension License : ", :bold))
|
70
70
|
|
71
71
|
seprator
|
72
72
|
Mushin::Generator.new.generate_ext name: ext_name, summary: ext_summary, description: ext_description, homepage: ext_homepage, license: ext_license
|
data/lib/mushin/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mushin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.31.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zotherstupidguy
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -154,17 +154,6 @@ files:
|
|
154
154
|
- lib/mushin/test_helper.rb
|
155
155
|
- lib/mushin/version.rb
|
156
156
|
- mushin.gemspec
|
157
|
-
- showcases/gamification_showcase/README.md
|
158
|
-
- showcases/gamification_showcase/gameon/lib/gameon.rb
|
159
|
-
- showcases/gamification_showcase/gameon/lib/gameon/builtin/badges.rb
|
160
|
-
- showcases/gamification_showcase/gameon/lib/gameon/version.rb
|
161
|
-
- showcases/gamification_showcase/points/points.rb
|
162
|
-
- showcases/gamification_showcase/sample_app/app.rb
|
163
|
-
- showcases/gamification_showcase/sample_app/ext/levels/levels.rb
|
164
|
-
- showcases/sample1.rb
|
165
|
-
- showcases/sample2.rb
|
166
|
-
- showcases/sample3.rb
|
167
|
-
- showcases/torrents_showcase/README.md
|
168
157
|
homepage: http://mushin-rb.github.io/
|
169
158
|
licenses:
|
170
159
|
- MIT
|
@@ -1,9 +0,0 @@
|
|
1
|
-
Gamification
|
2
|
-
=============
|
3
|
-
|
4
|
-
This directory contains:
|
5
|
-
|
6
|
-
- GameOn: a sample mushin domain-specific framework for Gamification
|
7
|
-
- Badges: a sample built-in mushin extenstion for Gamification
|
8
|
-
- Points: a sample standalone mushin extenstion for Gamification
|
9
|
-
- SampleApp: a sample application using GameOn framework
|
File without changes
|
File without changes
|
@@ -1 +0,0 @@
|
|
1
|
-
# standalone mushin extenstion
|
File without changes
|
File without changes
|
data/showcases/sample1.rb
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
#require 'mushin'
|
2
|
-
require_relative './../lib/mushin'
|
3
|
-
#$log.level = Logger::WARN
|
4
|
-
module Sample
|
5
|
-
|
6
|
-
class TBP < Mushin::Test::Sample::Ext; end
|
7
|
-
class SSD < Mushin::Test::Sample::Ext; end
|
8
|
-
class SSDS < Mushin::Test::Sample::Ext
|
9
|
-
def call(env)
|
10
|
-
env ||= Hash.new
|
11
|
-
env[:shit] = "coool"
|
12
|
-
super
|
13
|
-
env[:superman_real_nameA] = "fouad"
|
14
|
-
return env
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
class SSDA < Mushin::Test::Sample::Ext
|
19
|
-
def call(env)
|
20
|
-
env ||= Hash.new
|
21
|
-
env[:nana] = "nana_what"
|
22
|
-
super
|
23
|
-
env[:superman_real_nameB] = "where are you now"
|
24
|
-
return env
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
|
29
|
-
class RUTracker < Mushin::Test::Sample::Ext; end
|
30
|
-
class Mongodb < Mushin::Test::Sample::Ext; end
|
31
|
-
|
32
|
-
|
33
|
-
class Domain < Mushin::Domain
|
34
|
-
# execution model
|
35
|
-
context 'torrent_bots' do
|
36
|
-
construct 'tpb' do
|
37
|
-
use ext: Sample::TBP, params: {}, opts: {"search_results" => :search_result_max}
|
38
|
-
use ext: Sample::SSD, params: {}, opts: {"ssd_path"=> :storage_path}
|
39
|
-
use ext: Sample::SSD, params: {}, opts: {"ssd_path"=> :storage_path}
|
40
|
-
use ext: Sample::SSD, params: {}, opts: {"ssd_path"=> :storage_path}
|
41
|
-
end
|
42
|
-
construct 'rutracker' do
|
43
|
-
use ext: Sample::RUTracker, params: {"search_results" => :search_result_max}
|
44
|
-
use ext: Sample::Mongodb, params: {"search_results" => :search_result_max}
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
# query model
|
49
|
-
query do
|
50
|
-
construct 'torrents' do
|
51
|
-
use ext: Sample::SSDS, params: {"seeders" => :seeders}, opts: {"ssd_path"=> :keyword}
|
52
|
-
use ext: Sample::SSDA, params: {"seeders" => :seeders}, opts: {"ssd_path"=> :keyword}
|
53
|
-
end
|
54
|
-
|
55
|
-
construct 'torrentsB' do
|
56
|
-
use ext: Sample::SSDS, params: {"seeders" => :seeders}, opts: {"ssd_path"=> :keyword}
|
57
|
-
use ext: Sample::SSDA, params: {"seeders" => :seeders}, opts: {"ssd_path"=> :keyword}
|
58
|
-
end
|
59
|
-
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
class App
|
64
|
-
def initialize
|
65
|
-
params = {}
|
66
|
-
params[:secret] = "8888"
|
67
|
-
|
68
|
-
domain = Domain.new do
|
69
|
-
torrent_bots do
|
70
|
-
tpb search_result_max: "20", storage_path:"crazypath_here"
|
71
|
-
rutracker search_result_max: params[:secret]
|
72
|
-
end
|
73
|
-
|
74
|
-
query do
|
75
|
-
torrents keyword: "shit", seeders: "30"
|
76
|
-
torrentsB keyword: "nononononon", seeders: "30"
|
77
|
-
end
|
78
|
-
|
79
|
-
end
|
80
|
-
|
81
|
-
p "kil"
|
82
|
-
p domain.torrents
|
83
|
-
p "ok this is the value that i want #{domain.torrentsB}"
|
84
|
-
p "kil"
|
85
|
-
|
86
|
-
#return domain.query :some_key # query somthing specific from the virtual domain datastore
|
87
|
-
return domain.store # returns the whole virtual domain datastore
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
Sample::App.new
|
data/showcases/sample2.rb
DELETED
@@ -1,246 +0,0 @@
|
|
1
|
-
module Mushin
|
2
|
-
# 1- an access method :context is defined in DSLBuilder(thats a module avialable as class methods to the domain class of the application.
|
3
|
-
# 2- the :context takes a name, &block and pass instance_eval it aganist an object created from DSLBuilder::Context
|
4
|
-
# 3- DSLBuilder::Context initialize takes a context_name say "torrent_bots" and create an app_context_klass and creates an access method with the :context_name inside DSL
|
5
|
-
#
|
6
|
-
module DSLBuilder
|
7
|
-
class Context
|
8
|
-
attr_accessor :context_name
|
9
|
-
# defines a DSL::Klass of type Context based on :name
|
10
|
-
# Supplies the defined DSL::Klass with a method of the construct
|
11
|
-
def initialize context_name, &block
|
12
|
-
@context_name = context_name.capitalize
|
13
|
-
|
14
|
-
app_context_klass = Class.new(Object) do
|
15
|
-
def initialize &block
|
16
|
-
instance_eval &block
|
17
|
-
end
|
18
|
-
end
|
19
|
-
# creates a context klass dynamically
|
20
|
-
DSL.const_set(context_name.capitalize, app_context_klass) unless DSL.const_defined?(context_name.capitalize)
|
21
|
-
# creates an access method inside DSL for the dynamically created context klass
|
22
|
-
DSL.send(:define_method, context_name) do |&block|
|
23
|
-
DSL.const_get(context_name.capitalize).new &block unless context_name.nil?
|
24
|
-
end
|
25
|
-
|
26
|
-
instance_eval &block
|
27
|
-
end
|
28
|
-
|
29
|
-
# access method for DSLBuilder::Construct klass inside a context object &block
|
30
|
-
def construct name, &block
|
31
|
-
app_context_klass = DSL.const_get(@context_name)
|
32
|
-
Construct.new(name, app_context_klass, &block) #.instance_eval &block
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
class Construct
|
37
|
-
attr_accessor :name, :stack, :app_context_klass
|
38
|
-
def initialize name, app_context_klass, &block
|
39
|
-
@name = name.capitalize
|
40
|
-
@middlewares = []
|
41
|
-
@stack = Mushin::Stack.new
|
42
|
-
@app_context_klass = app_context_klass
|
43
|
-
|
44
|
-
instance_eval &block
|
45
|
-
$log.info "middlewares after instance_eval"
|
46
|
-
$log.info middlewares = @middlewares
|
47
|
-
|
48
|
-
app_construct_klass = Class.new(Object) do
|
49
|
-
@@stack = Mushin::Stack.new
|
50
|
-
@@env = {}
|
51
|
-
@@ext_set = middlewares
|
52
|
-
$log.info "@@ext_set"
|
53
|
-
$log.info @@ext_set
|
54
|
-
|
55
|
-
attr_accessor :env
|
56
|
-
def initialize env = {}
|
57
|
-
@env = env
|
58
|
-
#p "merging #{@@env} with #{env_updates} for the result of #{env_updates.merge @@env}"
|
59
|
-
#p "domaindsl construct is ready to activate calling the stack with #{env}"
|
60
|
-
end
|
61
|
-
end # end of app_construct_klass
|
62
|
-
|
63
|
-
DSL.const_set(name.capitalize, app_construct_klass) unless DSL.const_defined?(name.capitalize)
|
64
|
-
# Reopens most recent context klass and add method `def construct_name params; app_construct_class.new(params)`
|
65
|
-
# access method for DSL::Construct dynamic klass inside a context object &block
|
66
|
-
DSL.const_get(@app_context_klass.to_s).send(:define_method, name) do |env|
|
67
|
-
# 1. populate :symbols inside opts and params with values from env
|
68
|
-
@@ext_set.each do |ext|
|
69
|
-
ext[:params].each do |key, value|
|
70
|
-
env.each do |env_key, env_value|
|
71
|
-
if env_key.to_sym == value then
|
72
|
-
ext[:params][key] = env_value
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
ext[:opts].each do |key, value|
|
78
|
-
env.each do |env_key, env_value|
|
79
|
-
if env_key.to_sym == value then
|
80
|
-
ext[:opts][key] = env_value
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
$log.info ext
|
85
|
-
end
|
86
|
-
# 2. insert
|
87
|
-
@@ext_set.each do |ext|
|
88
|
-
@@stack.insert_before 0, ext[:ext], ext[:opts], ext[:params]
|
89
|
-
end
|
90
|
-
# 3. call the stack
|
91
|
-
@@stack.call
|
92
|
-
|
93
|
-
DSL.const_get(name.capitalize).new env
|
94
|
-
end
|
95
|
-
#p DSL.constants
|
96
|
-
end
|
97
|
-
|
98
|
-
def use ext:, opts: {}, params: {}
|
99
|
-
@middlewares << {:ext => ext, :opts => opts, :params => params}
|
100
|
-
#p @middlewares
|
101
|
-
# @stack.insert_before 0, ext, opts, params
|
102
|
-
#@stack.call
|
103
|
-
#@stack = Use.new(ext, opts, params, @stack)
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
def context name, &block
|
108
|
-
Context.new(name, &block) #.instance_eval &block
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
module DSL
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
#self.singleton_class.send :remove_method, construct_key.to_sym
|
117
|
-
#self.singleton_class.send :remove_method, context_key.to_sym
|
118
|
-
#self.singleton_class.send :undef, context_key.to_sym
|
119
|
-
#
|
120
|
-
|
121
|
-
|
122
|
-
# tree is a set
|
123
|
-
# each context is a set
|
124
|
-
# each construct is a hash where construct_name is key, and [ext, params, opts] are array
|
125
|
-
#tree = [{:torrent_bots => [{:tpb => [["TPB", "params hash", "opts hash"], ["SSD", "params hash", "opts hash"]}]
|
126
|
-
|
127
|
-
|
128
|
-
=begin
|
129
|
-
module DSL
|
130
|
-
refine Class do
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
if Mushin::DSL.const_defined? @context_keyword.capitalize then
|
135
|
-
Mushin::DSL.const_set "#{@context_keyword.capitalize}", Module.new do
|
136
|
-
send :define_method, :build_dsl do |dsl_tree= @dsl_tree, &block|
|
137
|
-
p "passed the tree to the dsl_module #{dsl_tree}"
|
138
|
-
#p dsl_tree
|
139
|
-
end
|
140
|
-
end
|
141
|
-
else
|
142
|
-
p "prepend the module here"
|
143
|
-
end
|
144
|
-
|
145
|
-
=end
|
146
|
-
=begin
|
147
|
-
module DSL
|
148
|
-
def self.included base
|
149
|
-
base.class_eval do
|
150
|
-
#attr_accessor :keyword_array
|
151
|
-
def initialize &block
|
152
|
-
#@keyword_array = []
|
153
|
-
instance_eval &block
|
154
|
-
end
|
155
|
-
end
|
156
|
-
minis.each do |m|
|
157
|
-
p m
|
158
|
-
p m
|
159
|
-
p m
|
160
|
-
p m
|
161
|
-
base.send :include, m
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
def self.minis
|
166
|
-
constants.collect {|const_name| const_get(const_name)}.select {|const| const.class == Module}
|
167
|
-
end
|
168
|
-
end
|
169
|
-
=end
|
170
|
-
|
171
|
-
#NOTE can be Module.new("Mushin::DSL" + context_keyword.capitalize) to differeniate the minidsls dynamically added to an object in testing
|
172
|
-
#dsl_module = Module.new(Mushin::DSL) do
|
173
|
-
#end
|
174
|
-
#p context_keyword = @context_keyword
|
175
|
-
#p construct_keyword = @construct_keyword
|
176
|
-
|
177
|
-
=begin
|
178
|
-
def self.included base
|
179
|
-
base.class_eval do
|
180
|
-
attr_accessor :keyword_array
|
181
|
-
def initialize &block
|
182
|
-
@keyword_array = []
|
183
|
-
instance_eval &block
|
184
|
-
end
|
185
|
-
end
|
186
|
-
end
|
187
|
-
=end
|
188
|
-
|
189
|
-
=begin
|
190
|
-
#define_method construct_keyword do |&block|
|
191
|
-
#self.extend dsl
|
192
|
-
# instance_eval &block
|
193
|
-
# end
|
194
|
-
|
195
|
-
dsl.send :define_method, construct_keyword do |&block|
|
196
|
-
p "inside the instance construct #{self}"
|
197
|
-
p self
|
198
|
-
p self
|
199
|
-
end
|
200
|
-
|
201
|
-
define_method context_keyword do |&block|
|
202
|
-
p "inside the instance context #{self} with context_keyword #{context_keyword}"
|
203
|
-
instance_eval &block # self is the dsl module
|
204
|
-
end
|
205
|
-
=end
|
206
|
-
|
207
|
-
#dsl.send :define_method, @context_keyword do |&block|
|
208
|
-
# p self
|
209
|
-
# instance_eval &block
|
210
|
-
#end
|
211
|
-
|
212
|
-
#dsl.send
|
213
|
-
#self.class.send :define_method, @construct_keyword do |&block|
|
214
|
-
# instance_eval &block
|
215
|
-
#end
|
216
|
-
|
217
|
-
# alias_method + refinment + dynamically created module that is included(maybe that wouldn't be passed)
|
218
|
-
=begin
|
219
|
-
module DSL
|
220
|
-
def self.included base
|
221
|
-
base.class_eval do
|
222
|
-
def initialize &block
|
223
|
-
instance_eval &block
|
224
|
-
end
|
225
|
-
end
|
226
|
-
end
|
227
|
-
end
|
228
|
-
=end
|
229
|
-
#define_method @context_keyword do |&block|
|
230
|
-
#self.send :include, Mushin::DSL #self.send :prepend, Mushin::DSL
|
231
|
-
=begin
|
232
|
-
Mushin::DSL.send :define_method, @context_keyword do |&block|
|
233
|
-
p "inside the domain obj"
|
234
|
-
#self.class.send :define_method, construct_keyword do |&block|
|
235
|
-
#end
|
236
|
-
p self
|
237
|
-
p construct_keyword
|
238
|
-
p "....."
|
239
|
-
instance_eval &block
|
240
|
-
end
|
241
|
-
=end
|
242
|
-
#p "context #{@context_keyword} is defined in Mushin::DSL"
|
243
|
-
#Mushin::DSL.send :remove_method, @context_keyword
|
244
|
-
# Foo.instance_eval { undef :color }
|
245
|
-
# removed_method removes method of receiver class where as undef_method removed all methods from inherited class including receiver class.
|
246
|
-
#base.send :prepend, DSL
|
data/showcases/sample3.rb
DELETED
@@ -1,122 +0,0 @@
|
|
1
|
-
require_relative './../lib/mushin'
|
2
|
-
|
3
|
-
module Sample
|
4
|
-
class TBP < Mushin::Test::Sample::Ext; end
|
5
|
-
class SSD < Mushin::Test::Sample::Ext; end
|
6
|
-
|
7
|
-
class ExtA < Mushin::Test::Sample::Ext
|
8
|
-
def initialize(ext, opts = {}, params= {})
|
9
|
-
@ext = ext
|
10
|
-
@opts = opts
|
11
|
-
@params = params
|
12
|
-
end
|
13
|
-
|
14
|
-
def call(env)
|
15
|
-
env ||= Hash.new
|
16
|
-
p "XXXXXXXXX #{self}, params: #{@params} opts: #{@opts} XXXXXXXXXXXXXX"
|
17
|
-
|
18
|
-
env[:ExtA_params] = @params[:seeders]
|
19
|
-
env[:ExtA_opts] = @opts[:ssd_path]
|
20
|
-
@ext.call(env)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
class ExtB < Mushin::Test::Sample::Ext
|
25
|
-
def initialize(ext, opts = {}, params= {})
|
26
|
-
@ext = ext
|
27
|
-
@opts = opts
|
28
|
-
@params = params
|
29
|
-
end
|
30
|
-
|
31
|
-
def call(env)
|
32
|
-
env ||= Hash.new
|
33
|
-
p "XXXXXXXXX #{self}, params: #{@params} opts: #{@opts} XXXXXXXXXXXXXX"
|
34
|
-
|
35
|
-
env[:ExtB_opts] = @opts[:ssd_path]
|
36
|
-
env[:ExtB_params] = @params[:seeders]
|
37
|
-
@ext.call(env)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
class RUTracker < Mushin::Test::Sample::Ext
|
42
|
-
end
|
43
|
-
class Mongodb < Mushin::Test::Sample::Ext; end
|
44
|
-
|
45
|
-
class Domain
|
46
|
-
include Mushin::Domain
|
47
|
-
#extend Mushin::Domain
|
48
|
-
using Mushin::Domain
|
49
|
-
#extend Mushin::Main
|
50
|
-
|
51
|
-
context "torrent_bots" do
|
52
|
-
construct "tpb" do
|
53
|
-
use ext: Sample::TBP, params: {}, opts: {"search_results" => :search_result_max}
|
54
|
-
use ext: Sample::SSD, params: {}, opts: {"ssd_path"=> :storage_path}
|
55
|
-
end
|
56
|
-
|
57
|
-
construct "rutracker" do
|
58
|
-
use ext: RUTracker, params: {}, opts: {"search_results" => :search_result_max}
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
context "query" do
|
63
|
-
construct 'torrentsA' do
|
64
|
-
use ext: Sample::ExtA, params: {:seeders => :seeders_valueA}, opts: {:ssd_path => :path_valueA}
|
65
|
-
use ext: Sample::ExtB, params: {:seeders => :seeders_valueB}, opts: {:ssd_path => :path_valueB, :extra_default_key => :extra_default_value}
|
66
|
-
end
|
67
|
-
construct 'torrentsB' do
|
68
|
-
use ext: Sample::ExtA, params: {:seeders => :seeders_valueA}, opts: {:ssd_path => :path_valueA}
|
69
|
-
use ext: Sample::ExtB, params: {:seeders => :seeders_valueB}, opts: {:ssd_path => :path_valueB}
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
class App
|
75
|
-
mydomain = Domain.new do
|
76
|
-
params = {}
|
77
|
-
params[:secret] = "8888"
|
78
|
-
|
79
|
-
torrent_bots do
|
80
|
-
tpb search_result_max: "20", storage_path:"crazypath_here", store: "ssd"
|
81
|
-
rutracker search_result_max: params[:secret]
|
82
|
-
end
|
83
|
-
|
84
|
-
query do
|
85
|
-
torrentsA path_valueA: "this is a torrentsA pathvalueA", seeders_valueA: "30torrentA", path_valueB: "this is torrentsA pathvalueB", seeders_valueB: "30torrentB"
|
86
|
-
torrentsB path_valueA: "this is a torrentsB pathvalue", path_valueB: "koko", seeders_valueA: "30torrentA", seeders_valueB: "anna"
|
87
|
-
#torrentsB keyword: "torrentsB nononononon", seeders: "30"
|
88
|
-
end
|
89
|
-
|
90
|
-
#=begin
|
91
|
-
#TODO it 'must only accepts things for that had been defined'
|
92
|
-
#ss do
|
93
|
-
#end
|
94
|
-
#torrent_bots do
|
95
|
-
#TODO it 'must only accepts things for that had been defined'
|
96
|
-
#stpb do
|
97
|
-
#end
|
98
|
-
#tpb "this is good"
|
99
|
-
# tpb search_result_max: "202", storage_path:"crazypath_here2"
|
100
|
-
#end
|
101
|
-
|
102
|
-
#TODO it 'should be nested correctly"
|
103
|
-
#tpb "this is should be nested and shouldn't be allowed to work"
|
104
|
-
|
105
|
-
#ztorrent_bots do
|
106
|
-
# zrutracker search_result_max: params[:secret2]
|
107
|
-
# #zxy "god"
|
108
|
-
#end
|
109
|
-
#=end
|
110
|
-
end
|
111
|
-
#p "inspecting the domain object"
|
112
|
-
#p mydomain.methods
|
113
|
-
#p mydomain.inspect
|
114
|
-
#p mydomain.instance_variable_get("@xyz")
|
115
|
-
#p mydomain.store[:love]
|
116
|
-
#p mydomain.store[:xyz]
|
117
|
-
#p mydomain.store[:torrentsB][:nana]
|
118
|
-
#p mydomain.store[:torrentsC]
|
119
|
-
#p mydomain.store[:torrentsB]
|
120
|
-
p mydomain.store
|
121
|
-
end
|
122
|
-
end
|
@@ -1,6 +0,0 @@
|
|
1
|
-
This directory contains:
|
2
|
-
|
3
|
-
- ztorrents: a sample mushin domain-specific framework for searching torrent websites
|
4
|
-
- TPB: a sample built-in mushin extenstion for to search ThePirateBay
|
5
|
-
- RUTracker: a sample standalone mushin extenstion for ztorrents
|
6
|
-
- SampleApp: a sample application using ztorrents framework
|