Module: Bones

Defined in:
lib/bones.rb,
lib/bones/app.rb,
lib/bones/debug.rb,
lib/bones/app/command.rb,
lib/bones/app/file_manager.rb,
lib/bones/app/info_command.rb,
lib/bones/app/create_command.rb,
lib/bones/app/freeze_command.rb,
lib/bones/app/update_command.rb,
lib/bones/annotation_extractor.rb,
lib/bones/app/unfreeze_command.rb

Defined Under Namespace

Modules: Debug Classes: AnnotationExtractor, App

Constant Summary collapse

VERSION =

:stopdoc:

'2.5.1'
PATH =
File.expand_path(File.join(File.dirname(__FILE__), '..'))
HOME =
File.expand_path(ENV['HOME'] || ENV['USERPROFILE'])
DEV_NULL =
File.exist?('/dev/null') ? '/dev/null' : 'NUL:'
RUBY =

Ruby Interpreter location - taken from Rake source code

File.join(Config::CONFIG['bindir'],
Config::CONFIG['ruby_install_name']).sub(/.*\s.*/m, '"\&"')

Class Method Summary collapse

Class Method Details

.path(*args) ⇒ Object

Returns the path for Mr Bones. If any arguments are given, they will be joined to the end of the path using File.join.



21
22
23
# File 'lib/bones.rb', line 21

def self.path( *args )
  args.empty? ? PATH : File.join(PATH, args.flatten)
end

.require_all_libs_relative_to(fname, dir = nil) ⇒ Object

call-seq:

Bones.require_all_libs_relative_to( filename, directory = nil )

Utility method used to rquire all files ending in .rb that lie in the directory below this file that has the same name as the filename passed in. Optionally, a specific directory name can be passed in such that the filename does not have to be equivalent to the directory.



33
34
35
36
37
38
39
# File 'lib/bones.rb', line 33

def self.require_all_libs_relative_to( fname, dir = nil )
  dir ||= File.basename(fname, '.*')
  search_me = File.expand_path(
      File.join(File.dirname(fname), dir, '*.rb'))

  Dir.glob(search_me).sort.each {|rb| require rb}
end

.setupObject

call-seq:

Bones.setup


45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/bones.rb', line 45

def self.setup
  local_setup = File.join(Dir.pwd, %w[tasks setup.rb])

  if test(?e, local_setup)
    load local_setup
    return
  end

  bones_setup = ::Bones.path %w[lib bones tasks setup.rb]
  load bones_setup

  rakefiles = Dir.glob(File.join(Dir.pwd, %w[tasks *.rake])).sort
  rakefiles.each {|fn| Rake.application.add_import(fn)}
end