Class: Roasted::Provider::App::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/roasted/provider/app.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Parser

Returns a new instance of Parser.



189
190
191
# File 'lib/roasted/provider/app.rb', line 189

def initialize(app)
  @app = app
end

Instance Method Details

#accept_eulaObject



204
205
206
# File 'lib/roasted/provider/app.rb', line 204

def accept_eula
  @app.accept_eula = true
end

#after_install(&block) ⇒ Object



220
221
222
# File 'lib/roasted/provider/app.rb', line 220

def after_install(&block)
  @app.hooks[:after_install] = block
end

#checksum(checksum) ⇒ Object



200
201
202
# File 'lib/roasted/provider/app.rb', line 200

def checksum(checksum)
  @app.checksum = checksum
end

#defaults(domain) ⇒ Object



216
217
218
# File 'lib/roasted/provider/app.rb', line 216

def defaults(domain)
  @app.domain = domain
end

#installs(appname, options = {}) ⇒ Object



208
209
210
# File 'lib/roasted/provider/app.rb', line 208

def installs(appname, options = {})
  @app.installs = options.merge(:app => appname)
end

#license(type, options = {}, &block) ⇒ Object



212
213
214
# File 'lib/roasted/provider/app.rb', line 212

def license(type, options = {}, &block)
  @app.license = {:type => type, :options => options, :block => block}
end

#preferences(prefs) ⇒ Object



224
225
226
227
228
229
230
231
232
233
234
235
# File 'lib/roasted/provider/app.rb', line 224

def preferences(prefs)
  domain_exists = system("defaults domains | grep #{@app.domain} >/dev/null")
  
  if domain_exists
    prefs.each do |key, value|
      system "defaults write #{@app.domain} '#{key}' '#{value}'"
    end
  else
    plist = prefs.collect {|key, value| "\"#{key}\" = \"#{value}\";"}.join(" ")
    system "defaults write #{@app.domain} '{#{plist}}'"
  end
end

#source(source, options = {}) ⇒ Object

DSL actions



194
195
196
197
198
# File 'lib/roasted/provider/app.rb', line 194

def source(source, options = {})
  # version = options[:version] || :default
  @app.source = source
  @app.type = options.delete(:type)
end