Module: ChefFixie::Console
Constant Summary collapse
- @@started_from_command_line =
true
Instance Method Summary collapse
Instance Method Details
#configure ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/chef_fixie/console.rb', line 41 def configure config_file = nil if ARGV.first && ARGV[0].chars.first != "-" && config_file = ARGV.shift config_file = File.(config_file) end ChefFixie.load_config(config_file) = {} OptionParser.new do |opt| opt. = "Usage: fixie [config] [options]" opt.on("--authz_uri AUTH_URI", "The URI of the opscode authz service") { |v| [:authz_uri] = v } opt.on("--sql_database DATABASE", "The URI of the opscode_chef database") { |v| [:sql_database] = v } opt.on_tail("-h", "--help", "Show this message") do puts opt puts "\nExample configuration file:\n\n" puts ChefFixie::Config.instance.example_config puts "\n" exit(1) end opt.parse!(ARGV) end pp :cli_opts => if ENV["DEBUG"] ChefFixie::Config.instance.merge_opts() puts ChefFixie::Config.instance.to_text end |
#configure_pry ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/chef_fixie/console.rb', line 68 def configure_pry Pry.config.history_file = "~/.fixie_history" Pry.config.prompt_name = "fixie" Pry::Commands.block_command("fixie-help", "Show fixie's help") do output.puts("** ORGS **\n* access with ORGS or ORGS\n* access a specific org: ORGS['orgname']\n\n** USERS **\n* users.find('clownco-org-admin')\n* users.grep :clownco\n* users.usernames\n\n** RAW SQL ACCESS**\n* sql[:users].select(:column, :column).where(:column => \"condition\").all\n\n** irb Help **\nirb_help\n\n") end end |
#start ⇒ Object
34 35 36 37 38 39 |
# File 'lib/chef_fixie/console.rb', line 34 def start configure ChefFixie.setup configure_pry Pry.start end |
#started_from_command_line? ⇒ Boolean
92 93 94 |
# File 'lib/chef_fixie/console.rb', line 92 def started_from_command_line? @@started_from_command_line == true end |