Class: RakeContentFile::Task

Inherits:
Rake::FileTask show all
Defined in:
lib/rake-file-content/task.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Rake::FileTask

#content_hash

Constructor Details

#initialize(task_name, app) ⇒ Task

Returns a new instance of Task.



7
8
9
# File 'lib/rake-file-content/task.rb', line 7

def initialize(task_name, app)
  super(task_name, app)
end

Instance Attribute Details

#source_fileObject

Returns the value of attribute source_file.



5
6
7
# File 'lib/rake-file-content/task.rb', line 5

def source_file
  @source_file
end

Instance Method Details

#cache_fileObject



29
30
31
# File 'lib/rake-file-content/task.rb', line 29

def cache_file
  name + ".content_hash"
end

#dependent_contents_changed?Boolean

Returns:

  • (Boolean)


23
24
25
26
27
# File 'lib/rake-file-content/task.rb', line 23

def dependent_contents_changed?
  return true if cached_dep_list.nil?

  dep_list != cached_dep_list
end

#execute(args = nil) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/rake-file-content/task.rb', line 15

def execute(args=nil)
  super

  File.open(cache_file, "w") do |f|
    f << dep_list.serialize
  end
end

#needed?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/rake-file-content/task.rb', line 11

def needed?
  dependent_contents_changed?
end