Class: Rabal::Plugin::License

Inherits:
Object
  • Object
show all
Defined in:
lib/rabal/plugin/license.rb

Overview

The license plugin helps the user pick a license for their project. The current available license to choose from are BSD, GPL, LGPG, MIT and Ruby

Constant Summary collapse

TYPES =
%w[BSD GPL LGPL MIT RUBY]

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ License

Returns a new instance of License.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/rabal/plugin/license.rb', line 15

def initialize(options)
    @parameters = OpenStruct.new(options)
    validate_parameters
    suffix = @parameters.flavor

    # look at all files in our resource directory and any
    # that have the same suffix as the 'flavor' load it into
    # the tree.
    resource_dir = resource_by_name(my_main_tree_name)
    @tree = DirectoryTree.new(".")
    Dir.glob(File.join(resource_dir,"*.#{suffix.downcase}")).each do |file|
        @tree << FileTree.from_file(file)
    end
end