lib/gem_bootstrap/cli.rb in gem_bootstrap-0.2.3 vs lib/gem_bootstrap/cli.rb in gem_bootstrap-0.2.4
- old
+ new
@@ -1,35 +1,35 @@
-require "thor"
+require 'thor'
require 'active_support'
require 'active_support/core_ext/object/blank'
require 'active_support/core_ext/hash/keys'
require 'active_support/core_ext/hash/indifferent_access'
-require_relative "./misc_utils"
-require_relative "./git_utils"
+require_relative './misc_utils'
+require_relative './git_utils'
module GemBootstrap
# The common template directory
- TEMPLATES_DIR = "../../templates"
+ TEMPLATES_DIR = '../../templates'
class CLI < Thor::Group
include Thor::Actions
argument :name
class_option :github_id,
- aliases: "-g",
- desc: "github profile id",
+ aliases: '-g',
+ desc: 'github profile id',
required: true
class_option :author,
- aliases: "-a",
- desc: "Full name of the author",
+ aliases: '-a',
+ desc: 'Full name of the author',
required: true
class_option :email,
- aliases: "-e",
- desc: "Email for github",
+ aliases: '-e',
+ desc: 'Email for github',
required: true
class_option :test_framework,
- default: "minitest",
- aliases: "-t",
- desc: "minitest or rspec",
+ default: 'minitest',
+ aliases: '-t',
+ desc: 'minitest or rspec',
required: false
def self.source_root
File.dirname(__FILE__)
end
@@ -46,11 +46,10 @@
template "#{TEMPLATES_DIR}/lib/newgem.rb", "#{name}/lib/#{name}.rb"
template "#{TEMPLATES_DIR}/lib/newgem/version.rb", "#{name}/lib/#{name}/version.rb"
template "#{TEMPLATES_DIR}/lib/newgem/cli.rb", "#{name}/lib/#{name}/cli.rb"
template "#{TEMPLATES_DIR}/lib/newgem/newgem.rb", "#{name}/lib/#{name}/#{name}.rb"
- # TODO: store this for code reuse
test_framework = options.symbolize_keys[:test_framework]
template "#{TEMPLATES_DIR}/Rakefile-#{test_framework}", "#{name}/Rakefile"
template "#{TEMPLATES_DIR}/Guardfile-#{test_framework}", "#{name}/Guardfile"
template "#{TEMPLATES_DIR}/newgem-#{test_framework}.gemspec.tt", "#{name}/#{name}.gemspec"
@@ -68,10 +67,10 @@
end
end
# rubocop:enable all
def copy_licence
- copy_file "../../templates/MIT_LICENSE", "#{name}/LICENSE"
+ copy_file '../../templates/MIT_LICENSE', "#{name}/LICENSE"
end
# Create the git project to store our generated code
def create_git_project
GemBootstrap::GitUtils.create_git_project(File.expand_path(name), name)