Sha256: be36922bd01ba3766a93b93e7864e0ef250b88c5d318bf322978c201c31fd9d4

Contents?: true

Size: 935 Bytes

Versions: 1

Compression:

Stored size: 935 Bytes

Contents

module RoCommands
  class Shortcuts < Base

    desc usage("work"), ''

    def work
      action("zeus start")
      bx "rake sunspot:solr:run"
      bx "spork"
      bx "guard"
    end

    private

    def bx(cmd)
      action "bundle exec #{cmd}"
    end

    def action(cmd, postpone=0.012)
      a_action(cmd)
      change_tab_name(cmd)
      new_tab
      sleep postpone
    end

    def a_action(name)
      type name
      enter
    end

    def change_tab_name(name)
      key 'f2'
      type name
      enter
    end

    def enter
      key 'KP_Enter'
    end

    def new_tab
      bash 'xdotool key ctrl+t'
    end

    def key(name)
      if name.match(%r{(f|F)\d{1,2}})
        name.capitalize!
      end
      bash "xdotool key #{name}"
    end

    def translate(name)

    end

    def dict
      {
          enter: "KP_Enter"
      }
    end

    def type(str)
      bash "xdotool type '#{str}'"
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ro_commands-0.0.1 lib/ro_commands/shortcuts.rb