Class: Raketeer::IRBTask

Inherits:
Rake::TaskLib
  • Object
show all
Defined in:
lib/raketeer/irb_task.rb

Overview

Author:

  • Jonathan Bradley Whited

Since:

  • 0.1.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = :irb) {|_self| ... } ⇒ IRBTask

Returns a new instance of IRBTask.

Yields:

  • (_self)

Yield Parameters:

Since:

  • 0.1.0



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/raketeer/irb_task.rb', line 32

def initialize(name=:irb)
  super()

  @description = 'Open an irb session loaded with this library'
  @main_module = Util.find_main_module
  @name = name
  @warning = true

  @irb_cmd = ['irb']
  @irb_cmd.push('-r','rubygems')
  @irb_cmd.push('-r','bundler/setup')

  yield self if block_given?

  @irb_cmd.push('-r',@main_module) unless @main_module.nil?
  @irb_cmd << '-w' if @warning

  define
end

Instance Attribute Details

#descriptionObject

Since:

  • 0.1.0



24
25
26
# File 'lib/raketeer/irb_task.rb', line 24

def description
  @description
end

#irb_cmdObject

Since:

  • 0.1.0



25
26
27
# File 'lib/raketeer/irb_task.rb', line 25

def irb_cmd
  @irb_cmd
end

#main_moduleObject

Since:

  • 0.1.0



26
27
28
# File 'lib/raketeer/irb_task.rb', line 26

def main_module
  @main_module
end

#nameObject

Since:

  • 0.1.0



27
28
29
# File 'lib/raketeer/irb_task.rb', line 27

def name
  @name
end

#warningObject Also known as: warning?

Since:

  • 0.1.0



28
29
30
# File 'lib/raketeer/irb_task.rb', line 28

def warning
  @warning
end

Instance Method Details

#defineObject

Since:

  • 0.1.0



52
53
54
55
56
57
# File 'lib/raketeer/irb_task.rb', line 52

def define
  desc @description
  task @name do |task,args|
    sh(*@irb_cmd)
  end
end