Sha256: 07baac26acc8e00e386a7578d7ebfcde5c7e87c297437af5f7559dacc98a004d

Contents?: true

Size: 1.04 KB

Versions: 6

Compression:

Stored size: 1.04 KB

Contents

module Gritano
  module Console
    class Gritano < Gritano::Console::Base

      def initialize(stdin = STDIN, home_dir = Etc.getpwuid.dir, repo_path = Etc.getpwuid.dir)
        @stdin = stdin
        @home_dir = home_dir
        @repo_path = repo_path
        @ssh_path = File.join(@home_dir, '.ssh')
        super(@stdin, @home_dir)
      end

      add_command "help" do |argv|
        Gritano.commands = Gritano.commands.merge(Installer.commands).merge(Executor.commands)
        [true, Gritano.help]
      end

      add_command "version" do |argv|
        version = "v#{File.open(File.join(File.dirname(__FILE__), '..', '..', '..', 'VERSION')).readlines.join}"
        [true, version]
      end

      def method_missing(meth, *args, &block)
        params = [meth.to_s.gsub("_", ":")] + args[0]
        begin
          installer = Installer.new(@stdin, @home_dir)
          installer.execute(params)
        rescue
          executor = Executor.new(@stdin, @home_dir, @repo_path)
          executor.execute(params)
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gritano-1.0.0 lib/gritano/console/gritano.rb
gritano-0.11.2 lib/gritano/console/gritano.rb
gritano-0.11.1 lib/gritano/console/gritano.rb
gritano-0.11.0 lib/gritano/console/gritano.rb
gritano-0.6.0 lib/gritano/console/gritano.rb
gritano-0.5.4 lib/gritano/console/gritano.rb