Parent

GemInstaller::Application

Attributes

config_builder[RW]

we have accessors instead of just writers so that we can ensure it is assembled correctly in the dependency injector test

install_processor[RW]

we have accessors instead of just writers so that we can ensure it is assembled correctly in the dependency injector test

output_filter[RW]

we have accessors instead of just writers so that we can ensure it is assembled correctly in the dependency injector test

arg_parser[RW]

we have accessors instead of just writers so that we can ensure it is assembled correctly in the dependency injector test

args[RW]

we have accessors instead of just writers so that we can ensure it is assembled correctly in the dependency injector test

options[RW]

we have accessors instead of just writers so that we can ensure it is assembled correctly in the dependency injector test

rogue_gem_finder[RW]

we have accessors instead of just writers so that we can ensure it is assembled correctly in the dependency injector test

bundler_exporter[RW]

we have accessors instead of just writers so that we can ensure it is assembled correctly in the dependency injector test

autogem[W]

Public Class Methods

new() click to toggle source
   # File lib/geminstaller/application.rb, line 7
7:     def initialize
8:       @args = nil
9:     end

Public Instance Methods

autogem() click to toggle source
    # File lib/geminstaller/application.rb, line 39
39:     def autogem
40:       begin
41:         # TODO: do some validation that args only contains --config option, especially not print_rogue_gems since this would mask a missing file error
42:         exit_flag_and_return_code = handle_args
43:         if exit_flag_and_return_code[0]
44:           return exit_flag_and_return_code[1]
45:         end
46:         gems = create_gems_from_config
47:         message = "GemInstaller is automatically requiring gems: "
48:         print_startup_message(gems, message)
49:         return @autogem.autogem(gems)
50:       rescue Exception => e
51:         handle_exception(e)
52:         return 1
53:       end
54:     end
create_gems_from_config() click to toggle source
    # File lib/geminstaller/application.rb, line 65
65:     def create_gems_from_config
66:       begin
67:         config = @config_builder.build_config
68:       rescue GemInstaller::MissingFileError => e
69:         # if user wants to print rogue gems and they have no config at all, don't show an error
70:         return [] if @options[:print_rogue_gems] && (@config_builder.config_file_paths_array.size == 1) 
71:         missing_path = e.message
72:         error_message = "Error: A GemInstaller config file is missing at #{missing_path}.  You can generate one with the --print-rogue-gems option.  See the GemInstaller docs at http://geminstaller.rubyforge.org for more info."
73:         raise GemInstaller::MissingFileError.new(error_message)
74:       end
75:       config.gems
76:     end
handle_args() click to toggle source
    # File lib/geminstaller/application.rb, line 84
84:     def handle_args
85:       return_code = @arg_parser.parse(@args)
86:       arg_parser_output = @arg_parser.output
87:       if (arg_parser_output && arg_parser_output != '')
88:         if return_code == 0
89:           @output_filter.geminstaller_output(:info,arg_parser_output)
90:         else
91:           @output_filter.geminstaller_output(:error,arg_parser_output)
92:         end
93:         return [true, return_code]
94:       end
95:       config_file_paths = @options[:config_paths]
96:       @config_builder.config_file_paths = config_file_paths if config_file_paths
97:       return [false, 0]
98:     end
handle_exception(e) click to toggle source
    # File lib/geminstaller/application.rb, line 56
56:     def handle_exception(e)
57:       message = e.message
58:       message += "\n"
59:       @output_filter.geminstaller_output(:error,message)
60:       backtrace_as_string = e.backtrace.join("\n")
61:       @output_filter.geminstaller_output(:debug,"#{backtrace_as_string}\n")
62:       raise e if @options[:exceptions]
63:     end
install() click to toggle source
    # File lib/geminstaller/application.rb, line 11
11:     def install
12:       begin
13:         exit_flag_and_return_code = handle_args
14:         if exit_flag_and_return_code[0]
15:           return exit_flag_and_return_code[1]
16:         end
17:         if @options[:bundler_export]
18:           @bundler_exporter.output(@config_builder.build_config)
19:           return 0
20:         end
21:         gems = create_gems_from_config
22:         if @options[:print_rogue_gems]
23:           @rogue_gem_finder.print_rogue_gems(gems, @config_builder.config_file_paths_array)
24:           return 0
25:         end
26:         if gems.size == 0
27:           message = "No gems found in config file.  Try the --print-rogue-gems option to help populate your config file."
28:           @output_filter.geminstaller_output(:info,message + "\n")          
29:         else
30:           process_gems(gems)
31:         end
32:       rescue Exception => e
33:         handle_exception(e)
34:         return 1
35:       end
36:       return 0
37:     end
process_gems(gems) click to toggle source
    # File lib/geminstaller/application.rb, line 78
78:     def process_gems(gems)
79:       message = "GemInstaller is verifying gem installation: "
80:       print_startup_message(gems, message)
81:       @install_processor.process(gems)
82:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.