Class: LibTom::Math::Specification

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

Overview

Add some additional items to Gem::Specification A LibTom::Math::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:



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
79
# File 'lib/libtom/math/specification.rb', line 51

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



125
126
127
# File 'lib/libtom/math/specification.rb', line 125

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



31
32
33
# File 'lib/libtom/math/specification.rb', line 31

def local_coverage_dir
  @local_coverage_dir
end

#local_rdoc_dirObject

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



25
26
27
# File 'lib/libtom/math/specification.rb', line 25

def local_rdoc_dir
  @local_rdoc_dir
end

#local_site_dirObject

local directory for generated website, default site/public



38
39
40
# File 'lib/libtom/math/specification.rb', line 38

def local_site_dir
  @local_site_dir
end

#need_tarObject

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



45
46
47
# File 'lib/libtom/math/specification.rb', line 45

def need_tar
  @need_tar
end

#need_zipObject

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



48
49
50
# File 'lib/libtom/math/specification.rb', line 48

def need_zip
  @need_zip
end

#rdoc_mainObject

name the rdoc main



21
22
23
# File 'lib/libtom/math/specification.rb', line 21

def rdoc_main
  @rdoc_main
end

#remote_coverage_dirObject

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



35
36
37
# File 'lib/libtom/math/specification.rb', line 35

def remote_coverage_dir
  @remote_coverage_dir
end

#remote_hostObject

remote host, default ‘rubyforge.org’



18
19
20
# File 'lib/libtom/math/specification.rb', line 18

def remote_host
  @remote_host
end

#remote_rdoc_dirObject

remote directory for storing rdoc, default ‘doc’



28
29
30
# File 'lib/libtom/math/specification.rb', line 28

def remote_rdoc_dir
  @remote_rdoc_dir
end

#remote_site_dirObject

remote directory relative to remote_root for the website. website.



42
43
44
# File 'lib/libtom/math/specification.rb', line 42

def remote_site_dir
  @remote_site_dir
end

#remote_userObject

user that accesses remote site



15
16
17
# File 'lib/libtom/math/specification.rb', line 15

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 rdoc_extra_files



99
100
101
102
103
104
105
# File 'lib/libtom/math/specification.rb', line 99

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



116
117
118
# File 'lib/libtom/math/specification.rb', line 116

def remote_coverage_location
    remote_root_loation + @remote_coverage_dir
end

#remote_rdoc_locationObject



112
113
114
# File 'lib/libtom/math/specification.rb', line 112

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



86
87
88
89
90
91
92
93
# File 'lib/libtom/math/specification.rb', line 86

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



108
109
110
# File 'lib/libtom/math/specification.rb', line 108

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

#remote_site_locationObject



120
121
122
# File 'lib/libtom/math/specification.rb', line 120

def remote_site_location
    remote_root_location + @remote_site_dir
end