Class: Tap::Generator::Generators::Tap

Inherits:
Base
  • Object
show all
Defined in:
lib/tap/generator/generators/tap.rb

Overview

:startdoc::generator make a faster tap

Instance Attribute Summary

Attributes inherited from Base

#prompt_in, #prompt_out

Attributes included from Helpers

#helper_registry

Instance Method Summary collapse

Methods inherited from Base

#action, build, convert_to_spec, #directories, #directory, #file, #initialize, #iterate, #log_relative, #on, parse_as, #path, #process, #template, #template_files

Methods included from Helpers

#cache_helpers, #helpers

Constructor Details

This class inherits a constructor from Tap::Generator::Base

Instance Method Details

#load_paths(*gem_names) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/tap/generator/generators/tap.rb', line 32

def load_paths(*gem_names)
  gem_names.collect! do |gem_name|
    load_path = $LOAD_PATH.find do |path|
      path =~ /\/#{gem_name}[-\d\.]*\/lib$/
    end
    
    if load_path.nil?
      raise "could not determine load path for: #{gem_name}"
    end
    
    File.expand_path(load_path)
  end
end

#manifest(m) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/tap/generator/generators/tap.rb', line 12

def manifest(m)
  load_paths = load_paths('lazydoc', 'configurable', 'tap')
  bin_path = File.join(load_paths.last.chomp('lib'), 'bin/tapexe')
  
  m.template name, 'tap.erb', {
    :load_paths => load_paths,
    :bin_path => bin_path
  }
  
  m.on(:generate) do 
    log :chmod, "0755 #{name}"
    FileUtils.chmod(0755, name)
  end
  
  m.template profile, 'profile.erb', {
    :generator => self.class,
    :filename => profile
  }
end