Class: CaseCheck::Params

Inherits:
Object
  • Object
show all
Defined in:
lib/case_check/commands.rb

Instance Method Summary collapse

Constructor Details

#initialize(argv, name = 'cf_case_check') ⇒ Params

Returns a new instance of Params.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/case_check/commands.rb', line 7

def initialize(argv, name='cf_case_check')
  @options = OpenStruct.new
  
  opts = OptionParser.new do |opts|
    opts.banner = "Usage: #{name} [options]"
    
    opts.on("-d", "--dir DIRECTORY", 
            "The application root from which to search.  Defaults to the current directory.") do |p|
      @options.source_directory = p
    end
    
    opts.on("-c", "--config CONFIGYAML", 
            "The configuration file which includes the directories to search for custom tags and CFCs.") do |p|
      @options.configfile = p
    end
    
    opts.on("-a", "--auto-configure DIRECTORY", 
            "Automatically configure the directories to search for custom tag and CFCs using Coldfusion's configuration.  (Coldfusion 8 Only)") do |p|
      @options.coldfusion_directory = p
    end
    
    opts.on("-v", "--verbose", "Show all references, including the ones which can be resolved exactly.") do |v|
      @options.verbose = true
    end

    opts.on_tail("-h", "--help", "Show this message") do
       CaseCheck.status_stream.puts opts
       CaseCheck.exit
    end
    
    opts.on_tail("--version", "Show version") do
      CaseCheck.status_stream.puts "#{name} #{CaseCheck.version}"
      CaseCheck.exit
    end
  end.parse!(argv)
  
  read_config!
end

Instance Method Details

#coldfusion_directoryObject



54
55
56
# File 'lib/case_check/commands.rb', line 54

def coldfusion_directory
  @options.coldfusion_directory || '/opt/coldfusion8'
end

#coldfusion_directory_givenObject



58
59
60
# File 'lib/case_check/commands.rb', line 58

def coldfusion_directory_given
  @options.coldfusion_directory
end

#configuration_fileObject



50
51
52
# File 'lib/case_check/commands.rb', line 50

def configuration_file
  @options.configfile || File.join(source_directory, "cf_case_check.yml")
end

#source_directoryObject



46
47
48
# File 'lib/case_check/commands.rb', line 46

def source_directory
  @options.source_directory || '.'
end

#verbose?Boolean

Returns:

  • (Boolean)


62
63
64
# File 'lib/case_check/commands.rb', line 62

def verbose?
  @options.verbose
end