Class: Tipsy::Runners::Compiler
- Inherits:
-
Object
- Object
- Tipsy::Runners::Compiler
- Includes:
- Utils::System
- Defined in:
- lib/tipsy/runners/compiler.rb
Defined Under Namespace
Classes: MockRequest, MockResponse
Instance Attribute Summary collapse
-
#dest_path ⇒ Object
readonly
Returns the value of attribute dest_path.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
-
#site ⇒ Object
readonly
Returns the value of attribute site.
-
#source_path ⇒ Object
readonly
Returns the value of attribute source_path.
Instance Method Summary collapse
- #config ⇒ Object
-
#initialize(args, site) ⇒ Compiler
constructor
A new instance of Compiler.
- #skip_file?(src) ⇒ Boolean (also: #skip_path?)
Methods included from Utils::System
#copy_file, #copy_folder, #copy_tree, #empty_dir?, #enumerate_tree, #excluded?, #excludes, #excludes=, #log_action, #make_file, #mkdir_p, #normalize_path, #rm_rf, #unlink
Constructor Details
#initialize(args, site) ⇒ Compiler
Returns a new instance of Compiler.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/tipsy/runners/compiler.rb', line 11 def initialize(args, site) @site = site @source_path = normalize_path(config.public_path) @dest_path = normalize_path(config.compile_to) excluded = [excludes, config.compile.preserve].flatten.uniq @_excludes = excluded clean_existing! [:public, :images, :assets, :templates].each do |m| send(:"compile_#{m}!") end cleanup! end |
Instance Attribute Details
#dest_path ⇒ Object (readonly)
Returns the value of attribute dest_path.
9 10 11 |
# File 'lib/tipsy/runners/compiler.rb', line 9 def dest_path @dest_path end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
9 10 11 |
# File 'lib/tipsy/runners/compiler.rb', line 9 def scope @scope end |
#site ⇒ Object (readonly)
Returns the value of attribute site.
9 10 11 |
# File 'lib/tipsy/runners/compiler.rb', line 9 def site @site end |
#source_path ⇒ Object (readonly)
Returns the value of attribute source_path.
9 10 11 |
# File 'lib/tipsy/runners/compiler.rb', line 9 def source_path @source_path end |
Instance Method Details
#config ⇒ Object
26 27 28 |
# File 'lib/tipsy/runners/compiler.rb', line 26 def config Tipsy::Site.config end |
#skip_file?(src) ⇒ Boolean Also known as: skip_path?
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/tipsy/runners/compiler.rb', line 34 def skip_file?(src) return false unless scope == :clean || scope == :public if scope == :public checks = config.compile.skip relative = ::Pathname.new(src).relative_path_from(::Pathname.new(source_path)) reldir = relative.dirname.to_s return checks.detect{ |path| path == src || path == relative.to_s || reldir.to_s == path } end config.compile.preserve.detect do |path| relative = src.to_s.gsub(Tipsy::Site.public_path, '').sub(/^\//, '') File.basename(src) == path || relative == path end end |