mushin 0.0.0.pre94 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 173b049e2e256622d7aa4445dfcf79ea967b6fbc
4
- data.tar.gz: 297aa258200c1c26cbfb2aaef4f197da52306f3d
3
+ metadata.gz: f0e88288b1562a69301bdd27ce84b1ebbf34669d
4
+ data.tar.gz: 6223db5afb53ab8a6dc8cd2b32e94a5739166685
5
5
  SHA512:
6
- metadata.gz: a8ed502492200450ad67c22b93b78aee42e74017ba6d7f80f1a2f0775cd18ff4813131728de1a1b26e7656f4c00e2d5f1620ae9d382e16c8efa3f12a7be12043
7
- data.tar.gz: ea16155207c863b948276c159a3c2fc034f85ceacb36a60f9e8da80f6bdf86d8314e6a9e3e5ddf174ce853126cc9d6d5b57f75e3f254b65492147a0d0d32d5fc
6
+ metadata.gz: 88d3ef94d3cd205f21764a498729d8b8f21e87a8308ff34e55e0b77af00f5a470a93927232a6eee564a2a5b1844c80e5af9d82481a26db992b6b6d6c3577bbf7
7
+ data.tar.gz: ac7e906db31d0be0c154dd26d90638195cf76727470c4167bc777f81aff26c75534d11eee3874eeb1cfcc401e78dd90802d8bfb28eee912ecaa0599797c5bc7f
@@ -0,0 +1,49 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at zotherstupidguy@gmail.com. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+ ruby "2.3.1"
3
+
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,28 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ mushin (0.1.0)
5
+ ibsciss-middleware (~> 0.3)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ibsciss-middleware (0.4.1)
11
+ minitest (5.8.2)
12
+ rake (10.4.2)
13
+
14
+ PLATFORMS
15
+ ruby
16
+
17
+ DEPENDENCIES
18
+ bundler (~> 1.12)
19
+ ibsciss-middleware (~> 0.3)
20
+ minitest (~> 5.0)
21
+ mushin!
22
+ rake (~> 10.0)
23
+
24
+ RUBY VERSION
25
+ ruby 2.3.1p112
26
+
27
+ BUNDLED WITH
28
+ 1.12.5
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 zotherstupidguy
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,96 @@
1
+ What is Mushin
2
+ ===============
3
+ Mushin is a Domain-specific Framework Generator
4
+
5
+ How to use Mushin
6
+ =================
7
+ Directly via
8
+
9
+ Mushin::Stack.new do
10
+ use DomainSpecificExtA, opts, params
11
+ use DomainSpecificExtB, opts, params
12
+ use DomainSpecificExtC, opts, params
13
+ end
14
+
15
+ Indirectly via generating a domain-specific framework and using it instead to generate domain-specific Extentions.
16
+
17
+ Generate the framework via
18
+ ```
19
+ mushin roll domainframeworkXYZ
20
+ ```
21
+ then after installing the framework gem in your system, generate extentions via
22
+ ```
23
+ domainframeworkXYZ ext extentionXYZ
24
+ ```
25
+ ```ruby
26
+ DomainframeworkXYZ::Stack.new do
27
+ use extentionXYZ1, opts, params
28
+ use extentionXYZ2, opts, params
29
+ use extentionXYZ3, opts, params
30
+ end
31
+ ```
32
+
33
+ Domain-specfic Extentions duck types to the following interface:
34
+ ```ruby
35
+ class ExtensionXYZ
36
+ def initialize(app); end
37
+ def call(env); end
38
+ end
39
+ ```
40
+
41
+ ######################################################################
42
+ Mushin Books uses declarative DSL for describing what an expert want to do.
43
+ https://www.netguru.co/blog/imperative-vs-declarative
44
+
45
+
46
+ Mushin previously had crazy bugs as due to mutable objects, this is tend to be
47
+ avoided in the current implementation.
48
+
49
+ === What is Mushin?
50
+ Mushin is a specification interface between your ruby application and domain-specific frameworks.
51
+ It provides generation capabilities to kick start developing your own domain-specific framework based on the interface, thats the Mushin way.
52
+ Following the Mushin way, new developers can easily start using your new domain-specific framework in their applications. as they expect it to behave similarlar to other mushin-based frameworks.
53
+
54
+ Mushin is a spec describing how an application should implement a domian-specifc rules and actions, similar in the sense that rack is a spec describing how webservers and webframeworks should implement a webrequest and webresponse, following this anology a webrequest the equvilant to a mushin rule, and a webresponse the equivlant of mushin response. and mushin rules engine is similar to rails routecontroller, except that mushin rules engine may activate a number of actions for each rule invoked.
55
+
56
+ === Mushin Goal
57
+ Mushin goal is to be in service for preventing every ruby application from complecting different domain knolwedge, in the sense that via following the mushin way, each domain knoweldge is mature in isolation with its own middlewares, in the realm of its own domain-specific framework.
58
+
59
+ === What Mushin do?
60
+ Mushin do to a ruby application and domain-specific frameworks, what rack does to webservers and webframeworks. Except that rack doesn't offer code generation capabilities for webframework developers. Note: in a general sense a webframework is a domains-specific framework for the 'web' domain, see TheMetal project for the future of rack and how the ruby community been trying to further enahnce rack.
61
+
62
+ === Mushin TDD
63
+
64
+ === Writing Mushin Middleware
65
+ It is a good practice to isolate the middleware from the logic, in the sense that that the logic code inside the call method of your middleware should only be concrned with descion flow and passing variables to your logic methods that typically will reside on its own classes.
66
+
67
+ ===== Example writing a Redis DataStore Middleware
68
+ - first we start by writing the specs for our middleware which is typical and can be gernated in the future via mushin
69
+ mushin_middleware_spec.rb
70
+ - then we move own to write the actual middleware
71
+ ##### this is a mushin middlware
72
+ class redis
73
+ def app(env)
74
+ end
75
+ def call(env)
76
+ # here add your if, case statmetents
77
+ end
78
+ end
79
+ - then we write the spec for our logic class that contain the methods for our logic
80
+
81
+ - and finally we write the actually logic class that make the spec pass
82
+ ##### this is a logic file for the middleware of mushin
83
+ class RedisDS
84
+ ##### here each function is used and tested in as a spec in isolation
85
+ end
86
+
87
+ === Mushin testing
88
+
89
+ ##### TODO Mushin::MockRequest, similar to rack's stack let(:request) { Rack::MockRequest.new(stack) }
90
+
91
+
92
+ === Mushin Generation capabilities
93
+ each new version of mushin contains a blue print of the domain-speicifc framework, it copies those files into a destenation directory and then uses grep to replace various code snippet
94
+
95
+
96
+ === Virtual Currency Domain Framework, that includes middlewares for different client apis and gems to work with virtualcurrencies
data/Rakefile ADDED
@@ -0,0 +1,79 @@
1
+ require "rake"
2
+ require 'rake/testtask'
3
+ #require 'logger'
4
+
5
+ #$logger = Logger.new(STDOUT)
6
+
7
+ task 'clear_screen' do
8
+ `clear`
9
+ end
10
+
11
+ Rake::TestTask.new 'env_spec' do |t|
12
+ #libs = ["lib/env.rb"]
13
+ #t.warning = true
14
+ #t.verbose = true
15
+ t.test_files = FileList['spec/env_spec.rb']
16
+ end
17
+
18
+
19
+ Rake::TestTask.new 'engine_spec' => ['clear_screen'] do |t|
20
+ libs = ["lib/engine.rb"]
21
+ #t.warning = true
22
+ #t.verbose = true
23
+ t.test_files = FileList['spec/engine_spec.rb']
24
+ end
25
+
26
+ =begin
27
+ Rake::TestTask.new 'ds_spec' => ['clear_screen'] do |t|
28
+ libs = ["lib/ds/ds.rb"]
29
+ t.warning = true
30
+ t.verbose = true
31
+ t.test_files = FileList['spec/ds/ds_spec.rb']
32
+ end
33
+
34
+ Rake::TestTask.new 'redis_spec' => ['clear_screen'] do |t|
35
+ libs = ["lib/ds/redis.rb"]
36
+ #t.warning = true
37
+ #t.verbose = true
38
+ t.test_files = FileList['spec/ds/redis_spec.rb']
39
+ end
40
+ # task :default => :complete_test
41
+ # compelte test depends on flushin db then expecting a certain space upcoming events run the test
42
+
43
+ #task 'db:flush' do
44
+ # `redis-cli flushall`
45
+ # $logger.info("Redis got a flushall")
46
+ #end
47
+ desc 'Complete clean test, should depend on other stuff'
48
+ task :complete do
49
+ #ENV['Somevariable'] = 'true'
50
+ Rake::Task['db:info'].execute
51
+ Rake::Task['db:flush'].invoke
52
+ Rake::Task['test'].invoke
53
+ end
54
+
55
+ task 'db:monitor' do
56
+ `redis-cli monitor`
57
+ end
58
+
59
+ task 'db:info' do
60
+ `redis-cli INFO`
61
+ end
62
+ =end
63
+ =begin
64
+ Rake::TestTask.new 'test' => ['db:flush'] do
65
+ libs = ["lib"]
66
+ warning = true
67
+ verbose = true
68
+ test_files = FileList['spec/*_spec.rb']
69
+ end
70
+ =end
71
+ =begin
72
+ Rake::TestTask.new 'test' => ['clear_screen', 'db:flush'] do |t|
73
+ t.libs = ["lib"]
74
+ t.warning = true
75
+ t.verbose = true
76
+ t.test_files = FileList['spec/*_spec.rb']
77
+ end
78
+ =end
79
+
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "mushin"
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
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,47 @@
1
+ require 'logger'
2
+ $logger = Logger.new(STDOUT)
3
+
4
+ module Mushin
5
+ module Book
6
+ def rule &block
7
+ @rule = {}
8
+ @rule[:conditions] = []
9
+ @rule[:actions] = []
10
+ def condition c
11
+ @rule[:conditions] << c
12
+ $l.info "condition #{c} is added"
13
+ end
14
+ def action a
15
+ @rule[:actions] << a
16
+ $l.info "action #{a} is added"
17
+ end
18
+ yield
19
+ $logger.info "this rule is #{@rule}"
20
+ Mushin::Engine.add_rule @rule
21
+ end
22
+ end
23
+ end
24
+
25
+ module MyCookBook
26
+ extend Mushin::Book
27
+
28
+ rule do
29
+ condition [:subject_a, :predicate_a, :object_a]
30
+ condition :b_condition
31
+ condition :c_condition
32
+
33
+ action :a_action
34
+ action :b_action
35
+ action :c_action
36
+ end
37
+
38
+ rule do
39
+ condition :d_condition
40
+ condition :e_condition
41
+ condition :f_condition
42
+
43
+ action :d_action
44
+ action :e_action
45
+ action :f_action
46
+ end
47
+ end
@@ -0,0 +1,31 @@
1
+ require_relative './redis'
2
+
3
+ module Mushin
4
+ module Persistence
5
+ class DS
6
+
7
+ def initialize(app, opts={}, params={})
8
+ @app = app
9
+ @opts = opts
10
+ @params = params
11
+ @redis_ds = Mushin::Persistence::RedisDS.new
12
+ end
13
+
14
+ def call(env)
15
+ @id = env[:id]
16
+ if @redis_ds.exists? @id
17
+ env[:id] = @redis_ds.get(@id)[:id]
18
+ env[:data] = @redis_ds.get(@id)[:data]
19
+ $logger.info("domain env object exists in the database")
20
+ else
21
+ @redis_ds.set(@id, env[:data])
22
+ $logger.info("domain env object DOESNOT exist in the database")
23
+ end
24
+ @app.call(env) # calls up the stack
25
+ @redis_ds.set(@id, env)
26
+ env
27
+ end
28
+
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,31 @@
1
+ require "redis"
2
+
3
+ module Mushin
4
+ module Persistence
5
+ class RedisDS
6
+ attr_accessor :id, :value_obj
7
+ def initialize(opts={}, params={})
8
+ #@id = params[:id]
9
+ #@value_obj = params[:value_obj]
10
+ @redis = Redis.new #opts to take a different redis server
11
+ end
12
+
13
+ def set(id = @id, value_obj = @value_obj)
14
+ @redis.set(id, Marshal.dump(value_obj))
15
+ end
16
+
17
+ def get(id = @id)
18
+ Marshal.load(@redis.get(id))
19
+ #@redis.get(id)
20
+ end
21
+
22
+ def exists?(id)
23
+ if @redis.get(id).nil? then
24
+ return false
25
+ else
26
+ return true
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,101 @@
1
+ #!/usr/bin/env ruby
2
+ require "openssl"
3
+ require 'digest/sha2'
4
+ require 'base64'
5
+
6
+ # We use the AES 256 bit cipher-block chaining symetric encryption
7
+ alg = "AES-256-CBC"
8
+
9
+ # We want a 256 bit key symetric key based on some passphrase
10
+ digest = Digest::SHA256.new
11
+ digest.update("fouad is cool symetric key")
12
+ key = digest.digest
13
+ # We could also have just created a random key
14
+ # key = OpenSSL::Cipher::Cipher.new(alg).random_key
15
+
16
+ # For security as part of the encryption algorithm, we create a random
17
+ # initialization vector.
18
+ iv = OpenSSL::Cipher::Cipher.new(alg).random_iv
19
+ #iv = OpenSSL::Cipher::Cipher.new(alg).key = "dfsdfasfsafasfaffouad"
20
+ #p OpenSSL::Cipher::Cipher.new(alg).methods
21
+
22
+ # Example, we debug output our key in various formats
23
+ puts "Our key: #{key}"
24
+
25
+ # Base64 the key
26
+ key64 = [key].pack('m')
27
+ puts "Our key base 64: #{key64}"
28
+
29
+ # Base64 decode the key
30
+ raise 'Key Error' if(key.nil? or key.size != 32)
31
+ puts "Our key retrieved from base64: #{key64.unpack('m')[0]}"
32
+
33
+ # Now we do the actual setup of the cipher
34
+ aes = OpenSSL::Cipher::Cipher.new(alg)
35
+ aes.encrypt
36
+ aes.key = key
37
+ aes.iv = iv
38
+
39
+ =begin
40
+ # Now we go ahead and encrypt our plain text.
41
+ cipher = aes.update("This is line 1\n")
42
+ cipher << aes.update("This is some other string without linebreak.")
43
+ cipher << aes.update("This follows immediately after period.")
44
+ cipher << aes.update("Same with this final sentence")
45
+ cipher << aes.final
46
+ =end
47
+ class Env
48
+ def initialize(str)
49
+ @str = str
50
+ end
51
+ def say_hello
52
+ @str
53
+ end
54
+ end
55
+
56
+ #o = Env.new("hello\n")
57
+ #data = Marshal.dump(o)
58
+ #obj = Marshal.load(data)
59
+ #obj.say_hello #=> "hello\n"
60
+
61
+ o = Env.new("hello\n")
62
+ #cipher = Marshal.dump(Env.new("hello"))
63
+ #cipher = Marshal.dump(o)
64
+ cipher = "fouad"
65
+
66
+ puts "Our Encrypted data in base64"
67
+ cipher64 = [cipher].pack('m')
68
+ puts cipher64
69
+
70
+ decode_cipher = OpenSSL::Cipher::Cipher.new(alg)
71
+ decode_cipher.decrypt
72
+ decode_cipher.key = key
73
+ decode_cipher.iv = iv
74
+ plain = decode_cipher.update(cipher64.unpack('m')[0])
75
+ p plain
76
+ #p decode_cipher.final
77
+ #plain << decode_cipher.final
78
+ #puts "Decrypted Text"
79
+ #puts plain
80
+ #p plain
81
+ obj = Marshal.load(plain)
82
+ p obj.say_hello #=> "hello\n"
83
+
84
+
85
+ =begin
86
+ '
87
+ # aes encode a file into another file.
88
+ File.open("foo.enc","w") do |enc|
89
+ File.open("foo") do |f|
90
+ loop do
91
+ r = f.read(4096)
92
+ break unless r
93
+ cipher = aes.update(r)
94
+ enc << cipher
95
+ end
96
+ end
97
+
98
+ enc << aes.final
99
+ end
100
+ '
101
+ =end
@@ -0,0 +1,44 @@
1
+ module Mushin
2
+ class Engine
3
+
4
+ @@book_rules = []
5
+
6
+ def self.add_rule rule
7
+ @@book_rules << rule
8
+ end
9
+
10
+ def self.get_rules
11
+ # load or require_relative certain ruby books, done to be least invasive
12
+ @@book_rules
13
+ end
14
+
15
+ def initialize env, book
16
+ @env_id = env[:id]
17
+ @env_rules = env[:rules]
18
+ @book_rules = book[:rules]
19
+ match
20
+ end
21
+
22
+ def match
23
+ @@book_rules.each do |rule|
24
+ if rule[:conditions] == "my provided conditions" then
25
+ # apply rule[:actions]
26
+ end
27
+ end
28
+ @book_rules[@env_rules.to_sym]
29
+ end
30
+
31
+ #def self.set_rules
32
+ # loads or require certain ruby books
33
+ # book ||= {:rules => {:some_data => "some rules(conditions and actions)", :x => "dfdf", :y => "dfdf"}}
34
+ # Book.new("location of the book file") will return an array or hash of the rules
35
+ #end
36
+
37
+ def self.run env
38
+ env[:book_rules] = get_rules
39
+ new(env, @@rules)
40
+ end
41
+ end
42
+ end
43
+
44
+ #Mushin::Engine.run({:id => "myid", :rules => "some_data"})
@@ -0,0 +1,98 @@
1
+ module Mushin
2
+ class Env
3
+
4
+ attr_accessor :id, :rule , :env
5
+
6
+ def initialize id, &block
7
+ @env = {}
8
+ @env[:rules] = []
9
+ @id = id
10
+ @env[:id] = @id
11
+ instance_eval &block if block_given?
12
+ end
13
+
14
+ def rule(conditions = [])
15
+ @env[:rules] << conditions
16
+ end
17
+
18
+ def self.set id, &block
19
+ domain_instance = Mushin::Env.new id, &block
20
+ Mushin::Engine.run domain_instance
21
+ end
22
+
23
+ # run engine, give the env to the engine,
24
+ # engine will return the env_instance after it hit all the middlewares including the database middleware.
25
+ # because domain_instance.env[:rules] is empty as there is no block; the Engine stack will only be of one middleware
26
+ # , the Mushin::Presistance::DS middleware
27
+ # Mushin::Engine.run domain_instance
28
+ def self.get id
29
+ domain_instance = Mushin::Env.new id
30
+ Mushin::Engine.run domain_instance
31
+ end
32
+
33
+ end
34
+ end
35
+
36
+ =begin
37
+ def self.set id
38
+ self.new id
39
+ #Mushin::Persistence::RedisDS.new.set @id
40
+ end
41
+ def self.get id
42
+ self.new id
43
+ #Mushin::Persistence::RedisDS.new.get @id
44
+ end
45
+ =end
46
+ =begin
47
+ # Each Domain Framework got its own Env object in the application space.
48
+ # In this manner the application can easily set and get enviroment objects
49
+ #
50
+ module Mushin
51
+ class Env
52
+
53
+ attr_accessor :id, :current_context_title, :activities
54
+
55
+ def initialize
56
+ @id = ''
57
+ @current_context_title = ''
58
+ @activities = []
59
+ end
60
+
61
+ def set id, &block
62
+ @id = id.to_s + 'mushin'
63
+ def context current_context_title, &block
64
+ @current_context_title = current_context_title
65
+ @activities = []
66
+ def activity current_activity_title
67
+ @activities << current_activity_title
68
+ end
69
+ instance_eval(&block)
70
+ end
71
+ instance_eval(&block)
72
+ #@activities.uniq.each do |current_activity_title|
73
+ @activities.each do |current_activity_title|
74
+ #GameOn::Engine.run @id, @current_context_title, current_activity_title
75
+ $logger.info("Domain Framework Engine.run: #{@id}, #{@current_context_title}, #{current_activity_title}")
76
+ end
77
+ @activities = [] # reset the activities
78
+ return Mushin::Persistence::DS.load @id
79
+ end
80
+
81
+ def get id
82
+ @id = id.to_s + 'mushin'
83
+ #TODO make a git issue for some encryption method based on a configurable app key
84
+ Mushin::Persistence::DS.load @id
85
+ end
86
+
87
+ def self.set id, &block
88
+ e = Env.new
89
+ e.set id, &block
90
+ end
91
+
92
+ def self.get id
93
+ e = Env.new
94
+ e.get id
95
+ end
96
+ end
97
+ end
98
+ =end