Class: Jrmvnrunner::Dsl

Inherits:
Object
  • Object
show all
Defined in:
lib/jrmvnrunner/dsl.rb

Defined Under Namespace

Classes: Gem, Pom

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDsl

Returns a new instance of Dsl.



50
51
52
53
54
# File 'lib/jrmvnrunner/dsl.rb', line 50

def initialize
  @pom = Pom.new
  @gem = Gem.new
  @project_info = {:name => "jrmvnrunner", :version => '1.0'}
end

Instance Attribute Details

#gemObject (readonly)

Returns the value of attribute gem.



47
48
49
# File 'lib/jrmvnrunner/dsl.rb', line 47

def gem
  @gem
end

#pomObject (readonly)

Returns the value of attribute pom.



46
47
48
# File 'lib/jrmvnrunner/dsl.rb', line 46

def pom
  @pom
end

#project_infoObject (readonly)

Returns the value of attribute project_info.



48
49
50
# File 'lib/jrmvnrunner/dsl.rb', line 48

def project_info
  @project_info
end

Instance Method Details

#Gemfile(code = nil, &block) ⇒ Object



66
67
68
69
70
71
72
# File 'lib/jrmvnrunner/dsl.rb', line 66

def Gemfile(code=nil, &block)
  if code
    @gem.source=code
  else
    @gem.source=block.to_ruby if block_given?
  end
end

#Pomfile(code = nil, &block) ⇒ Object



56
57
58
59
60
61
62
63
64
# File 'lib/jrmvnrunner/dsl.rb', line 56

def Pomfile(code=nil, &block)
  if code
    @pom.instance_exec do
      eval(code)
    end
  else
    @pom.instance_exec(&block) if block_given?
  end
end

#project(path) ⇒ Object



74
75
76
77
78
79
80
81
# File 'lib/jrmvnrunner/dsl.rb', line 74

def project(path)
  path = path.split(':')
  @project_info.merge!(
      :group_id => path[0],
      :name => path[1],
      :version => path[2]
  )
end