Class: Gemsmith::CLI
- Inherits:
-
Thor
- Object
- Thor
- Gemsmith::CLI
show all
- Includes:
- CLIHelpers, 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
#gem_class, #gem_name, pick_gem, print_gems, process_gem, #rails_version
Constructor Details
#initialize(args = [], options = {}, config = {}) ⇒ CLI
58
59
60
61
62
|
# File 'lib/gemsmith/cli.rb', line 58
def initialize args = [], options = {}, config = {}
super args, options, config
@configuration = Configuration.new
@spec_aid = Aids::Spec.new
end
|
Class Method Details
.skeletons ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/gemsmith/cli.rb', line 39
def self.skeletons
[
Skeletons::GemSkeleton,
Skeletons::DocumentationSkeleton,
Skeletons::RakeSkeleton,
Skeletons::CLISkeleton,
Skeletons::RubySkeleton,
Skeletons::RailsSkeleton,
Skeletons::RspecSkeleton,
Skeletons::RubocopSkeleton,
Skeletons::GuardSkeleton,
Skeletons::PrySkeleton,
Skeletons::TravisSkeleton,
Skeletons::BundlerSkeleton,
Skeletons::GitSkeleton
]
end
|
.source_root ⇒ Object
Overwrites the Thor template source root.
35
36
37
|
# File 'lib/gemsmith/cli.rb', line 35
def self.source_root
File.expand_path File.join(File.dirname(__FILE__), "templates")
end
|
Instance Method Details
#create(name) ⇒ Object
77
78
79
80
81
82
83
84
85
86
|
# File 'lib/gemsmith/cli.rb', line 77
def create name
say
info "Creating gem..."
setup_configuration name, options
self.class.skeletons.each { |skeleton| skeleton.create self, configuration: configuration }
info "Gem created."
say
end
|
#edit ⇒ Object
102
103
104
105
|
# File 'lib/gemsmith/cli.rb', line 102
def edit
info "Editing: #{configuration.file_path}..."
`#{spec_aid.editor} #{configuration.file_path}`
end
|
#help(task = nil) ⇒ Object
115
116
117
|
# File 'lib/gemsmith/cli.rb', line 115
def help task = nil
say && super
end
|
#open(name) ⇒ Object
90
91
92
|
# File 'lib/gemsmith/cli.rb', line 90
def open name
process_gem name, "open"
end
|
#read(name) ⇒ Object
96
97
98
|
# File 'lib/gemsmith/cli.rb', line 96
def read name
process_gem name, "read"
end
|