Permalink
Browse files

+ moved old project

  • Loading branch information...
1 parent 00ab79d commit 8b8ee9c05cba56997203f69c2157281ddaaf3267 @floere committed May 5, 2011
Showing with 171 additions and 50 deletions.
  1. +1 −0 .gitignore
  2. 0 bin/james
  3. +22 −0 james.gemspec
  4. +1 −0 lib/james.rb
  5. +9 −0 lib/james/controller.rb
  6. 0 { → old}/README
  7. 0 { → old}/config/README
  8. 0 { → old}/config/names.yml
  9. 0 { → old}/config/sentences.yml
  10. 0 { → old}/config/voices.yml
  11. 0 { → old}/configurator.rb
  12. 0 { → old}/dialogue.rb
  13. +16 −16 { → old}/dialogue_extension.rb
  14. 0 { → old}/dialogue_frontend.rb
  15. 0 { → old}/dialogue_plugin.rb
  16. BIN old/dialogues/.DS_Store
  17. 0 { → old}/dialogues/joke/README
  18. 0 { → old}/dialogues/joke/init.rb
  19. 0 { → old}/dialogues/joke/lib/joke_dialogue.rb
  20. 0 { → old}/dialogues/phonebook/init.rb
  21. 0 { → old}/dialogues/phonebook/lib/phonebook.rb
  22. 0 { → old}/dialogues/phonebook/lib/phonebook_dialogue.rb
  23. 0 { → old}/dialogues/phonebook/test/test_phonebook.rb
  24. 0 { → old}/dialogues/quote/README
  25. 0 { → old}/dialogues/quote/init.rb
  26. 0 { → old}/dialogues/quote/lib/quote_dialogue.rb
  27. 0 { → old}/dialogues/quote/lib/quote_of_the_day.rb
  28. 0 { → old}/dialogues/quote/test/test_quote_of_the_day.rb
  29. BIN old/dialogues/sbb/.DS_Store
  30. 0 { → old}/dialogues/sbb/README
  31. 0 { → old}/dialogues/sbb/init.rb
  32. 0 { → old}/dialogues/sbb/lib/hpricot_finder.rb
  33. 0 { → old}/dialogues/sbb/lib/sbb.rb
  34. 0 { → old}/dialogues/sbb/lib/sbb_dialogue.rb
  35. 0 { → old}/dialogues/sbb/lib/sbb_finder.rb
  36. 0 { → old}/dialogues/sbb/lib/scrapi_finder.rb
  37. 0 { → old}/dialogues/sbb/lib/scrubyt_finder.rb
  38. 0 { → old}/dialogues/sbb/lib/test.html
  39. 0 { → old}/dialogues/sbb/test/test.html
  40. 0 { → old}/dialogues/sbb/test/test_sbb.rb
  41. 0 { → old}/dialogues/time/README
  42. 0 { → old}/dialogues/time/init.rb
  43. 0 { → old}/dialogues/time/lib/time_dialogue.rb
  44. +46 −0 old/hello_world.rb
  45. 0 { → old}/initializer.rb
  46. +34 −34 { → old}/main_dialogue.rb
  47. BIN old/rubyscript2exe/.DS_Store
  48. 0 { → old}/rubyscript2exe/CHANGELOG
  49. 0 { → old}/rubyscript2exe/LICENSE
  50. 0 { → old}/rubyscript2exe/README
  51. 0 { → old}/rubyscript2exe/SUMMARY
  52. 0 { → old}/rubyscript2exe/VERSION
  53. BIN { → old}/rubyscript2exe/eee.ico
  54. BIN { → old}/rubyscript2exe/eee.o
  55. 0 { → old}/rubyscript2exe/eee.pas
  56. 0 { → old}/rubyscript2exe/eee.rc
  57. BIN { → old}/rubyscript2exe/eee_darwin
  58. 0 { → old}/rubyscript2exe/ev/dependencies.rb
  59. 0 { → old}/rubyscript2exe/ev/ftools.rb
  60. 0 { → old}/rubyscript2exe/ev/oldandnewlocation.rb
  61. 0 { → old}/rubyscript2exe/hello.rb
  62. 0 { → old}/rubyscript2exe/init.rb
  63. 0 { → old}/rubyscript2exe/require2lib.rb
  64. 0 { → old}/rubyscript2exe/rubyscript2exe.rb
  65. 0 { → old}/rubyscript2exe/tar2rubyscript.rb
  66. 0 { → old}/test.html
  67. 0 { → old}/test/dummy_frontend.rb
  68. 0 { → old}/test/test_dialogue.rb
  69. 0 { → old}/test/test_helper.rb
  70. +42 −0 test_project/joke_dialogue.rb
View
@@ -0,0 +1 @@
+*.gem
View
No changes.
View
@@ -0,0 +1,22 @@
+# encoding: utf-8
+#
+
+Gem::Specification.new do |s|
+ s.platform = Gem::Platform::CURRENT
+
+ s.name = 'james'
+ s.version = '0.0.1'
+
+ s.author = 'Florian Hanke'
+ s.email = 'florian.hanke+james@gmail.com'
+
+ s.homepage = 'http://floere.github.com/james'
+
+ s.description = 'Modular Electronic Butler. Add Dialog(ue)s to it to add more abilities to it.'
+ s.summary = 'James: Modular Electronic Butler.'
+
+ s.files = Dir["lib/**/*.rb"]
+ s.test_files = Dir["spec/**/*_spec.rb"]
+
+ s.add_development_dependency 'rspec'
+end
View
@@ -0,0 +1 @@
+module James end
View
@@ -0,0 +1,9 @@
+module James
+
+ #
+ #
+ class Controller
+
+ end
+
+end
View
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -8,30 +8,30 @@
# if a state is entered, enter_#{state_name} is called
# if a state is exited, exit_#{state_name} is called
class DialogueExtension < Dialogue
-
+
attr_reader :state
-
+
alias :old_initialize :initialize
-
+
# every subclass of this class automatically has its state set to :entry on creation
# def initialize(*args)
# puts "Resetting ", self.name, "\n"
# reset
# old_initialize(*args)
# end
-
+
# # automatically adds a hook phrase
# # meaning: adds a move from :awake to this hook word
# # and also a method
def initialize
# reset
end
- #
+ #
# # TODO improve this such that reset doesn't need to be called in each initializer!
def reset
@state = :entry
end
-
+
# TODO think about saying something after each method call though like this it is kept simple which is good
def hear(phrase)
# if next state
@@ -44,24 +44,24 @@ def hear(phrase)
# call entry method
send("enter_#{@state}".intern) if respond_to?("enter_#{@state}")
end
-
+
# next possible phrases
# TODO splat
def expects
self.class.moves[@state].keys
end
-
+
def next_state(phrase)
self.class.moves[@state][phrase] if self.class.moves[@state]
end
-
+
# returns the possible states of this dialogue
def self.possible_states
self.moves.keys
end
-
+
# metaprog
-
+
# hook words - these define when this dialogue is entered
# adds a hooks method
# TODO get hooks from yaml file
@@ -84,18 +84,18 @@ class <<self
end
end
end
-
+
# initial state
def self.initial_state(initial)
self.class_eval do
- # add accessor for
+ # add accessor for
class <<self
attr_accessor :initial
end
self.initial = initial
end
end
-
+
# state definitions like
# state :name, { moves }
def self.state(name, moves)
@@ -105,7 +105,7 @@ def self.state(name, moves)
# split arrays here instead of handling later specifically
# can change the implementation later if needed
moves.each do |words,state|
- words.each do |word|
+ [*words].each do |word|
self.moves[name][word] = state
end
end
@@ -115,5 +115,5 @@ def self.state(name, moves)
end
# puts "#{self.name} === #{self.moves.inspect}"
end
-
+
end
File renamed without changes.
File renamed without changes.
View
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View
@@ -0,0 +1,46 @@
+framework 'AppKit'
+
+class AppDelegate
+ def applicationDidFinishLaunching(notification)
+ voice_type = "com.apple.speech.synthesis.voice.GoodNews"
+ @voice = NSSpeechSynthesizer.alloc.initWithVoice(voice_type)
+ end
+
+ def windowWillClose(notification)
+ puts "Bye!"
+ exit
+ end
+
+ def say_hello(sender)
+ @voice.startSpeakingString("Hello World!")
+ puts "Hello World!"
+ end
+end
+
+app = NSApplication.sharedApplication
+app.delegate = AppDelegate.new
+
+# window = NSWindow.alloc.initWithContentRect([200, 300, 300, 100],
+# styleMask:NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask,
+# backing:NSBackingStoreBuffered,
+# defer:false)
+# window.title = 'MacRuby: The Definitive Guide'
+# window.level = 3
+# window.delegate = app.delegate
+#
+# button = NSButton.alloc.initWithFrame([80, 10, 120, 80])
+# button.bezelStyle = 4
+# button.title = 'Hello World!'
+# button.target = app.delegate
+# button.action = 'say_hello:'
+#
+# window.contentView.addSubview(button)
+#
+# window.display
+# window.orderFrontRegardless
+
+app.delegate.applicationDidFinishLaunching nil
+
+app.delegate.say_hello app.delegate
+
+app.run
File renamed without changes.
Oops, something went wrong.

0 comments on commit 8b8ee9c

Please sign in to comment.