module Qbuild::Config
Constants
- INIT_CONFIG_FILE
Public Class Methods
create_target_directory(dir_name)
click to toggle source
# File lib/qbuild/config.rb, line 8 def self.create_target_directory(dir_name) FileUtils.mkdir_p(dir_name) unless File.directory?(dir_name) end
init()
click to toggle source
# File lib/qbuild/config.rb, line 12 def self.init PadUtils.copy_file(INIT_CONFIG_FILE, '.') end
js_paths()
click to toggle source
# File lib/qbuild/config.rb, line 16 def self.js_paths read_key(:js_paths) end
minified_js_path()
click to toggle source
# File lib/qbuild/config.rb, line 20 def self.minified_js_path read_key(:minified_js_path) end
minified_stylesheets_path()
click to toggle source
# File lib/qbuild/config.rb, line 24 def self.minified_stylesheets_path read_key(:minified_stylesheets_path) end
post_build()
click to toggle source
# File lib/qbuild/config.rb, line 40 def self.post_build read_key(:post_build, true) end
pre_build()
click to toggle source
# File lib/qbuild/config.rb, line 36 def self.pre_build read_key(:pre_build, true) end
stylesheet_filenames()
click to toggle source
# File lib/qbuild/config.rb, line 28 def self.stylesheet_filenames read_key(:stylesheet_filenames) end
stylesheet_name()
click to toggle source
# File lib/qbuild/config.rb, line 32 def self.stylesheet_name read_key(:stylesheet_name) end
Private Class Methods
blow_up(key = nil)
click to toggle source
# File lib/qbuild/config.rb, line 56 def self.blow_up(key = nil) error_message = '' if key.nil? error_message = "Config file '.qbuild.json' not found. Run 'qbuild --init'." else error_message = "The key '#{key}' was not found in '.qbuild.json'. Aborting build." end PadUtils.puts_c error_message, :red exit end
read_key(key, optional = false)
click to toggle source
# File lib/qbuild/config.rb, line 46 def self.read_key(key, optional = false) blow_up unless PadUtils.file_exist?('.qbuild.json') config = PadUtils.json_file_to_hash('.qbuild.json') if !optional && config[key].nil? blow_up(key) else config[key] end end