Class: Ppl::Application::Bootstrap
- Inherits:
-
Object
- Object
- Ppl::Application::Bootstrap
- Defined in:
- lib/ppl/application/bootstrap.rb
Instance Method Summary collapse
- #command_suite ⇒ Object
- #commands ⇒ Object
- #configuration ⇒ Object
- #input ⇒ Object
- #output ⇒ Object
- #router ⇒ Object
- #shell ⇒ Object
- #storage_adapter ⇒ Object
- #vcard_adapter ⇒ Object
Instance Method Details
#command_suite ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/ppl/application/bootstrap.rb', line 27 def command_suite suite = Ppl::Application::CommandSuite.new commands.each do |command| suite.add_command(command) end suite.find_command("help").command_suite = suite return suite end |
#commands ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/ppl/application/bootstrap.rb', line 4 def commands commands = [ Ppl::Command::Init.new, Ppl::Command::Bday.new, Ppl::Command::Help.new, Ppl::Command::Add.new, Ppl::Command::Rm.new, Ppl::Command::Ls.new, Ppl::Command::Mutt.new, Ppl::Command::Mv.new, Ppl::Command::Show.new, Ppl::Command::Name.new, Ppl::Command::Email.new, Ppl::Command::Org.new, Ppl::Command::Phone.new, Ppl::Command::Post.new, ] commands.each do |command| command.storage = storage_adapter end return commands end |
#configuration ⇒ Object
36 37 38 39 |
# File 'lib/ppl/application/bootstrap.rb', line 36 def configuration config = Ppl::Application::Configuration.new return config end |
#input ⇒ Object
41 42 43 44 |
# File 'lib/ppl/application/bootstrap.rb', line 41 def input input = Ppl::Application::Input.new(ARGV.dup) return input end |
#output ⇒ Object
46 47 48 49 |
# File 'lib/ppl/application/bootstrap.rb', line 46 def output output = Ppl::Application::Output.new($stdout, $stderr) return output end |
#router ⇒ Object
51 52 53 54 55 |
# File 'lib/ppl/application/bootstrap.rb', line 51 def router router = Ppl::Application::Router.new(command_suite) router.default = "help" return router end |
#shell ⇒ Object
57 58 59 60 61 |
# File 'lib/ppl/application/bootstrap.rb', line 57 def shell shell = Ppl::Application::Shell.new shell.router = router return shell end |
#storage_adapter ⇒ Object
63 64 65 66 67 68 69 70 71 72 |
# File 'lib/ppl/application/bootstrap.rb', line 63 def storage_adapter config = configuration directory = Dir.new(config.address_book_path) factory = Ppl::Adapter::Storage::Factory.new(vcard_adapter) storage = factory.load_adapter(directory) storage.vcard_adapter = vcard_adapter return storage end |