Class: Jekyll::Minibundle::DevelopmentFile
- Inherits:
-
Object
- Object
- Jekyll::Minibundle::DevelopmentFile
- Includes:
- AssetFileProperties
- Defined in:
- lib/jekyll/minibundle/development_file.rb
Instance Attribute Summary collapse
-
#asset_destination_dir ⇒ Object
readonly
Returns the value of attribute asset_destination_dir.
-
#asset_destination_filename ⇒ Object
readonly
Returns the value of attribute asset_destination_filename.
-
#asset_source_path ⇒ Object
readonly
Returns the value of attribute asset_source_path.
-
#stamped_at ⇒ Object
readonly
Returns the value of attribute stamped_at.
Instance Method Summary collapse
- #cleanup ⇒ Object
- #extname ⇒ Object
-
#initialize(site, asset_source_path, asset_destination_path) ⇒ DevelopmentFile
constructor
A new instance of DevelopmentFile.
- #modified? ⇒ Boolean
-
#write(site_destination_dir) ⇒ Object
rubocop:disable Naming/PredicateMethod.
Methods included from AssetFileProperties
#asset_destination_path, #basename, #data, #defaults, #destination, #destination_rel_dir, #modified_time, #mtime, #name, #path, #placeholders, #relative_path, #to_liquid, #type, #url, #write?
Constructor Details
#initialize(site, asset_source_path, asset_destination_path) ⇒ DevelopmentFile
Returns a new instance of DevelopmentFile.
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/jekyll/minibundle/development_file.rb', line 15 def initialize(site, asset_source_path, asset_destination_path) @site = site @asset_source_path = File.join(@site.source, asset_source_path) raise ArgumentError, "Development source file does not exist: #{@asset_source_path}" unless File.file?(@asset_source_path) @asset_destination_dir = File.dirname(asset_destination_path) @asset_destination_filename = File.basename(asset_destination_path) @stamped_at = nil end |
Instance Attribute Details
#asset_destination_dir ⇒ Object (readonly)
Returns the value of attribute asset_destination_dir.
10 11 12 |
# File 'lib/jekyll/minibundle/development_file.rb', line 10 def asset_destination_dir @asset_destination_dir end |
#asset_destination_filename ⇒ Object (readonly)
Returns the value of attribute asset_destination_filename.
10 11 12 |
# File 'lib/jekyll/minibundle/development_file.rb', line 10 def asset_destination_filename @asset_destination_filename end |
#asset_source_path ⇒ Object (readonly)
Returns the value of attribute asset_source_path.
10 11 12 |
# File 'lib/jekyll/minibundle/development_file.rb', line 10 def asset_source_path @asset_source_path end |
#stamped_at ⇒ Object (readonly)
Returns the value of attribute stamped_at.
10 11 12 |
# File 'lib/jekyll/minibundle/development_file.rb', line 10 def stamped_at @stamped_at end |
Instance Method Details
#cleanup ⇒ Object
26 27 28 |
# File 'lib/jekyll/minibundle/development_file.rb', line 26 def cleanup # no-op end |
#extname ⇒ Object
32 33 34 |
# File 'lib/jekyll/minibundle/development_file.rb', line 32 def extname File.extname(asset_destination_filename) end |
#modified? ⇒ Boolean
36 37 38 |
# File 'lib/jekyll/minibundle/development_file.rb', line 36 def modified? stamped_at != mtime end |
#write(site_destination_dir) ⇒ Object
rubocop:disable Naming/PredicateMethod
41 42 43 44 45 46 47 48 49 |
# File 'lib/jekyll/minibundle/development_file.rb', line 41 def write(site_destination_dir) if modified? @stamped_at = mtime Files.copy_p(path, destination(site_destination_dir)) true else false end end |