mushin 0.25.0 → 0.26.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/generator.rb +168 -0
- data/exe/mushin +45 -51
- data/lib/mushin/builtin/ssd/ssd.rb +50 -0
- data/lib/mushin/{main.rb → domain.rb} +14 -73
- data/lib/mushin/logger.rb +15 -15
- data/lib/mushin/service.rb +18 -0
- data/lib/mushin/store.rb +16 -0
- data/lib/mushin/version.rb +1 -1
- data/lib/mushin.rb +2 -2
- data/mushin.gemspec +1 -1
- data/showcases/gamification_showcase/README.md +9 -0
- 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 +9 -0
- data/showcases/gamification_showcase/points/points.rb +1 -0
- data/showcases/gamification_showcase/sample_app/app.rb +0 -0
- data/showcases/gamification_showcase/sample_app/ext/levels/levels.rb +0 -0
- data/{samples → showcases}/sample3.rb +6 -3
- data/showcases/torrents_showcase/README.md +6 -0
- metadata +33 -15
- data/hacks/bot.rb +0 -236
- data/hacks/cqrs/command.rb +0 -123
- data/hacks/cqrs/query.rb +0 -200
- data/hacks/domain.rb +0 -35
- data/hacks/dsl.rb +0 -39
- data/hacks/dsl_builder.rb +0 -29
- data/hacks/es/event.rb +0 -18
- data/hacks/es/event_stream.rb +0 -33
- data/hacks/generator.rb +0 -68
- /data/{samples → showcases}/sample1.rb +0 -0
- /data/{samples → showcases}/sample2.rb +0 -0
data/hacks/domain.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
require_relative 'dsl_builder'
|
2
|
-
module Mushin
|
3
|
-
|
4
|
-
class Domain
|
5
|
-
# offers a virtual datastore for query requests on the domain object
|
6
|
-
#attr_accessor :store, :event_stream
|
7
|
-
#attr_accessor :dparams
|
8
|
-
#attr_accessor :dsl_array
|
9
|
-
|
10
|
-
|
11
|
-
def self.inherited(subclass)
|
12
|
-
subclass.send :extend, DSLBuilder
|
13
|
-
end
|
14
|
-
|
15
|
-
def initialize &block
|
16
|
-
#def self.inherited(subclass)
|
17
|
-
# subclass.send :extend, DSLBuilder
|
18
|
-
#
|
19
|
-
# dsl_module = Module.new do
|
20
|
-
# end
|
21
|
-
# Mushin.const_set(:DSL, dsl_module)
|
22
|
-
## subclass.send :include, DSL
|
23
|
-
# end
|
24
|
-
|
25
|
-
#def initialize params={}, &block
|
26
|
-
#@dparams = params
|
27
|
-
#$log.debug "Domain object #{self} is going to instance_eval with dparams of #{@dparams}"
|
28
|
-
#@dsl_array = []
|
29
|
-
instance_eval &block
|
30
|
-
Mushin.send :remove_const, :DSL #, dsl_module)
|
31
|
-
end
|
32
|
-
|
33
|
-
|
34
|
-
end
|
35
|
-
end
|
data/hacks/dsl.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
module Mushin
|
3
|
-
# DSL module holds one klass and one access method along with
|
4
|
-
# one neseted klass and one nested access method
|
5
|
-
module DSL
|
6
|
-
def self.inherited(other)
|
7
|
-
$log.debug("#{self} is inherited in #{other}")
|
8
|
-
end
|
9
|
-
def self.method_added(name)
|
10
|
-
$log.debug("method #{name} is added to #{self}")
|
11
|
-
end
|
12
|
-
begin
|
13
|
-
tp = TracePoint.trace(:call) do |tp|
|
14
|
-
if tp.method_id == :context then
|
15
|
-
$log.debug "#{self} #{[tp.lineno, tp.defined_class, tp.method_id, tp.event]}"
|
16
|
-
end
|
17
|
-
|
18
|
-
if tp.method_id == :const_set then
|
19
|
-
#puts tp.definedmethods
|
20
|
-
#puts "constant set"
|
21
|
-
#$log.info("#{self} is inherited in #{other}")
|
22
|
-
#p self
|
23
|
-
#$log.info "#{self} #{[tp.lineno, tp.defined_class, tp.method_id, tp.event, tp.class]}"
|
24
|
-
#p "#{self} #{[tp.lineno, tp.defined_class, tp.method_id, tp.event, tp.class]}"
|
25
|
-
#p self.methods
|
26
|
-
#p constants
|
27
|
-
#, :const_defined?
|
28
|
-
#p tp
|
29
|
-
end
|
30
|
-
#p "#{self} #{[tp.lineno, tp.defined_class, tp.method_id, tp.event, tp.class]}"
|
31
|
-
end
|
32
|
-
rescue Exception
|
33
|
-
puts "#{$!} (#{$!.class})"
|
34
|
-
$stdout.flush
|
35
|
-
raise $!
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
=end
|
data/hacks/dsl_builder.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
require_relative 'dsl'
|
2
|
-
require_relative 'cqrs/command'
|
3
|
-
require_relative 'cqrs/query'
|
4
|
-
|
5
|
-
module Mushin
|
6
|
-
|
7
|
-
module DSLBuilder
|
8
|
-
|
9
|
-
@@commands = []
|
10
|
-
|
11
|
-
# The DSLBuilder context access method
|
12
|
-
def context context_keyword, &block
|
13
|
-
$log.debug "printing self from inside DSLBuilder:context #{self}, dsl_array: #{@dsl_array}"
|
14
|
-
|
15
|
-
@@commands << Mushin::DSLBuilder::CQRS::Command.new(context_keyword, &block)
|
16
|
-
end
|
17
|
-
|
18
|
-
def query &block
|
19
|
-
$log.debug "printing self from inside DSLBuilder:query #{self}"
|
20
|
-
#@@commands << Mushin::DSLBuilder::CQRS::Query.new &block
|
21
|
-
Mushin::DSLBuilder::CQRS::Query.new &block
|
22
|
-
end
|
23
|
-
|
24
|
-
def commands
|
25
|
-
@@commands
|
26
|
-
end
|
27
|
-
|
28
|
-
end # end of DSLBuilder module
|
29
|
-
end # end of Mushin
|
data/hacks/es/event.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
module Mushin
|
2
|
-
module ES
|
3
|
-
# A domain event is an object that defines an event (something that happens).
|
4
|
-
# A domain event is an event that domain experts care about.
|
5
|
-
class Event
|
6
|
-
attr_accessor :id
|
7
|
-
attr_accessor :timestamp
|
8
|
-
attr_accessor :version
|
9
|
-
attr_accessor :type
|
10
|
-
attr_accessor :title
|
11
|
-
attr_accessor :data
|
12
|
-
def initialize &block
|
13
|
-
instance_eval &block if block_given?
|
14
|
-
Mushin::ES::EventStream.instance.add self
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
data/hacks/es/event_stream.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'date'
|
2
|
-
require 'open-uri'
|
3
|
-
require 'singleton'
|
4
|
-
|
5
|
-
module Mushin
|
6
|
-
module ES
|
7
|
-
|
8
|
-
#TODO from the console `mushin eventstream path/to/event/stream` this will populate the application with all the events logged in the specified eventstream, meaning all the databases that the system used will populate it as well. looks like migration mechanism.
|
9
|
-
#TODO event stream(s) maybe used via a rule-engine(sitting on IRC chatrooms as a bot) to determine some general actions. The rule-engine bot takes in events as conditions from a number of microservices and sends should be applied actions to the chat room.
|
10
|
-
class EventStream
|
11
|
-
include Singleton
|
12
|
-
|
13
|
-
def initialize
|
14
|
-
end
|
15
|
-
|
16
|
-
# When an event is added to the strea, it is streamed first then stored to a datastore
|
17
|
-
def add event
|
18
|
-
# Stream to IRC
|
19
|
-
Mushin::Bot::IRC.instance.log message: event
|
20
|
-
|
21
|
-
|
22
|
-
#irc server: "irc.freenode.net", channel: "hackspree", nick: "testingasshole"
|
23
|
-
#rss server: "irc.freenode.net", channel: "hackspree", nick: "testingasshole"
|
24
|
-
# store the event
|
25
|
-
Mushin::ES::Store.write dir: "eventstream", name: DateTime.now.strftime('%m_%d_%Y'), data: event
|
26
|
-
end
|
27
|
-
|
28
|
-
def replay
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
data/hacks/generator.rb
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
require 'thor'
|
2
|
-
|
3
|
-
module Mushin
|
4
|
-
class Generator < Thor::Group
|
5
|
-
include Thor::Actions
|
6
|
-
|
7
|
-
def gem params
|
8
|
-
@params = params
|
9
|
-
|
10
|
-
#params = {:gem_name => gem_name, :gem_type => gem_type, :gem_context => gem_context, :editor => @editor}
|
11
|
-
|
12
|
-
@name = @params[:gem_name]
|
13
|
-
@type = @params[:gem_type]
|
14
|
-
@context = @params[:gem_context]
|
15
|
-
@editor = @params[:gem_editor]
|
16
|
-
#{:name => @name, :type =>type, :context => @context, :editor => @editor}
|
17
|
-
|
18
|
-
#clean the previous gem if it exists?
|
19
|
-
system("rm -rf #{@name}")
|
20
|
-
|
21
|
-
case @type
|
22
|
-
when "domain"
|
23
|
-
if @context == "project"
|
24
|
-
p "creating a domain inside a project"
|
25
|
-
#system "bundle gem #{@name.downcase} --test minitest --coc --edit=#{@editor}"
|
26
|
-
system "bundle gem #{@name.downcase} --test minitest --mit --exe --coc"
|
27
|
-
minitest_spec
|
28
|
-
system "mv #{@name.downcase} domain"
|
29
|
-
@name = "domain"
|
30
|
-
system "mkdir #{@name.downcase}/ext"
|
31
|
-
#system "#{@editor} #{@name.downcase}/#{@name.downcase}.gemspec"
|
32
|
-
#system "cd #{@name.downcase} && bundle install"
|
33
|
-
elsif @context == "standalone"
|
34
|
-
p "creating a standalone domain"
|
35
|
-
system "bundle gem #{@name.downcase} --test minitest --coc --edit=#{@editor}"
|
36
|
-
system "cd #{@name.downcase} && bundle install"
|
37
|
-
else
|
38
|
-
p "context value must either be project or standalone"
|
39
|
-
end
|
40
|
-
when "ext"
|
41
|
-
p "ext............"
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def minitest_spec
|
46
|
-
system("cd #{@name} && mv test spec && mv spec/#{@name.downcase}_test.rb spec/#{@name.downcase}_spec.rb && mv spec/test_helper.rb spec/spec_helper.rb")
|
47
|
-
|
48
|
-
#p "change directory test to spec"
|
49
|
-
#system("cd #{@name} && mv test spec")
|
50
|
-
|
51
|
-
#p "change file name from test/#{@name.downcase}_test.rb to spec/#{@name.downcase}_spec.rb"
|
52
|
-
#system("cd #{@name} && mv spec/#{@name.downcase}_test.rb spec/#{@name.downcase}_spec.rb")
|
53
|
-
|
54
|
-
#p "change file name from test/test_helper.rb to spec/spec_helper.rb"
|
55
|
-
#system("cd #{@name} && mv spec/test_helper.rb spec/spec_helper.rb")
|
56
|
-
|
57
|
-
append_to_file "#{@name}/spec/spec_helper.rb" do
|
58
|
-
"require 'minitest/autorun'"
|
59
|
-
"require 'minitest/spec'"
|
60
|
-
"require 'minitest/pride'"
|
61
|
-
end
|
62
|
-
|
63
|
-
#system("cd #{@name} && mv test spec")
|
64
|
-
#require_relative "./../spec_helper"
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
File without changes
|
File without changes
|