Module: Kamaze::Project::Bundled::ClassMethods
- Defined in:
- lib/kamaze/project/bundled.rb
Overview
Class methods
Instance Method Summary collapse
- #base_path ⇒ Pathname protected
-
#base_path=(path) ⇒ Pathname
protected
Set
base_path
from givenpath
. -
#bundled? ⇒ Boolean
protected
Denote current class is used in a bundled context.
-
#development? ⇒ Boolean
protected
Denote current class is used in development context.
Instance Method Details
#base_path ⇒ Pathname (protected)
49 50 51 |
# File 'lib/kamaze/project/bundled.rb', line 49 def base_path @base_path end |
#base_path=(path) ⇒ Pathname (protected)
Set base_path
from given path
.
44 45 46 |
# File 'lib/kamaze/project/bundled.rb', line 44 def base_path=(path) @base_path = Pathname.new(path).realpath end |
#bundled? ⇒ Boolean (protected)
Denote current class is used in a bundled context.
56 57 58 59 60 61 62 63 64 |
# File 'lib/kamaze/project/bundled.rb', line 56 def bundled? # @formatter:off [%w[gems.rb gems.locked], %w[Gemfile Gemfile.lock]].map do |m| Dir.chdir(base_path) do m.map { |f| Pathname(f).file? }.uniq end end.include?([true]) # @formatter:on end |
#development? ⇒ Boolean (protected)
Denote current class is used in development context.
69 70 71 72 73 74 75 76 77 |
# File 'lib/kamaze/project/bundled.rb', line 69 def development? # @formatter:off bundled? and [['gemspec.tpl']].map do |m| Dir.chdir(base_path) do m.map { |f| Pathname(f).file? } end end.include?([true]) # @formatter:on end |