Skip to content

Commit 143898a

Browse files
committed
Update documentation comments and add new yard_doc_task
and config_task methods - Split long comment lines into multiple shorter lines for better readability - Added `yard_doc_task` method with comprehensive YARD documentation generation - Added `config_task` method to display current GemHadar configuration - Updated `@return` comment for `ollama_client` method to wrap long line - Minor formatting adjustments to existing documentation comments
1 parent abf62ac commit 143898a

File tree

1 file changed

+40
-17
lines changed

1 file changed

+40
-17
lines changed

lib/gem_hadar.rb

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,14 @@ def has_to_be_set(name)
140140
[ name, version ] * '-'
141141
end
142142

143-
# The module_type attribute accessor for configuring the type of Ruby construct to generate for version code.
143+
# The module_type attribute accessor for configuring the type of Ruby
144+
# construct to generate for version code.
144145
#
145-
# This method sets up a DSL accessor for the module_type attribute, which determines whether the generated code
146-
# structure for the version module should be a :module or :class. This controls the type of Ruby construct
147-
# created when generating code skeletons and version files. The value can be set to either:
146+
# This method sets up a DSL accessor for the module_type attribute, which
147+
# determines whether the generated code structure for the version module
148+
# should be a :module or :class. This controls the type of Ruby construct
149+
# created when generating code skeletons and version files. The value can be
150+
# set to either:
148151
#
149152
# - :module (default) - Generates module-based structure
150153
# - :class - Generates class-based structure
@@ -342,10 +345,10 @@ def require_path(path = nil)
342345

343346
# The test_dir attribute accessor for configuring the test directory.
344347
#
345-
# This method sets up a DSL accessor for the test_dir attribute, which specifies
346-
# the directory where test files are located. It provides a way to define the
347-
# location of the test directory that will be used by various testing tasks and
348-
# configurations within the gem project.
348+
# This method sets up a DSL accessor for the test_dir attribute, which
349+
# specifies the directory where test files are located. It provides a way to
350+
# define the location of the test directory that will be used by various
351+
# testing tasks and configurations within the gem project.
349352
#
350353
# @return [ String, nil ] the path to the test directory or nil if not set
351354
dsl_accessor :test_dir
@@ -552,9 +555,9 @@ def require_path(path = nil)
552555
# display after gem installation.
553556
#
554557
# This method sets up a DSL accessor for the post_install_message attribute,
555-
# which specifies a message to be displayed to users after the gem is installed.
556-
# This can be useful for providing additional information, usage instructions,
557-
# or important warnings to users of the gem.
558+
# which specifies a message to be displayed to users after the gem is
559+
# installed. This can be useful for providing additional information, usage
560+
# instructions, or important warnings to users of the gem.
558561
#
559562
# @return [ String, nil ] the post-installation message or nil if not set
560563
dsl_accessor :post_install_message
@@ -1244,9 +1247,9 @@ def version_push_task
12441247
#
12451248
# - It creates subtasks in the :master:push namespace for each configured Git
12461249
# remote, allowing individual pushes to specific remotes.
1247-
# - It also defines a top-level :master:push task that depends on all the individual
1248-
# remote push tasks, enabling a single command to push the master branch to
1249-
# all remotes.
1250+
# - It also defines a top-level :master:push task that depends on all the
1251+
# individual remote push tasks, enabling a single command to push the master
1252+
# branch to all remotes.
12501253
#
12511254
# The tasks utilize the git_remotes method to determine which remotes are
12521255
# configured and generate appropriate push commands for each one.
@@ -1479,6 +1482,17 @@ def rvm_task
14791482
end
14801483
end
14811484

1485+
# The yard_doc_task method configures and sets up a YARD documentation
1486+
# generation task.
1487+
#
1488+
# This method initializes a YARD::Rake::YardocTask that processes Ruby source
1489+
# files and generates comprehensive documentation including private and
1490+
# protected methods. It configures the output directory, handles README
1491+
# files, includes additional documentation files, and sets up a pre-execution
1492+
# cleanup routine.
1493+
#
1494+
# @return [ void ] This method does not return a value but defines a Rake task
1495+
# named :yard_doc with specific configuration options.
14821496
def yard_doc_task
14831497
YARD::Rake::YardocTask.new(:yard_doc) do |t|
14841498
t.files = doc_code_files.grep(%r(\.rb\z))
@@ -1512,8 +1526,8 @@ def yard_doc_task
15121526
#
15131527
# It creates multiple subtasks under the :yard namespace, including tasks for
15141528
# creating private documentation, viewing the generated documentation,
1515-
# cleaning up documentation files, and listing undocumented elements.
1516-
# If YARD is not available, the method returns early without defining any tasks.
1529+
# cleaning up documentation files, and listing undocumented elements. If YARD
1530+
# is not available, the method returns early without defining any tasks.
15171531
def yard_task
15181532
defined? YARD or return
15191533
yard_doc_task
@@ -1551,6 +1565,14 @@ def yard_task
15511565
task :yard => %i[ yard:private yard:view ]
15521566
end
15531567

1568+
# The config_task method creates a Rake task that displays the current
1569+
# GemHadar configuration.
1570+
#
1571+
# This method sets up a :gem_hadar:config task under the Rake namespace that
1572+
# outputs detailed information about the gem's configuration, including
1573+
# environment variables, API keys, Ollama settings, XDG configuration
1574+
# directory, general gem properties, build and development parameters, Git
1575+
# remotes, and AI prompt defaults.
15541576
def config_task
15551577
namespace :gem_hadar do
15561578
desc "Display current gem_hadar configuration"
@@ -1720,7 +1742,8 @@ def ollama_model
17201742
# set. The method then constructs the full base URL and initializes an
17211743
# Ollama::Client with appropriate timeouts for read and connect operations.
17221744
#
1723-
# @return [Ollama::Client, nil] An initialized Ollama::Client instance if a valid base URL is present, otherwise nil.
1745+
# @return [Ollama::Client, nil] An initialized Ollama::Client instance if a
1746+
# valid base URL is present, otherwise nil.
17241747
def ollama_client
17251748
base_url = ENV['OLLAMA_URL']
17261749
if base_url.blank?

0 commit comments

Comments
 (0)