Class: CrossPlane::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/crossplane/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Config

Returns a new instance of Config.



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
# File 'lib/crossplane/config.rb', line 11

def initialize(*args)
	self.common_opts = {

	}

	self.parse_opts = {
		'out' => {:name => :out, :aliases => ['-o'], :banner => '<string>', :desc => 'write output to a file', :type => :string, :required => false},
		'pretty' => {:name => :pretty, :desc => 'pretty print the json output', :type => :boolean, :required => false, :default => :false},
		'ignore' => {:name => :ignore, :banner => '<str>', :desc => 'ignore directives (comma-separated)', :type => :string, :required => false, :default => []},
		'no-catch' => {:name => :no_catch, :desc => 'only collect first error in file', :type => :boolean, :required => false, :default => :false},
		#'tb-onerror' => {:name => :tb_onerror, :desc => 'include tracebacks in config errors', :type => :boolean, :required => false},
		#'combine' => {:name => :combine, :desc => 'use includes to create one single file', :type => :boolean, :required => false},
		#'single' => {:name => :single, :desc => 'do not include other config files', :type => :boolean, :required => false},
		'include-comments' => {:name => :include_comments, :desc => 'include comments in json', :type => :boolean, :required => false, :default => :false},
		'strict' => {:name => :strict, :desc => 'raise errors for unknown directives', :type => :boolean, :required => false, :default => :false},
	}

	self.build_opts = {
		'dir' => {:name => :dir, :banner => '<string>', :desc => 'the base directory to build in', :type => :string, :required => false},
		'force' => {:name => :force, :desc => 'overwrite existing files', :type => :boolean, :required => false},
		'indent' => {:name => :indent, :banner => '<string>', :desc => 'number of spaces to indent output', :type => :numeric, :required => false, :default => 4},
		'tabs' => {:name => :tabs, :desc => 'indent with tabs instead of spaces', :type => :boolean, :required => false},
		#'no-headers' => {:name => :no_header2, :desc => 'do not write header to configsd', :type => :boolean, :required => false},
		'stdout' => {:name => :stdout, :desc => 'write configs to stdout instead', :type => :boolean, :required => false},
	}

	self.lex_opts = {
		'out' => {:name => :out, :aliases => ['-o'], :banner => '<string>', :desc => 'write output to a file', :type => :string, :required => false},
		'indent' => {:name => :indent, :aliases => ['-i'], :banner => '<int>', :desc => 'number of spaces to indent output', :type => :numeric, :required => false, :default => 4},
		'numbers' => {:name => :line_numbers, :aliases => ['-n'], :desc => 'include line numbers in json payload', :type => :boolean, :required => false, :default => true},
	}
end

Instance Attribute Details

#build_optsObject

Returns the value of attribute build_opts.



6
7
8
# File 'lib/crossplane/config.rb', line 6

def build_opts
  @build_opts
end

#common_optsObject

Returns the value of attribute common_opts.



4
5
6
# File 'lib/crossplane/config.rb', line 4

def common_opts
  @common_opts
end

#format_optsObject

Returns the value of attribute format_opts.



9
10
11
# File 'lib/crossplane/config.rb', line 9

def format_opts
  @format_opts
end

#lex_optsObject

Returns the value of attribute lex_opts.



7
8
9
# File 'lib/crossplane/config.rb', line 7

def lex_opts
  @lex_opts
end

#minify_optsObject

Returns the value of attribute minify_opts.



8
9
10
# File 'lib/crossplane/config.rb', line 8

def minify_opts
  @minify_opts
end

#optsObject

Returns the value of attribute opts.



3
4
5
# File 'lib/crossplane/config.rb', line 3

def opts
  @opts
end

#parse_optsObject

Returns the value of attribute parse_opts.



5
6
7
# File 'lib/crossplane/config.rb', line 5

def parse_opts
  @parse_opts
end

Instance Method Details

#build_optionsObject



48
49
50
# File 'lib/crossplane/config.rb', line 48

def build_options()
	return self.common_opts.merge(self.build_opts).map { |_k, v| v }
end

#lex_optionsObject



52
53
54
# File 'lib/crossplane/config.rb', line 52

def lex_options()
	return self.common_opts.merge(self.lex_opts).map { |_k, v| v }
end

#parse_optionsObject



44
45
46
# File 'lib/crossplane/config.rb', line 44

def parse_options()
	return self.common_opts.merge(self.parse_opts).map { |_k, v| v }
end