Class: Kamaze::Project::Tools::Gemspec::Packager Abstract
- Inherits:
-
Packager
- Object
- Observable
- BaseTool
- Packager
- Kamaze::Project::Tools::Gemspec::Packager
- Includes:
- Concern::Reading
- Defined in:
- lib/kamaze/project/tools/gemspec/packager.rb
Overview
Provide a specialized packager, for gemspec
based projects
A gemspec
reader class is used,
it can be retrieved through project
tools.
This dynamic behaviour is the default one, but a specific reader or
a project
can be defined during initialization.
Gem specification
(Gem::Specification
) is retrieved through
the gemspec reader. The gemspec reader
can be dynamically retrieved through the project.
Instance Attribute Summary collapse
- #observer_peers ⇒ Hash|nil included from Concern::Observable readonly protected
Instance Method Summary collapse
- #gemspec_reader ⇒ Kamaze::Project::Tools::Gemspec::Reader included from Concern::Reading protected
- #mutable_attributes ⇒ Object
-
#package_files ⇒ Array<String>
protected
Get package(d) files.
-
#ready? ⇒ Boolean
Denote ready.
- #setup ⇒ Object protected
-
#specification ⇒ Gem::Specification
protected
Get specification.
Constructor Details
This class inherits a constructor from Kamaze::Project::Tools::Packager
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Kamaze::Project::Tools::Packager
Instance Attribute Details
#observer_peers ⇒ Hash|nil (readonly, protected) Originally defined in module Concern::Observable
Instance Method Details
#gemspec_reader ⇒ Kamaze::Project::Tools::Gemspec::Reader (protected) Originally defined in module Concern::Reading
#mutable_attributes ⇒ Object
26 27 28 |
# File 'lib/kamaze/project/tools/gemspec/packager.rb', line 26 def mutable_attributes [:gemspec_reader] end |
#package_files ⇒ Array<String> (protected)
Get package(d) files
45 46 47 48 49 50 51 52 |
# File 'lib/kamaze/project/tools/gemspec/packager.rb', line 45 def package_files # @formatter: off (gemspec_reader.read&.files).to_a.yield_self do |files| # rubocop:disable Style/RedundantParentheses Dir.glob(%w[*.gemspec Gemfile Gemfile.lock gems.rb gems.locked]) .concat(files) end.sort # @formatter: on end |
#ready? ⇒ Boolean
Denote ready
Test to detect if specification seems to be complete, incomplete specification denotes a missing gemspec file
36 37 38 |
# File 'lib/kamaze/project/tools/gemspec/packager.rb', line 36 def ready? gemspec_reader.read(Hash).include?(:full_name) end |
#setup ⇒ Object (protected)
54 55 56 57 58 59 |
# File 'lib/kamaze/project/tools/gemspec/packager.rb', line 54 def setup @gemspec_reader ||= Kamaze::Project.instance.tools.fetch(:gemspec_reader) self.verbose = false self.source_files = package_files if self.source_files.to_a.empty? end |
#specification ⇒ Gem::Specification (protected)
Get specification
64 65 66 |
# File 'lib/kamaze/project/tools/gemspec/packager.rb', line 64 def specification gemspec_reader.read end |