Module: GirlsBar

Defined in:
lib/girls_bar/helper.rb,
lib/girls_bar.rb,
lib/girls_bar/data.rb,
lib/girls_bar/entry.rb,
lib/girls_bar/filter.rb,
lib/girls_bar/router.rb,
lib/girls_bar/version.rb,
lib/girls_bar/settings.rb,
lib/girls_bar/constants.rb,
lib/girls_bar/command/input.rb,
lib/girls_bar/command/script.rb,
lib/girls_bar/command/confirm.rb,
lib/girls_bar/command/restart.rb,
lib/girls_bar/command/redirect.rb

Overview

-*- utf-8 -*-

Defined Under Namespace

Modules: Command, Filter, Helper Classes: Data, Entry, Router, Selection, Settings

Constant Summary collapse

VERSION =
"0.1.2"
DEFAULT_SETTINGS =
{
  delimiter: {
    character: "-",
    count: 45
  },
  prompt: "[GirlsBar] > ",
  messages: {
    boot: "Type 'help' for help. Type 'exit' or 'quit' to quit.",
    quit: "...Quit",
    retry: "Please try again.",
    invalid_link: "Link is invalid. Return to first section."
  }
}
DISPLAY_COLORS =
{
  clear: 0, bold: 1, black: 30, red: 31, green: 32, yellow: 33, blue: 34, magenda: 35, cyan: 36, white: 37,
  on_black: 40, on_red: 41, on_green: 42, on_yellow: 43, on_blue: 44, on_magenda: 45, on_cyan: 46, on_white: 47
}
TEMPLATE =
<<-EOF
config:
  title: GirlsBar Title (Optional)
  description: |+
    Hello, girls_bar.
    This is description (Optional)
  prompt: "[Hello:girls_bar] > "
  delimiter:
    character: "-"
    count: 45
  help_message: |+
    Show something... when you type 'help'.
    [Default] Type 'help' for help. Type 'exit' or 'quit' to quit.
entry:
  input_your_name:
    input:
      subject: |
        [SECTION 0]
        Input Your Name
      id: your_name
      link: done
  done:
    confirm:
      subject: |
        Hello {% your_name %}!!
      select:
        1:
          label: OK, I am {% your_name %}.
          link: section_1
  section_1:
    confirm:
      subject: |+
        [SECTION 1]
        You can create a interactive CLI program.
      select:
        1:
          label: Next
          link: second
        2:
          label: Jump
          link: third
  second:
    confirm:
      subject: |+
        [SECTION 2]
        You can set ShellScript.
      select:
        1:
          label: Run command A
          link: command_a
        2:
          label: Run command B
          link: command_b
  third:
    confirm:
      subject: |+
        [SECTION 3]
        You can exit this program, please input 'exit' or 'quit'.
      select:
        1:
          label: Return to SECTION 1
          link: section_1
        2:
          label: Return to SECTION 2
          link: second
  command_a:
    script: |+
      echo "command_a"
    redirect_to: second
  command_b:
    script: |+
      echo "command_b"
    redirect_to: third
EOF

Class Method Summary collapse

Class Method Details

.generate(format) ⇒ Object



27
28
29
# File 'lib/girls_bar.rb', line 27

def self.generate(format)
  dump_resource(format)
end

.run(path) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/girls_bar.rb', line 19

def self.run(path)
  resource = load_resource(path)
  GirlsBar::Settings.setup resource["config"]
  GirlsBar::Entry.setup resource["entry"]
  GirlsBar::Data.setup
  GirlsBar::Router.start
end