Class: FlexHeaders::Task
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- FlexHeaders::Task
- Defined in:
- lib/shed/rake/headers.rb
Instance Attribute Summary collapse
-
#paths ⇒ Object
writeonly
Sets the attribute paths.
Instance Method Summary collapse
- #copyright=(value) ⇒ Object
- #define ⇒ Object
-
#initialize(name = :headers) {|_self| ... } ⇒ Task
constructor
A new instance of Task.
Constructor Details
#initialize(name = :headers) {|_self| ... } ⇒ Task
Returns a new instance of Task.
11 12 13 14 15 16 17 18 19 |
# File 'lib/shed/rake/headers.rb', line 11 def initialize name = :headers @name = name @paths = 'src,test' @header = make_header yield self if block_given? define end |
Instance Attribute Details
#paths=(value) ⇒ Object (writeonly)
Sets the attribute paths
5 6 7 |
# File 'lib/shed/rake/headers.rb', line 5 def paths=(value) @paths = value end |
Instance Method Details
#copyright=(value) ⇒ Object
7 8 9 |
# File 'lib/shed/rake/headers.rb', line 7 def copyright=(value) make_header(value) end |
#define ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/shed/rake/headers.rb', line 21 def define desc "Updates all ActionScript source files to include copyright headers" task @name do Dir[ "{#{@paths}}/**/*.as" ].each do |uri| src = IO.read( uri ) File.open( uri, 'w+' ) do |f| f << src.sub( /.+?(?=package)/m, @header ) end end puts "Added copyright header to all .as files" end end |