Class: Serialbar::CLI

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/serialbar/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



11
12
13
# File 'lib/serialbar/cli.rb', line 11

def self.source_root
    File.dirname(__FILE__)
end

Instance Method Details

#list_adaptersObject



16
17
18
19
# File 'lib/serialbar/cli.rb', line 16

def list_adapters
  say "Currently available adapters"
  say "\tmongoid"
end

#new(name) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/serialbar/cli.rb', line 23

def new(name)
      say "creating a new serialbar project #{name}", :green 
      readme(name) # create readme file in project dir

      case options[:adapter]
        when "mongoid"
          say 'Using mongoid adapter', :green
          insert_mongoid(name)
          insert_data_file(name,"mongoid")
        else 
          say 'Adapter type unknown', :red
          #invoke(:list_adapters,"")
      end

      insert_listener(name)
end

#usageObject



41
42
43
44
45
46
47
48
49
# File 'lib/serialbar/cli.rb', line 41

def usage
  puts "Usage: Serialbox help [command]\n\nDescription:  A simple app to create a database or file based storage adapter for serial port data\n\n  DES\n  help\nend\n"