Class: AppCommand::APIMeta

Inherits:
Convoy::ActionCommand::Base
  • Object
show all
Defined in:
lib/routes/api_meta.rb

Instance Method Summary collapse

Instance Method Details

#executeObject



5
6
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
# File 'lib/routes/api_meta.rb', line 5

def execute

    begin

        @opts = command_options
        @args = arguments

        opts_validate

        @site          = Blufin::SiteResolver::validate_site(@args[0])
        @error_handler = Blufin::YmlErrorHandler.new(@site)

        Blufin::SiteEmbedded::init(Blufin::ScannerJavaEmbeddedObjects::new(@site, @error_handler).get_data)

        @yml_config = Blufin::YmlConfigValidator.new(@site, @error_handler)

        Blufin::SiteAuth::init(@yml_config.config_data[Blufin::YmlConfigValidator::GLOBAL][Blufin::YmlConfigValidator::GLOBAL_AUTHENTICATION])

        @yml_schema = Blufin::YmlSchemaValidator.new(@site, @error_handler)

        opts_routing

    rescue => e

        Blufin::Terminal::print_exception(e)

    end

end

#opts_routingObject



47
48
49
50
51
52
53
54
55
# File 'lib/routes/api_meta.rb', line 47

def opts_routing

    system('clear') unless @opts[:as_json]

    @yml_schema.get_yml_schema_outputter.show_auto_increment if @opts[:show_auto_increment]
    @yml_schema.get_yml_schema_outputter.show_enums if @opts[:show_enums]
    @yml_schema.get_yml_schema_outputter.show_resources(@opts[:as_json]) if @opts[:show_resources]

end

#opts_validateObject



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/routes/api_meta.rb', line 35

def opts_validate

    # Show help if no flags.
    if Blufin::Routes::flags_set(@opts) == 0

        system("#{App::GEM_NAME} p am -h")
        exit

    end

end