The words Under construction in black text on a yellow background with diagonal black stipes surrounding it
I'm in the process of moving my site. It's still a work in progress. Please excuse the mess and broken links.

Building Ruby GLI Apps in Sublime Text 2

TODO: Pull subtitle into page object

I'm switching to Ruby for my main coding language. When I used to code in Perl, I started command line apps with my own little framework. I pieced together over the years to provide a basic configuration, logging, etc... functionality that I use in every app. Being new to language, I don't have the knowledge or skill to create one yet in Ruby. This is not a problem since I found the excellent *[Git-Like Interface Command Line Parser][1]* (aka "GLI").

From the description:

< GLI is the best way to make a “command-suite” command-line application, e.g. one like git. GLI allows you to make a polished, easy-to-maintain command-line application without a lot of syntax, but without restricting you in any way from the power of OptionParser.

This is for a project file that looks like this:

code_start_default_section code_end_default_section

Note that when run with from Sublime Text with this, you'll see something likes for `File.expand_path(File.dirname($0))`:

/Users/alans/working/player_headshot_thumbnail_viewer/bin

If `bundle exec bin/player_headshot_thumbnail_viewer run` is run on the command line while in the root of the app, the same output will show up.

However, if the working directory is moved to the apps "bin" directory and the command is `/Users/alans/.rvm/gems/ruby-2.1.0/bin` and you're using rvm, the output will be:

/Users/alans/.rvm/gems/ruby-2.1.0/bin

[1]: https://github.com/davetron5000/gli

Debugging Stuff

I'm moving stuff around right now. All this below is helping me figure out where to put stuff

        -- title

Building Ruby GLI Apps in Sublime Text 2

-- p

I'm switching to Ruby for my main coding language. When I used to code in Perl, I started command line apps with my own little framework. I pieced together over the years to provide a basic configuration, logging, etc... functionality that I use in every app. Being new to language, I don't have the knowledge or skill to create one yet in Ruby. This is not a problem since I found the excellent *[Git-Like Interface Command Line Parser][1]* (aka "GLI").

-- p

From the description:

-- p

> GLI is the best way to make a “command-suite” command-line application, e.g. one like git. GLI allows you to make a polished, easy-to-maintain command-line application without a lot of syntax, but without restricting you in any way from the power of OptionParser.

-- p

This is for a project file that looks like this:

-- code/

{
    "folders": [
      {
        "path": "."
      }
    ]
    ,
    "build_systems": [
      {
        "env":{
          "PATH":"${HOME}/.rvm/bin:${PATH}"
        },
        "name": "Bundle exec bin/project_name run",
        "working_dir": "${project_path:${folder}}",
        "cmd": ["rvm-auto-ruby","-S", "bundle", "exec", "bin/$project_base_name", "run"]
      }
    ]
  }

-- /code

-- p

Note that when run with from Sublime Text with this, you'll see something likes for `File.expand_path(File.dirname($0))`:

-- p

/Users/alans/working/player_headshot_thumbnail_viewer/bin

-- p

If `bundle exec bin/player_headshot_thumbnail_viewer run` is run on the command line while in the root of the app, the same output will show up.

-- p

However, if the working directory is moved to the apps "bin" directory and the command is `/Users/alans/.rvm/gems/ruby-2.1.0/bin` and you're using rvm, the output will be:

-- p

/Users/alans/.rvm/gems/ruby-2.1.0/bin

-- p

[1]: https://github.com/davetron5000/gli


-- categories
-- Ruby
-- Programming

-- metadata
-- date: 2014-05-09 00:00:00
-- id: 20emyuyw
-- status: published
-- type: post
-- SCRUBBED_NEO: false
-- site: aws