Sha256: fd0b4eef39bbad61663e21c7e89a372f4875978136729196bb8b14bc849ef374

Contents?: true

Size: 1.07 KB

Versions: 3

Compression:

Stored size: 1.07 KB

Contents

module Hyde
  class CLICommand
    @@description = nil

    def self.ostream
      STDERR
    end

    def self.log(str)
      ostream << str << "\n"
    end

    def self.out(str)
      puts str
    end

    def self.help
      log "Usage: hyde #{self.to_s.downcase.split(':')[-1]}"
      log "No help for this command."
    end

    def self.lib_path
      @@lib_path ||= File.expand_path(File.join(File.dirname(__FILE__), '..'))
    end

    def self.project
      if $project.nil?
        log "Error: Hyde config file not found. (looking for: hyde.conf, _config.yml)"
        log "Run this command in a Hyde project directory.\nTo start a new Hyde project, type `hyde create <name>`"
        exit
      end
      $project
    end

    def self.hidden?
      false
    end

    def self.hidden(bool = true)
      class_eval %{
        def self.hidden?
          #{bool.inspect}
        end
      }
    end

    def self.desc(str)
      class_eval %{
        def self.description
          "#{str.gsub('\"','\\\"')}"
        end
      }
    end

    def self.description
      ""
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hydeweb-0.0.5 lib/hyde/clicommand.rb
hydeweb-0.0.4 lib/hyde/clicommand.rb
hydeweb-0.0.3.pre lib/hyde/clicommand.rb