Class: RXCode::Commands::Env

Inherits:
RXCode::Command show all
Defined in:
lib/rxcode/commands/env.rb

Overview

Displays information about the current XCode environment

Instance Attribute Summary

Attributes inherited from RXCode::Command

#arguments, #err, #input, #options, #output

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from RXCode::Command

command_class_for_name, command_names, commands, display_name, #env, inherited, #initialize, new_global_option_parser, run!, run_command

Constructor Details

This class inherits a constructor from RXCode::Command

Class Method Details

.display(env, output = $>) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/rxcode/commands/env.rb', line 9

def self.display(env, output=$>)
  output.puts "[ #{env.root} ]"
  output.puts
  workspace_path = env.workspace_path
  output.puts "Workspace: #{workspace_path || '(none)'}"
  output.puts "Build Location: #{env.workspace.build_location || '(none)'}"
  output.puts "Built Products: #{env.workspace.built_products_dir || '(none)'}"
end

.new_command_option_parserObject



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/rxcode/commands/env.rb', line 29

def self.new_command_option_parser
  Trollop::Parser.new do
    banner <<-TEXT
Displays information about the current XCode environment, culled from the current directory.

Usage:
  #{$0} [global options] env [env_root]

Options:
    TEXT
  end
end

Instance Method Details

#run!Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/rxcode/commands/env.rb', line 18

def run!
  if arguments.empty?
    self.class.display(Dir.pwd)
  else
    arguments.each do |root|
      env = RXCode::Environment.new(File.expand_path(root))
      self.class.display(env)
    end
  end
end