Module: Jrmvnrunner

Defined in:
lib/jrmvnrunner.rb,
lib/jrmvnrunner/dsl.rb,
lib/jrmvnrunner/runner.rb

Defined Under Namespace

Classes: Dsl, Runner

Constant Summary collapse

VERSION =
"0.1.1"
MYDIR =
Pathname.new(File.dirname(File.expand_path(__FILE__)))

Class Method Summary collapse

Class Method Details

.init!(wdir = Dir.pwd, cmd = nil, args = []) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/jrmvnrunner.rb', line 9

def self.init!(wdir = Dir.pwd, cmd = nil, args = [])
  root = Pathname.new(wdir)

  runnerfile = root.join("Jrmvnrunner")
  if File.exists?(runnerfile)
    dsl = Dsl.new
    runner_conf = File.read(runnerfile)

    dsl.instance_exec do
      eval(runner_conf.match(/(project .+)\n/)[1])
    end

    dsl.Pomfile(runner_conf.match(/Pomfile\s+do\s(.+?)end/m)[1])
    dsl.Gemfile(runner_conf.match(/Gemfile\s+do\s(.+?)end/m)[1])
    runner = Runner.new(cmd, {
        :gem => dsl.gem,
        :pom => dsl.pom,
        :project => dsl.project_info,
        :root => root,
        :args => args
    })
    runner.execute!
  end
end