Module: Pamela

Defined in:
lib/pamela/pamela.rb,
lib/pamela/version.rb

Constant Summary collapse

Version =
VERSION = '0.1'

Class Method Summary collapse

Class Method Details

.app_nameObject



31
32
33
34
35
# File 'lib/pamela/pamela.rb', line 31

def self.app_name
  rakefile_dir = Rake.application.find_rakefile_location.last
  name = rakefile_dir.split("/").last
  name or raise Exception, "Project name not found"
end

.consoleObject



25
26
27
28
29
# File 'lib/pamela/pamela.rb', line 25

def self.console
  task :console do
    start_irb(self.app_name)
  end
end

.load(*args) ⇒ Object



2
3
4
# File 'lib/pamela/pamela.rb', line 2

def self.load(*args)
  args.flatten.each { |arg| self.send(arg) }
end

.specObject



6
7
8
9
10
11
12
13
14
# File 'lib/pamela/pamela.rb', line 6

def self.spec
  require 'rspec/core/rake_task'

  file_list = FileList['spec/**/*_spec.rb']
  RSpec::Core::RakeTask.new('spec') do |t|
    t.pattern = file_list
    t.rspec_opts = ["--colour", "--format progress"]
  end
end

.start_irb(app_name) ⇒ Object



37
38
39
# File 'lib/pamela/pamela.rb', line 37

def self.start_irb(app_name)
  exec("irb -Ilib -r#{self.app_name}")
end

.testObject



16
17
18
19
20
21
22
23
# File 'lib/pamela/pamela.rb', line 16

def self.test
  require 'rake/testtask'
  file_list = FileList['test/**/*test*.rb']
  Rake::TestTask.new do |t|
    t.libs << "test"
    t.test_files = file_list
  end
end