Sha256: 4324c2d55d436532bd073528e60808eace781555a213a93458412e1e0f348470

Contents?: true

Size: 1.45 KB

Versions: 117

Compression:

Stored size: 1.45 KB

Contents

#
# Copyright 2012 Mortar Data Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Portions of this code from heroku (https://github.com/heroku/heroku/) Copyright Heroku 2008 - 2012,
# used under an MIT license (https://github.com/heroku/heroku/blob/master/LICENSE).
#

require "mortar"
require "mortar/command"
require "mortar/helpers"

# workaround for rescue/reraise to define errors in command.rb failing in 1.8.6
#if RUBY_VERSION =~ /^1.8.6/
#  require('mortar-api')
#  require('rest_client')
#end

class Mortar::CLI

  extend Mortar::Helpers

  def self.start(*args)
    begin
      if $stdin.isatty
        $stdin.sync = true
      end
      if $stdout.isatty
        $stdout.sync = true
      end
      command = args.shift.strip rescue "help"
      Mortar::Command.load
      Mortar::Command.run(command, args)
    rescue Interrupt
      `stty icanon echo`
      error("Command cancelled.")
    rescue => error
      styled_error(error)
      exit(1)
    end
  end

end

Version data entries

117 entries across 117 versions & 1 rubygems

Version Path
mortar-0.15.53 lib/mortar/cli.rb
mortar-0.15.52 lib/mortar/cli.rb
mortar-0.15.51 lib/mortar/cli.rb
mortar-0.15.50 lib/mortar/cli.rb
mortar-0.15.49 lib/mortar/cli.rb
mortar-0.15.48 lib/mortar/cli.rb
mortar-0.15.47 lib/mortar/cli.rb
mortar-0.15.46 lib/mortar/cli.rb
mortar-0.15.45 lib/mortar/cli.rb
mortar-0.15.44 lib/mortar/cli.rb
mortar-0.15.43 lib/mortar/cli.rb
mortar-0.15.42 lib/mortar/cli.rb
mortar-0.15.41 lib/mortar/cli.rb
mortar-0.15.40 lib/mortar/cli.rb
mortar-0.15.39 lib/mortar/cli.rb
mortar-0.15.38 lib/mortar/cli.rb
mortar-0.15.37 lib/mortar/cli.rb
mortar-0.15.36 lib/mortar/cli.rb
mortar-0.15.35 lib/mortar/cli.rb
mortar-0.15.34 lib/mortar/cli.rb