Class: Gemsmith::CLI
- Inherits:
-
Thor
- Object
- Thor
- Gemsmith::CLI
show all
- Includes:
- CLIHelpers, CLIOptions, Thor::Actions, ThorPlus::Actions
- Defined in:
- lib/gemsmith/cli.rb
Overview
The Command Line Interface (CLI) for the gem.
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from CLIHelpers
#editor, enforce_symbol_keys, #gem_class, #gem_name, open_gem, pick_gem, print_gems, process_gem, read_gem, #template_options
Methods included from CLIOptions
author_email, author_name, author_url, company_name, company_url, default_boolean, gem_platform, gem_private_key, gem_public_key, gem_url, github_user, initialize_template_options, rails_version, ruby_version, year
Constructor Details
#initialize(args = [], options = {}, config = {}) ⇒ CLI
54
55
56
57
58
59
|
# File 'lib/gemsmith/cli.rb', line 54
def initialize args = [], options = {}, config = {}
super args, options, config
@settings_file = File.join ENV["HOME"], ".gemsmith", "settings.yml"
@settings = load_yaml @settings_file
@template_options = {}
end
|
Class Method Details
.skeletons ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/gemsmith/cli.rb', line 36
def self.skeletons
[
Skeletons::GemSkeleton,
Skeletons::DocumentationSkeleton,
Skeletons::RakeSkeleton,
Skeletons::CLISkeleton,
Skeletons::RubySkeleton,
Skeletons::RailsSkeleton,
Skeletons::RspecSkeleton,
Skeletons::RubocopSkeleton,
Skeletons::GuardSkeleton,
Skeletons::TravisSkeleton,
Skeletons::BundlerSkeleton,
Skeletons::GitSkeleton
]
end
|
.source_root ⇒ Object
Overwrites the Thor template source root.
32
33
34
|
# File 'lib/gemsmith/cli.rb', line 32
def self.source_root
File.expand_path File.join(File.dirname(__FILE__), "templates")
end
|
Instance Method Details
#create(name) ⇒ Object
73
74
75
76
77
78
79
80
81
82
|
# File 'lib/gemsmith/cli.rb', line 73
def create name
say
info "Creating gem..."
initialize_template_options name, options
self.class.skeletons.each { |skeleton| skeleton.create self }
info "Gem created."
say
end
|
#edit ⇒ Object
98
99
100
|
# File 'lib/gemsmith/cli.rb', line 98
def edit
`#{editor} #{@settings_file}`
end
|
#help(task = nil) ⇒ Object
110
111
112
|
# File 'lib/gemsmith/cli.rb', line 110
def help task = nil
say && super
end
|
#open(name) ⇒ Object
86
87
88
|
# File 'lib/gemsmith/cli.rb', line 86
def open name
process_gem name, "open"
end
|
#read(name) ⇒ Object
92
93
94
|
# File 'lib/gemsmith/cli.rb', line 92
def read name
process_gem name, "read"
end
|