Sha256: 0efe6be3a5c1e62387229a3227e4dc608da181d9abf03b056a7fd8a10d3b8b67

Contents?: true

Size: 625 Bytes

Versions: 2

Compression:

Stored size: 625 Bytes

Contents

require 'erb'

module OpenSource
  class License
    def initialize(options)
      @options = options
      @user = Owner.get_credentials
      @license = ERB.new(File.read("#{File.expand_path("../../../templates", __FILE__)}/#{@options[:license]}.erb")).result(binding)
    end

    def process
      generate
      append if @options[:append]
    end

  private
    def generate
      f = File.new("#{Dir.pwd}/LICENSE", "w")
      f.write(@license)
      f.close
    end

    def append
      File.open(File.expand_path(@options[:append]), "a") do |f|
        f << "\n## License\n\n#{@license}"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
opensource-0.6.2 lib/open_source/license.rb
opensource-0.6.1 lib/open_source/license.rb