Class: Zookeeper::RakeTasks::TestOneRuby

Inherits:
Rake::TaskLib
  • Object
show all
Includes:
Rake::DSL
Defined in:
lib/zookeeper/rake_tasks.rb

Constant Summary collapse

DEFAULT_RVM_RUBY_NAME =
'1.9.3'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) {|_self| ... } ⇒ TestOneRuby

Returns a new instance of TestOneRuby

Yields:

  • (_self)

Yield Parameters:


60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/zookeeper/rake_tasks.rb', line 60

def initialize(opts={})
  @namespace      = 'zk'
  @name           = nil
  @env            = {}
  @rvm_ruby_name  = nil
  @gemset_name    = nil

  opts.each { |k,v| __send__(:"#{k}=", v) }

  yield self if block_given?

  @gemset_name    ||= self.class.default_gemset_name
  
  # XXX: add an exception just for me in here (yes, i know this is naughty)
  #      or else i'd have to do this in every zk variant i want to test
  #      (like i have to now)

  unless @rvm_ruby_name
    @rvm_ruby_name = 'rbx-2.0.testing' if @name == 'rbx'
  end

  @rvm_ruby_name  ||= name

  @ruby_with_gemset         = "#{@rvm_ruby_name}@#{@gemset_name}"
  @create_gemset_name       = "#{namespace}:#{name}:create_gemset"
  @clobber_task_name        = "#{namespace}:#{name}:clobber"
  @clean_task_name          = "#{namespace}:#{name}:clean"
  @build_task_name          = "#{namespace}:#{name}:build"
  @bundle_task_name         = "#{namespace}:#{name}:bundle_install"
  @rspec_task_name          = "#{namespace}:#{name}:run_rspec"
  @phony_gemfile_link_name  = "Gemfile.#{name}"
  @phony_gemfile_lock_name  = "#{phony_gemfile_link_name}.lock"

  define_tasks
end

Instance Attribute Details

#build_task_nameObject (readonly)


43
44
45
# File 'lib/zookeeper/rake_tasks.rb', line 43

def build_task_name
  @build_task_name
end

#bundle_task_nameObject (readonly)


43
44
45
# File 'lib/zookeeper/rake_tasks.rb', line 43

def bundle_task_name
  @bundle_task_name
end

#clean_task_nameObject (readonly)


43
44
45
# File 'lib/zookeeper/rake_tasks.rb', line 43

def clean_task_name
  @clean_task_name
end

#clobber_task_nameObject (readonly)


43
44
45
# File 'lib/zookeeper/rake_tasks.rb', line 43

def clobber_task_name
  @clobber_task_name
end

#create_gemset_nameObject (readonly)


43
44
45
# File 'lib/zookeeper/rake_tasks.rb', line 43

def create_gemset_name
  @create_gemset_name
end

#envObject

any extra environment variables?


36
37
38
# File 'lib/zookeeper/rake_tasks.rb', line 36

def env
  @env
end

#gemset_nameObject

gemset name to use, deafults to the name of the gemspec in the top of the project directory (minus the .gempsec)


40
41
42
# File 'lib/zookeeper/rake_tasks.rb', line 40

def gemset_name
  @gemset_name
end

#nameObject

the name of the task (tasks will be 'zk:1.9.3:run_rspec')

this is mainly here so that the rvm ruby name rbx-2.0.testing will have its tasks defined as 'zk:rbx'


29
30
31
# File 'lib/zookeeper/rake_tasks.rb', line 29

def name
  @name
end

#namespaceObject

defaults to 'zk', test tasks will be built under this


22
23
24
# File 'lib/zookeeper/rake_tasks.rb', line 22

def namespace
  @namespace
end

43
44
45
# File 'lib/zookeeper/rake_tasks.rb', line 43

def phony_gemfile_link_name
  @phony_gemfile_link_name
end

#phony_gemfile_lock_nameObject (readonly)


43
44
45
# File 'lib/zookeeper/rake_tasks.rb', line 43

def phony_gemfile_lock_name
  @phony_gemfile_lock_name
end

#rspec_task_nameObject (readonly)


43
44
45
# File 'lib/zookeeper/rake_tasks.rb', line 43

def rspec_task_name
  @rspec_task_name
end

#ruby_with_gemsetObject (readonly)


43
44
45
# File 'lib/zookeeper/rake_tasks.rb', line 43

def ruby_with_gemset
  @ruby_with_gemset
end

#rvm_ruby_nameObject

what is the rvm name we should use for testing? (i.e. could be an alias) defaults to #name


33
34
35
# File 'lib/zookeeper/rake_tasks.rb', line 33

def rvm_ruby_name
  @rvm_ruby_name
end

Class Method Details

.default_gemset_nameObject


54
55
56
57
58
# File 'lib/zookeeper/rake_tasks.rb', line 54

def self.default_gemset_name
  ary = Dir['*.gemspec']
  raise 'No gemspec found' if ary.empty?
  ary.first[/(.+)\.gemspec\Z/, 1]
end