Class: Ritual::Extension::Base

Inherits:
Object
  • Object
show all
Includes:
Rake::DSL
Defined in:
lib/ritual/extension/base.rb

Direct Known Subclasses

JRuby, Standard

Constant Summary collapse

RbConfig =
defined?(RbConfig) ? RbConfig : Config
DLEXT =
RbConfig::CONFIG['DLEXT']

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, params = {}) ⇒ Base

Returns a new instance of Base.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ritual/extension/base.rb', line 9

def initialize(name, params={})
  @name = name ? name.to_sym : nil
  library_name = params[:library_name]

  build_path = params[:build_as] and
    @build_path = "#{build_path}.#{DLEXT}"
  install_path = params[:install_as] and
    @install_path = "#{install_path}.#{DLEXT}"

  if name
    @task_name = "ext:#{name}"
    @path = params[:path] || "ext/#{name}"
    @build_path ||= "#{path}/#{name}.#{DLEXT}"
    @install_path ||= "lib/#{library_name}/#{name}.#{DLEXT}"
  else
    @task_name = 'ext'
    @path = params[:path] || 'ext'
    @build_path ||= "#{path}/#{library_name}.#{DLEXT}"
    @install_path ||= "lib/#{library_name}/#{library_name}.#{DLEXT}"
  end

  CLEAN.include(compiled_paths)
  CLEAN.include(@build_path)
  CLOBBER.include(@install_path)
end

Instance Attribute Details

#build_path ⇒ Object (readonly)

Returns the value of attribute build_path.



35
36
37
# File 'lib/ritual/extension/base.rb', line 35

def build_path
  @build_path
end

#install_path ⇒ Object (readonly)

Returns the value of attribute install_path.



35
36
37
# File 'lib/ritual/extension/base.rb', line 35

def install_path
  @install_path
end

#name ⇒ Object (readonly)

Returns the value of attribute name.



35
36
37
# File 'lib/ritual/extension/base.rb', line 35

def name
  @name
end

#path ⇒ Object (readonly)

Returns the value of attribute path.



35
36
37
# File 'lib/ritual/extension/base.rb', line 35

def path
  @path
end

#task_name ⇒ Object (readonly)

Returns the value of attribute task_name.



35
36
37
# File 'lib/ritual/extension/base.rb', line 35

def task_name
  @task_name
end

Instance Method Details

#define_tasks ⇒ Object

Raises:

  • (NotImplementedError)


37
38
39
# File 'lib/ritual/extension/base.rb', line 37

def define_tasks
  raise NotImplementedError, 'abstract'
end