Class: KBuilder::Watch::CliOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/k_builder/watch/cli_options.rb

Overview

List of and options paths that are relevant to the KBuilder::Watch::Cli

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCliOptions

Returns a new instance of CliOptions.



42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/k_builder/watch/cli_options.rb', line 42

def initialize
  @base_path = Dir.pwd

  @watch_path_arg = nil
  @watch_path = nil

  @new_arg = nil
  @new_app_path = nil
  @new_watch_path = nil

  @debug = false
  @help = false
end

Instance Attribute Details

#base_pathObject

This is the path that the watcher was started from. It is the default base path that other paths are relative to.

Note: it is not used when paths are supplied in absolute form



16
17
18
# File 'lib/k_builder/watch/cli_options.rb', line 16

def base_path
  @base_path
end

#debugObject

Returns the value of attribute debug.



39
40
41
# File 'lib/k_builder/watch/cli_options.rb', line 39

def debug
  @debug
end

#helpObject

Returns the value of attribute help.



40
41
42
# File 'lib/k_builder/watch/cli_options.rb', line 40

def help
  @help
end

#new_app_pathObject

Path to where the application will reside



34
35
36
# File 'lib/k_builder/watch/cli_options.rb', line 34

def new_app_path
  @new_app_path
end

#new_argObject

What :new_arg is passed in for creating a new application with with .builder watch capability



31
32
33
# File 'lib/k_builder/watch/cli_options.rb', line 31

def new_arg
  @new_arg
end

#new_watch_pathObject

Path to where the .builder files will reside



37
38
39
# File 'lib/k_builder/watch/cli_options.rb', line 37

def new_watch_path
  @new_watch_path
end

#watch_pathObject

Returns the value of attribute watch_path.



27
28
29
# File 'lib/k_builder/watch/cli_options.rb', line 27

def watch_path
  @watch_path
end

#watch_path_argObject

What watch_path argument is passed in for watching

This attribute will be help to build :watch_path

A relative path will be relative to base_path An absolute path is used as is A home path is used as is



26
27
28
# File 'lib/k_builder/watch/cli_options.rb', line 26

def watch_path_arg
  @watch_path_arg
end

Instance Method Details

#debug?Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/k_builder/watch/cli_options.rb', line 60

def debug?
  !!@debug
end

#help?Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/k_builder/watch/cli_options.rb', line 56

def help?
  !!@help
end

#new?Boolean

Returns:

  • (Boolean)


64
65
66
# File 'lib/k_builder/watch/cli_options.rb', line 64

def new?
  !!@new_arg
end

#to_hObject



68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/k_builder/watch/cli_options.rb', line 68

def to_h
  {
    debug: debug?,
    help: help?,
    new: new?,
    base_path: base_path,
    watch_path_arg: watch_path_arg,
    watch_path: watch_path,
    new_arg: new_arg,
    new_app_path: new_app_path,
    new_watch_path: new_watch_path
  }
end