Class: FluentPluginGenerator::ApacheLicense
- Inherits:
-
Object
- Object
- FluentPluginGenerator::ApacheLicense
- Defined in:
- lib/fluent/command/plugin_generator.rb
Constant Summary collapse
- LICENSE_URL =
"http://www.apache.org/licenses/LICENSE-2.0.txt"
Instance Attribute Summary collapse
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
- #full_name ⇒ Object
-
#initialize ⇒ ApacheLicense
constructor
A new instance of ApacheLicense.
- #name ⇒ Object
- #preamble(user_name) ⇒ Object
Constructor Details
#initialize ⇒ ApacheLicense
Returns a new instance of ApacheLicense.
320 321 322 323 324 325 326 327 328 329 |
# File 'lib/fluent/command/plugin_generator.rb', line 320 def initialize @text = "" @preamble_source = "" @preamble = nil uri = URI.parse(LICENSE_URL) uri.open do |io| @text = io.read end @preamble_source = @text[/^(\s*Copyright.+)/m, 1] end |
Instance Attribute Details
#text ⇒ Object (readonly)
Returns the value of attribute text.
318 319 320 |
# File 'lib/fluent/command/plugin_generator.rb', line 318 def text @text end |
Instance Method Details
#full_name ⇒ Object
335 336 337 |
# File 'lib/fluent/command/plugin_generator.rb', line 335 def full_name "Apache License, Version 2.0" end |
#name ⇒ Object
331 332 333 |
# File 'lib/fluent/command/plugin_generator.rb', line 331 def name "Apache-2.0" end |
#preamble(user_name) ⇒ Object
339 340 341 342 343 344 345 346 |
# File 'lib/fluent/command/plugin_generator.rb', line 339 def preamble(user_name) @preamble ||= @preamble_source.dup.tap do |source| source.gsub!(/\[yyyy\]/, "#{Date.today.year}-") source.gsub!(/\[name of copyright owner\]/, user_name) source.gsub!(/^ {2}|^$/, "#") source.chomp! end end |