Class: Gemmy::Tasks::MakeGem
- Inherits:
-
Object
- Object
- Gemmy::Tasks::MakeGem
- Defined in:
- lib/gemmy/patches_loaded/tasks/make_gem.rb
Overview
A task to create skeleton structure for a ruby gem
Only one method is intended for public use, MakeGem.run.
It takes one argument - the name of the ruby gem.
It then prompts for a few more defails (summary, email, and name).
Here’s the structure it creates:
├── <name>.gemspec ├── Gemfile ├── reinstall ├── bin
└── <name>
└── lib
├── <name>.rb
└── version.rb
At which point you can run “gem build” then “gem install”
Instance Attribute Summary collapse
-
#author ⇒ Object
readonly
Returns the value of attribute author.
-
#class_name ⇒ Object
readonly
Returns the value of attribute class_name.
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#gemfile ⇒ Object
readonly
Returns the value of attribute gemfile.
-
#gemspec_file ⇒ Object
readonly
Returns the value of attribute gemspec_file.
-
#lib ⇒ Object
readonly
Returns the value of attribute lib.
-
#main_file ⇒ Object
readonly
Returns the value of attribute main_file.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#root_dir ⇒ Object
readonly
Returns the value of attribute root_dir.
-
#rubygems_version ⇒ Object
readonly
Returns the value of attribute rubygems_version.
-
#summary ⇒ Object
readonly
Returns the value of attribute summary.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
-
#version_file ⇒ Object
readonly
Returns the value of attribute version_file.
Class Method Summary collapse
-
.run(name) ⇒ Object
Builds a skeleton ruby gem.
Instance Method Summary collapse
-
#make_gem(name) ⇒ Object
calls a sequence of commands to build out the gem directory.
Instance Attribute Details
#author ⇒ Object (readonly)
Returns the value of attribute author.
52 53 54 |
# File 'lib/gemmy/patches_loaded/tasks/make_gem.rb', line 52 def @author end |
#class_name ⇒ Object (readonly)
Returns the value of attribute class_name.
52 53 54 |
# File 'lib/gemmy/patches_loaded/tasks/make_gem.rb', line 52 def class_name @class_name end |
#email ⇒ Object (readonly)
Returns the value of attribute email.
52 53 54 |
# File 'lib/gemmy/patches_loaded/tasks/make_gem.rb', line 52 def email @email end |
#gemfile ⇒ Object (readonly)
Returns the value of attribute gemfile.
52 53 54 |
# File 'lib/gemmy/patches_loaded/tasks/make_gem.rb', line 52 def gemfile @gemfile end |
#gemspec_file ⇒ Object (readonly)
Returns the value of attribute gemspec_file.
52 53 54 |
# File 'lib/gemmy/patches_loaded/tasks/make_gem.rb', line 52 def gemspec_file @gemspec_file end |
#lib ⇒ Object (readonly)
Returns the value of attribute lib.
52 53 54 |
# File 'lib/gemmy/patches_loaded/tasks/make_gem.rb', line 52 def lib @lib end |
#main_file ⇒ Object (readonly)
Returns the value of attribute main_file.
52 53 54 |
# File 'lib/gemmy/patches_loaded/tasks/make_gem.rb', line 52 def main_file @main_file end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
52 53 54 |
# File 'lib/gemmy/patches_loaded/tasks/make_gem.rb', line 52 def name @name end |
#root_dir ⇒ Object (readonly)
Returns the value of attribute root_dir.
52 53 54 |
# File 'lib/gemmy/patches_loaded/tasks/make_gem.rb', line 52 def root_dir @root_dir end |
#rubygems_version ⇒ Object (readonly)
Returns the value of attribute rubygems_version.
52 53 54 |
# File 'lib/gemmy/patches_loaded/tasks/make_gem.rb', line 52 def rubygems_version @rubygems_version end |
#summary ⇒ Object (readonly)
Returns the value of attribute summary.
52 53 54 |
# File 'lib/gemmy/patches_loaded/tasks/make_gem.rb', line 52 def summary @summary end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
52 53 54 |
# File 'lib/gemmy/patches_loaded/tasks/make_gem.rb', line 52 def url @url end |
#version_file ⇒ Object (readonly)
Returns the value of attribute version_file.
52 53 54 |
# File 'lib/gemmy/patches_loaded/tasks/make_gem.rb', line 52 def version_file @version_file end |
Class Method Details
.run(name) ⇒ Object
Builds a skeleton ruby gem. Prompts for some input using gets.chomp
29 30 31 |
# File 'lib/gemmy/patches_loaded/tasks/make_gem.rb', line 29 def self.run(name) new.make_gem(name) end |
Instance Method Details
#make_gem(name) ⇒ Object
calls a sequence of commands to build out the gem directory
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/gemmy/patches_loaded/tasks/make_gem.rb', line 35 def make_gem(name) @name = name @class_name = name.camelcase usage_io create_root_dir create_lib_dir create_version_file create_main_file gemspec_info_io create_gemspec_file create_gemfile create_reinstall_file create_executable puts "directory #{name} has been created".yellow end |