Module: Nugem
- Defined in:
- lib/nugem/cli.rb,
lib/util.rb,
lib/nugem.rb,
lib/nugem/git.rb,
lib/nugem/version.rb,
lib/nugem/repository.rb,
lib/nugem/cli/cli_gem.rb,
lib/nugem/cli/cli_rails.rb,
lib/nugem/cli/cli_jekyll.rb,
lib/nugem/cli/jekyll_demo.rb
Overview
Nugem::Repository contains informations about the git repository and the git user
Defined Under Namespace
Classes: Cli, Repository
Constant Summary collapse
- VERSION =
'0.8.3'.freeze
Class Method Summary collapse
- .camel_case(str) ⇒ Object
-
.current_spec(file) ⇒ Object
Gem::Specification of gem that file points into, or nil if not called from a gem.
-
.dest_root(gem_name) ⇒ Object
Path to the generated gem.
- .expand_env(str) ⇒ Object
- .gem_path(file) ⇒ Object
- .template_directory ⇒ Object
Class Method Details
.camel_case(str) ⇒ Object
2 3 4 |
# File 'lib/util.rb', line 2 def self.camel_case(str) Thor::Util.camel_case str.tr('-', '_') end |
.current_spec(file) ⇒ Object
Returns Gem::Specification of gem that file points into, or nil if not called from a gem.
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/util.rb', line 16 def self.current_spec(file) return nil unless File.file?(file) searcher = if Gem::Specification.respond_to?(:find) Gem::Specification elsif Gem.respond_to?(:searcher) Gem.searcher.init_gemspecs end searcher&.find do |spec| file.start_with? spec.full_gem_path end end |
.dest_root(gem_name) ⇒ Object
Returns Path to the generated gem.
8 9 10 |
# File 'lib/nugem.rb', line 8 def self.dest_root(gem_name) File. "generated/#{gem_name}" end |
.expand_env(str) ⇒ Object
6 7 8 9 10 |
# File 'lib/util.rb', line 6 def self.(str) str.gsub(/\$([a-zA-Z_][a-zA-Z0-9_]*)|\${\g<1>}|%\g<1>%/) do ENV.fetch(Regexp.last_match(1), nil) end end |
.gem_path(file) ⇒ Object
30 31 32 33 |
# File 'lib/util.rb', line 30 def self.gem_path(file) spec = self.current_spec(file) spec&.full_gem_path end |
.template_directory ⇒ Object
35 36 37 |
# File 'lib/util.rb', line 35 def self.template_directory File.join gem_path(__FILE__), 'templates' end |