Sha256: a7f385839583229bea7d3a43e04230464545aeb37905a9f0341a38e1fb507cd9

Contents?: true

Size: 1.9 KB

Versions: 80

Compression:

Stored size: 1.9 KB

Contents

require 'irb'
require 'irb/completion'

ARGV << '--help' if ARGV.empty?

aliases = {
  'i' => 'interactive',
  'f' => 'fetch'
}

command = ARGV.shift
command = aliases[command] || command

require 'origen/global_methods'
include Origen::GlobalMethods

if ARGV.delete('-d') || ARGV.delete('--debug')
  begin
    if RUBY_VERSION >= '2.0.0'
      require 'byebug'
    else
      require 'rubygems'
      require 'ruby-debug'
    end
  rescue LoadError
    def debugger
      caller[0] =~ /.*\/(\w+\.rb):(\d+).*/
      puts 'The debugger gem is not installed, add the following to your Gemfile:'
      puts
      puts "if RUBY_VERSION >= '2.0.0'"
      puts "  gem 'byebug', '~>3.5'"
      puts 'else'
      puts "  gem 'debugger', '~>1.6'"
      puts 'end'
      puts
    end
  end
  Origen.enable_debugger
else
  def debugger
    caller[0] =~ /.*\/(\w+\.rb):(\d+).*/
    puts "#{Regexp.last_match[1]}:#{Regexp.last_match[2]} - debugger statement ignored, run again with '-d' to enable it"
  end
end

case command

when 'new'
  require 'origen/commands/new'
  exit 0

when '--version', '-v'
  require 'origen/commands/version'
  exit 0

# when 'fetch', 'f'
#  require 'origen/commands/fetch'
#  exit 0

when 'interactive'
  IRB.start

else
  puts 'Error: Command not recognized' unless ['-h', '--help'].include?(command)
  puts <<-EOT
Usage: origen COMMAND [ARGS]

The following commands are available:
 new          Create a new Origen application or plugin. "origen new my_app" creates a
              new origen application workspace in "./my_app"
 interactive  Start an interactive Origen console (short-cut alias: "i"), this is just
              IRB with the 'origen' lib loaded automatically

Many commands can be run with -h (or --help) for more information.
  EOT
  # fetch        Automatically creates the workspace for the requested plugin and
  #              populates the latest version of the plugin (short-cut alias: "f")
  exit 0
end

Version data entries

80 entries across 80 versions & 1 rubygems

Version Path
origen-0.20.3 lib/origen/commands_global.rb
origen-0.20.2 lib/origen/commands_global.rb
origen-0.20.1 lib/origen/commands_global.rb
origen-0.20.0 lib/origen/commands_global.rb
origen-0.13.0 lib/origen/commands_global.rb
origen-0.12.1 lib/origen/commands_global.rb
origen-0.12.0 lib/origen/commands_global.rb
origen-0.11.0 lib/origen/commands_global.rb
origen-0.10.1 lib/origen/commands_global.rb
origen-0.9.1 lib/origen/commands_global.rb
origen-0.9.0 lib/origen/commands_global.rb
origen-0.8.0 lib/origen/commands_global.rb
origen-0.7.47 lib/origen/commands_global.rb
origen-0.7.46 lib/origen/commands_global.rb
origen-0.7.45 lib/origen/commands_global.rb
origen-0.7.44 lib/origen/commands_global.rb
origen-0.7.43 lib/origen/commands_global.rb
origen-0.7.42 lib/origen/commands_global.rb
origen-0.7.41 lib/origen/commands_global.rb
origen-0.7.40 lib/origen/commands_global.rb