Module: AssetsPackager::Configuration

Extended by:
Configuration
Included in:
Configuration
Defined in:
lib/assets_packager/configuration.rb

Instance Method Summary collapse

Instance Method Details

#fileObject



15
16
17
# File 'lib/assets_packager/configuration.rb', line 15

def file
  @@file ||= YAML.load_file(file_path).to_hash
end

#file_pathObject



31
32
33
# File 'lib/assets_packager/configuration.rb', line 31

def file_path
  @@file_path ||= current_dir_for('assets.yml')
end

#file_path=(path) ⇒ Object



27
28
29
# File 'lib/assets_packager/configuration.rb', line 27

def file_path=(path)
  @@file_path = path
end

#javascripts_pathObject



39
40
41
# File 'lib/assets_packager/configuration.rb', line 39

def javascripts_path
  @@javascripts_path ||= current_dir_for('javascripts')
end

#javascripts_path=(path) ⇒ Object



35
36
37
# File 'lib/assets_packager/configuration.rb', line 35

def javascripts_path=(path)
  @@javascripts_path = path
end

#root_pathObject



23
24
25
# File 'lib/assets_packager/configuration.rb', line 23

def root_path
  @@root_path ||= ::File.expand_path(Dir.pwd)
end

#root_path=(path) ⇒ Object



19
20
21
# File 'lib/assets_packager/configuration.rb', line 19

def root_path=(path)
  @@root_path = path
end

#stylesheets_pathObject



47
48
49
# File 'lib/assets_packager/configuration.rb', line 47

def stylesheets_path
  @@stylesheets_path ||= current_dir_for('stylesheets')
end

#stylesheets_path=(path) ⇒ Object



43
44
45
# File 'lib/assets_packager/configuration.rb', line 43

def stylesheets_path=(path)
  @@stylesheets_path = path
end

#write!Object



8
9
10
11
12
13
# File 'lib/assets_packager/configuration.rb', line 8

def write!
  javascripts = file_list("#{javascripts_path}/*.js",  true)
  stylesheets = file_list("#{stylesheets_path}/*.css", true)
  configuration = { 'js' => javascripts.reverse, 'css' => stylesheets }
  ::File.open(file_path, "w+") { |file| file.write(configuration.to_yaml) }
end