Class: Convoy::SetupAccessor

Inherits:
Object
  • Object
show all
Defined in:
lib/convoy/setup_accessor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(global_instance) ⇒ SetupAccessor

Returns a new instance of SetupAccessor.



5
6
7
# File 'lib/convoy/setup_accessor.rb', line 5

def initialize(global_instance)
    @global_instance = global_instance
end

Instance Attribute Details

#global_instanceObject (readonly)

Returns the value of attribute global_instance.



3
4
5
# File 'lib/convoy/setup_accessor.rb', line 3

def global_instance
  @global_instance
end

Instance Method Details

#action_for(context = []) ⇒ Object



45
46
47
48
49
# File 'lib/convoy/setup_accessor.rb', line 45

def action_for(context = [])
    with_context(context) do |current_context|
        action_block_from(current_context)
    end
end

#add_global_command(name, options = {}, &block) ⇒ Object



113
114
115
# File 'lib/convoy/setup_accessor.rb', line 113

def add_global_command(name, options = {}, &block)
    global_instance.command(name, options, &block)
end

#add_global_option(name, desc, options = {}) ⇒ Object



106
107
108
109
110
111
# File 'lib/convoy/setup_accessor.rb', line 106

def add_global_option(name, desc, options = {})
    with_context([]) do |current_context|
        options_object = options_object_from(current_context)
        options_object.opt name, desc, options
    end
end

#arguments_required_for(context = []) ⇒ Object



51
52
53
54
55
# File 'lib/convoy/setup_accessor.rb', line 51

def arguments_required_for(context = [])
    with_context(context) do |current_context|
        context_requires_arguments(current_context)
    end
end

#canonical_command_names_for(context = []) ⇒ Object



39
40
41
42
43
# File 'lib/convoy/setup_accessor.rb', line 39

def canonical_command_names_for(context = [])
    with_context(context) do |current_context|
        canonical_command_names_from(current_context)
    end
end

#command_aliases_for(command_name, context = []) ⇒ Object



99
100
101
102
103
104
# File 'lib/convoy/setup_accessor.rb', line 99

def command_aliases_for(command_name, context = [])
    with_context(context) do |current_context|
        commands    = fetch_instance_variable_from(current_context, :commands)
        description = fetch_instance_variable_from(commands[command_name], :aliases)
    end
end

#command_description_for(command_name, context = []) ⇒ Object



85
86
87
88
89
90
# File 'lib/convoy/setup_accessor.rb', line 85

def command_description_for(command_name, context = [])
    with_context(context) do |current_context|
        commands = fetch_instance_variable_from(current_context, :commands)
        fetch_instance_variable_from(commands[command_name], :description)
    end
end

#command_names_for(context = []) ⇒ Object



33
34
35
36
37
# File 'lib/convoy/setup_accessor.rb', line 33

def command_names_for(context = [])
    with_context(context) do |current_context|
        command_names_from(current_context)
    end
end

#command_summary_for(command_name, context = []) ⇒ Object



92
93
94
95
96
97
# File 'lib/convoy/setup_accessor.rb', line 92

def command_summary_for(command_name, context = [])
    with_context(context) do |current_context|
        commands = fetch_instance_variable_from(current_context, :commands)
        fetch_instance_variable_from(commands[command_name], :summary)
    end
end

#config_fileObject



65
66
67
# File 'lib/convoy/setup_accessor.rb', line 65

def config_file
    name = fetch_instance_variable_from(config_file_object, :name)
end

#config_file_autocreatable?Boolean

Returns:

  • (Boolean)


61
62
63
# File 'lib/convoy/setup_accessor.rb', line 61

def config_file_autocreatable?
    autocreatable = fetch_instance_variable_from(config_file_object, :autocreate)
end

#conflicting_options_for(context = []) ⇒ Object



15
16
17
18
19
# File 'lib/convoy/setup_accessor.rb', line 15

def conflicting_options_for(context = [])
    with_context(context) do |current_context|
        conflicts_hash_for(current_context)
    end
end

#dependencies_for(context = []) ⇒ Object



27
28
29
30
31
# File 'lib/convoy/setup_accessor.rb', line 27

def dependencies_for(context = [])
    with_context(context) do |current_context|
        dependencies_hash_from(current_context)
    end
end

#description_for(context = []) ⇒ Object



79
80
81
82
83
# File 'lib/convoy/setup_accessor.rb', line 79

def description_for(context = [])
    with_context(context) do |current_context|
        fetch_instance_variable_from(current_context, :description)
    end
end

#has_config_file?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/convoy/setup_accessor.rb', line 57

def has_config_file?
    config_file_object != nil
end

#options_for(context = []) ⇒ Object



9
10
11
12
13
# File 'lib/convoy/setup_accessor.rb', line 9

def options_for(context = [])
    with_context(context) do |current_context|
        options_hash_from(current_context)
    end
end

#summary_for(context = []) ⇒ Object



73
74
75
76
77
# File 'lib/convoy/setup_accessor.rb', line 73

def summary_for(context = [])
    with_context(context) do |current_context|
        fetch_instance_variable_from(current_context, :summary)
    end
end

#validations_for(context = []) ⇒ Object



21
22
23
24
25
# File 'lib/convoy/setup_accessor.rb', line 21

def validations_for(context = [])
    with_context(context) do |current_context|
        validations_hash_from(current_context)
    end
end

#versionObject



69
70
71
# File 'lib/convoy/setup_accessor.rb', line 69

def version
    version_string = fetch_instance_variable_from(global_instance, :version)
end