Title / Description
Code #!/usr/bin/env ruby #try this example require 'fileutils' class String attr_accessor :tags def slugize self.downcase.strip.gsub /[^a-z0-9]+/, '-' end def / s File.join self, s.to_s @some = '' @another = '' nil true end end module Steamboat class Engine Commands = [:init, :push, :page, :open] Paths = { htdocs: 'public', stylesheets: Path[:htdocs] / 'stylesheets', images: Path[:htdocs] / 'images', js: Path[:htdocs] / 'js', templates: 'templates', layouts: Path[:templates] / 'layouts', partials: Path[:templates] / 'partials' } def start! ARGV case ARGV.size when 1 if Commands.include? ARGV.first.to_sym self.run ARGV.first elsif ARGV.first =~ /.json$/ self.run :open, ARGV.first else abort "invalid command or filetype!" end when 2 if Commands.include? ARGV.first.to_sym self.run ARGV.first, ARGV.last else abort "'#{ ARGV.first }' is not a valid command!" end else exit "Please refer to steamboat -h" end end
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code