Class: Keybox::Specification

Inherits:
Object
  • Object
show all
Defined in:
lib/keybox/specification.rb

Overview

Add some additional items to Gem::Specification A Keybox::Specification adds additional pieces of information the typical gem specification

Constant Summary collapse

RUBYFORGE_ROOT =
"/var/www/gforge-projects/"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ Specification

Returns a new instance of Specification.

Yields:

  • (_self)

Yield Parameters:



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/keybox/specification.rb', line 50

def initialize
    @remote_user = nil
    @remote_host = "rubyforge.org"

    @rdoc_main              = "README"
    @local_rdoc_dir         = "doc"
    @remote_rdoc_dir        = "doc"
    @local_coverage_dir     = "coverage"
    @remote_coverage_dir    = "coverage"
    @local_site_dir         = "site/public"
    @remote_site_dir        = "."
    
    @need_tar   = true
    @need_zip   = true

    @spec                   = Gem::Specification.new

    yield self if block_given?

    # update rdoc options to take care of the rdoc_main if it is
    # there, and add a default title if one is not given
    if not @spec.rdoc_options.include?("--main") then
        @spec.rdoc_options.concat(["--main", rdoc_main])
    end

    if not @spec.rdoc_options.include?("--title") then
        @spec.rdoc_options.concat(["--title","'#{name} -- #{summary}'"])
    end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_id, *params, &block) ⇒ Object

we delegate any other calls to spec



124
125
126
# File 'lib/keybox/specification.rb', line 124

def method_missing(method_id,*params,&block)
    @spec.send method_id, *params, &block
end

Instance Attribute Details

#local_coverage_dirObject

local directory for coverage report



30
31
32
# File 'lib/keybox/specification.rb', line 30

def local_coverage_dir
  @local_coverage_dir
end

#local_rdoc_dirObject

local directory in development holding the generated rdoc default ‘doc’



24
25
26
# File 'lib/keybox/specification.rb', line 24

def local_rdoc_dir
  @local_rdoc_dir
end

#local_site_dirObject

local directory for generated website, default site/public



37
38
39
# File 'lib/keybox/specification.rb', line 37

def local_site_dir
  @local_site_dir
end

#need_tarObject

is a .tgz to be created?, default ‘true’



44
45
46
# File 'lib/keybox/specification.rb', line 44

def need_tar
  @need_tar
end

#need_zipObject

is a .zip to be created, default ‘true’



47
48
49
# File 'lib/keybox/specification.rb', line 47

def need_zip
  @need_zip
end

#rdoc_mainObject

name the rdoc main



20
21
22
# File 'lib/keybox/specification.rb', line 20

def rdoc_main
  @rdoc_main
end

#remote_coverage_dirObject

remote directory for storing coverage reports This defaults to ‘coverage’



34
35
36
# File 'lib/keybox/specification.rb', line 34

def remote_coverage_dir
  @remote_coverage_dir
end

#remote_hostObject

remote host, default ‘rubyforge.org’



17
18
19
# File 'lib/keybox/specification.rb', line 17

def remote_host
  @remote_host
end

#remote_rdoc_dirObject

remote directory for storing rdoc, default ‘doc’



27
28
29
# File 'lib/keybox/specification.rb', line 27

def remote_rdoc_dir
  @remote_rdoc_dir
end

#remote_site_dirObject

remote directory relative to remote_root for the website. website.



41
42
43
# File 'lib/keybox/specification.rb', line 41

def remote_site_dir
  @remote_site_dir
end

#remote_userObject

user that accesses remote site



14
15
16
# File 'lib/keybox/specification.rb', line 14

def remote_user
  @remote_user
end

Instance Method Details

#rdoc_filesObject

rdoc files is the same as what would be generated during gem installation. That is, everything in the require paths plus the extra_rdoc_files



98
99
100
101
102
103
104
# File 'lib/keybox/specification.rb', line 98

def rdoc_files 
    flist = extra_rdoc_files.dup
    @spec.require_paths.each do |rp|
        flist << FileList["#{rp}/**/*.rb"]
    end
    flist.flatten.uniq
end

#remote_coverage_locationObject



115
116
117
# File 'lib/keybox/specification.rb', line 115

def remote_coverage_location
    remote_root_loation + @remote_coverage_dir
end

#remote_rdoc_locationObject



111
112
113
# File 'lib/keybox/specification.rb', line 111

def remote_rdoc_location
    remote_root_location + @remote_rdoc_dir
end

#remote_rootObject

if this gets set then it overwrites what would be the rubyforge default. If rubyforge project is not set then use name. If rubyforge project and name are set, but they are different then assume that name is a subproject of the rubyforge project



85
86
87
88
89
90
91
92
# File 'lib/keybox/specification.rb', line 85

def remote_root 
    if rubyforge_project.nil? or 
        rubyforge_project == name then
        return RUBYFORGE_ROOT + "#{name}/"
    else
        return RUBYFORGE_ROOT + "#{rubyforge_project}/#{name}/"
    end
end

#remote_root_locationObject

calculate the remote directories



107
108
109
# File 'lib/keybox/specification.rb', line 107

def remote_root_location
    "#{remote_user}@#{remote_host}:#{remote_root}"
end

#remote_site_locationObject



119
120
121
# File 'lib/keybox/specification.rb', line 119

def remote_site_location
    remote_root_location + @remote_site_dir
end