class Object

Public Instance Methods

add_commit_push() click to toggle source
# File bin/ga_license, line 34
def add_commit_push
  system("git add .")
  system("git commit -am 'Add GA license'")
  system("git push")
end
add_license() click to toggle source
# File bin/ga_license, line 15
def add_license
  File.open("README.md",  "a") do |f|
    f << "\n\n## Licensing"
    f << "\nAll content is licensed under a CC­BY­NC­SA 4.0 license."
    f << "\nAll software code is licensed under GNU GPLv3. For commercial use or alternative licensing, please contact legal@ga.co."
  end
end
clone_and_cd(clone_url) click to toggle source
# File bin/ga_license, line 9
def clone_and_cd(clone_url)
  system("git clone #{clone_url}")
  regex = /.+\/(.+)\.git/.match(clone_url)
  Dir.chdir(regex[1])
end
get_options() click to toggle source
# File bin/ga_license, line 4
def get_options
  file = File.open(File.join(ENV['HOME'], '/.ga_license'), 'rb')
  options = JSON.parse(file.read)
end
write_license(description, copyright) click to toggle source
# File bin/ga_license, line 23
def write_license(description, copyright)
  file = File.open(File.join( File.dirname(__FILE__), '../files/LICENSE.txt'), "rb")
  contents = file.read
  contents.force_encoding(Encoding::UTF_8)

  contents.gsub!("ENV_DESCRIPTION", description)
  contents.gsub!("ENV_COPYRIGHT", copyright)

  File.open("LICENSE.txt", 'w+'){ |f| f.write(contents) }
end