Class: Awestruct::Config

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = Awestruct::CLI::Options.new) ⇒ Config

Returns a new instance of Config.



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/awestruct/config.rb', line 27

def initialize(opts = Awestruct::CLI::Options.new)
  @dir             = Pathname.new(File.expand_path(Pathname.new( opts.source_dir )))
  @layouts_dir     = Pathname.new( File.join(@dir, '_layouts') )
  @config_dir      = Pathname.new( File.join(@dir, '_config') )
  @input_dir       = @dir
  @output_dir      = Pathname.new(File.expand_path(Pathname.new( opts.output_dir )))
  @extension_dir   = Pathname.new( File.join(@dir, '_ext') )
  @skin_dir        = Pathname.new( File.join(@dir, '_skin') )
  @tmp_dir         = Pathname.new( File.join(@dir, '_tmp') )
  @images_dir      = Pathname.new( File.join(@dir, 'images') )
  @stylesheets_dir = Pathname.new( File.join(@dir, 'stylesheets') )

  @options = opts
  @verbose = opts.verbose
  @debug = opts.debug
  @perf = opts.perf_log

  # Dir[] doesn't like empty list
  ignore_file = File.join(@dir, ".awestruct_ignore")
  if File.exist?(ignore_file)
    ignore_stmts = IO.read(ignore_file).each_line.map(&:strip)
  end

  @ignore = (!ignore_stmts.nil? and ignore_stmts.size > 0) ? Dir[*ignore_stmts] : []

  @track_dependencies = false
end

Instance Attribute Details

#config_dirObject

Returns the value of attribute config_dir.



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

def config_dir
  @config_dir
end

#debugObject

Returns the value of attribute debug.



24
25
26
# File 'lib/awestruct/config.rb', line 24

def debug
  @debug
end

#dirObject

Returns the value of attribute dir.



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

def dir
  @dir
end

#extension_dirObject

Returns the value of attribute extension_dir.



10
11
12
# File 'lib/awestruct/config.rb', line 10

def extension_dir
  @extension_dir
end

#ignoreObject

Returns the value of attribute ignore.



15
16
17
# File 'lib/awestruct/config.rb', line 15

def ignore
  @ignore
end

#images_dirObject

Returns the value of attribute images_dir.



18
19
20
# File 'lib/awestruct/config.rb', line 18

def images_dir
  @images_dir
end

#input_dirObject

Returns the value of attribute input_dir.



11
12
13
# File 'lib/awestruct/config.rb', line 11

def input_dir
  @input_dir
end

#layouts_dirObject

Returns the value of attribute layouts_dir.



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

def layouts_dir
  @layouts_dir
end

#optionsObject

Returns the value of attribute options.



23
24
25
# File 'lib/awestruct/config.rb', line 23

def options
  @options
end

#output_dirObject

Returns the value of attribute output_dir.



12
13
14
# File 'lib/awestruct/config.rb', line 12

def output_dir
  @output_dir
end

#perfObject

Returns the value of attribute perf.



25
26
27
# File 'lib/awestruct/config.rb', line 25

def perf
  @perf
end

#quietObject

Returns the value of attribute quiet.



22
23
24
# File 'lib/awestruct/config.rb', line 22

def quiet
  @quiet
end

#skin_dirObject

Returns the value of attribute skin_dir.



13
14
15
# File 'lib/awestruct/config.rb', line 13

def skin_dir
  @skin_dir
end

#stylesheets_dirObject

Returns the value of attribute stylesheets_dir.



19
20
21
# File 'lib/awestruct/config.rb', line 19

def stylesheets_dir
  @stylesheets_dir
end

#tmp_dirObject

Returns the value of attribute tmp_dir.



14
15
16
# File 'lib/awestruct/config.rb', line 14

def tmp_dir
  @tmp_dir
end

#track_dependenciesObject

Returns the value of attribute track_dependencies.



16
17
18
# File 'lib/awestruct/config.rb', line 16

def track_dependencies
  @track_dependencies
end

#verboseObject

Returns the value of attribute verbose.



21
22
23
# File 'lib/awestruct/config.rb', line 21

def verbose
  @verbose
end