Class: Rake::Builder::LocalConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/rake/builder/local_config.rb

Constant Summary collapse

VERSIONS =
['1.0', '1.1']

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_name) ⇒ LocalConfig

Returns a new instance of LocalConfig.


10
11
12
13
14
# File 'lib/rake/builder/local_config.rb', line 10

def initialize(file_name)
  @file_name           = file_name
  @include_paths       = []
  @compilation_options = []
end

Instance Attribute Details

#compilation_optionsObject

Returns the value of attribute compilation_options


8
9
10
# File 'lib/rake/builder/local_config.rb', line 8

def compilation_options
  @compilation_options
end

#include_pathsObject

Returns the value of attribute include_paths


7
8
9
# File 'lib/rake/builder/local_config.rb', line 7

def include_paths
  @include_paths
end

Instance Method Details

#loadObject


16
17
18
19
20
21
22
23
24
25
# File 'lib/rake/builder/local_config.rb', line 16

def load
  config = YAML.load_file(@file_name)

  version              = config[:rake_builder][:config_file][:version]
  if not VERSIONS.include?(version)
    raise Rake::Builder::Error.new('Config file version incorrect') 
  end
  @include_paths       = config[:include_paths]
  @compilation_options = config[:compilation_options]
end

#saveObject


27
28
29
30
31
# File 'lib/rake/builder/local_config.rb', line 27

def save
  File.open(@file_name, 'w') do |file|
    file.write config.to_yaml
  end
end