Class: Cibuildgem::CompilationTasks

Inherits:
Object
  • Object
show all
Defined in:
lib/cibuildgem/compilation_tasks.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(create_packaging_task = false, gemspec = nil) ⇒ CompilationTasks

Returns a new instance of CompilationTasks.



12
13
14
15
16
17
# File 'lib/cibuildgem/compilation_tasks.rb', line 12

def initialize(create_packaging_task = false, gemspec = nil)
  @gemspec = Bundler.load_gemspec(gemspec || find_gemspec)
  verify_gemspec!

  @create_packaging_task = create_packaging_task
end

Instance Attribute Details

#create_packaging_taskObject (readonly)

Returns the value of attribute create_packaging_task.



10
11
12
# File 'lib/cibuildgem/compilation_tasks.rb', line 10

def create_packaging_task
  @create_packaging_task
end

#extension_taskObject (readonly)

Returns the value of attribute extension_task.



10
11
12
# File 'lib/cibuildgem/compilation_tasks.rb', line 10

def extension_task
  @extension_task
end

#gemspecObject (readonly)

Returns the value of attribute gemspec.



10
11
12
# File 'lib/cibuildgem/compilation_tasks.rb', line 10

def gemspec
  @gemspec
end

#nativeObject (readonly)

Returns the value of attribute native.



10
11
12
# File 'lib/cibuildgem/compilation_tasks.rb', line 10

def native
  @native
end

Instance Method Details

#normalized_platformObject



37
38
39
40
41
42
43
44
45
# File 'lib/cibuildgem/compilation_tasks.rb', line 37

def normalized_platform
  platform = RUBY_PLATFORM

  if darwin?
    RUBY_PLATFORM.sub(/(.*-darwin)\d+/, '\1')
  else
    platform
  end
end

#ruby_cc_versionObject



30
31
32
33
34
35
# File 'lib/cibuildgem/compilation_tasks.rb', line 30

def ruby_cc_version
  required_ruby_version = @gemspec.required_ruby_version
  selected_rubies = RubySeries.versions_to_compile_against(required_ruby_version)

  selected_rubies.map(&:to_s).join(":")
end

#setupObject



19
20
21
22
23
24
25
26
27
28
# File 'lib/cibuildgem/compilation_tasks.rb', line 19

def setup
  Rake::ExtensionTask.enable!

  gemspec.extensions.each do |path|
    binary_name = parse_extconf(path)
    define_task(path, binary_name)
  end

  setup_packaging if create_packaging_task
end