Sha256: 9d860bf74232d3410f50f54e9aa357ae2e94a22ea239772fbe39ce395b71f99b
Contents?: true
Size: 1.98 KB
Versions: 4
Compression:
Stored size: 1.98 KB
Contents
#!/usr/bin/env ruby require 'gemplate' require 'userinput' require 'rugged' require 'curb' require 'mercenary' Mercenary.program(:gemplate) do |p| p.version Gemplate::VERSION p.description 'Tool for bootstrapping new gems' p.syntax 'gemplate [options] GEM_NAME' p.option :user, '-u', '--user', 'GitHub username' p.option :org, '-o', '--org', 'GitHub organization' p.option :full_name, '-n', '--name', 'Full name' p.option :email, '-e', '--email', 'Email address' p.option :license, '-l', '--license', 'License' p.option :skip_github, '-s', '--skip', 'Skip GitHub steps' p.action do |_, options| options[:name] = ARGV.first || UserInput.new(message: 'Gem name').ask unless options[:user] options[:user] = Rugged::Config.global['github.user'] || ENV['USER'] options[:user] = UserInput.new( message: 'GitHub username', default: options[:user] ).ask end unless options[:org] options[:org] = options[:user] options[:org] = UserInput.new( message: 'GitHub organization', default: options[:org] ).ask end unless options[:full_name] options[:full_name] = Rugged::Config.global['user.name'] options[:full_name] = UserInput.new( message: 'Full name', default: options[:full_name] ).ask end unless options[:email] options[:email] = Rugged::Config.global['user.email'] options[:email] = UserInput.new( message: 'Email address', default: options[:email] ).ask end license_validation = proc do |x| url = "https://raw.githubusercontent.com/akerl/licenses/master/#{x}.txt" Curl::Easy.http_head(url).response_code == 200 end unless options[:license] puts 'List of licenses: https://github.com/akerl/licenses' options[:license] = UserInput.new( message: 'License', default: 'MIT', validation: license_validation ).ask end Gemplate.new(options).create puts 'New gem has been created!' end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
gemplate-2.0.5 | bin/gemplate |
gemplate-2.0.4 | bin/gemplate |
gemplate-2.0.3 | bin/gemplate |
gemplate-2.0.2 | bin/gemplate |