Sha256: 12ace1b82313b89270ba524f9297cc565cff10bd18f495f567110948149a9adf

Contents?: true

Size: 1.67 KB

Versions: 3

Compression:

Stored size: 1.67 KB

Contents

Given /is configured for custom Applications icon$/ do
  appicon = File.expand_path(File.dirname(__FILE__) + "/../fixtures/custom_assets/appicon.icns")
  in_project_folder do
    append_to_file "Rakefile", <<-RUBY.gsub(/^    /, '')
    $choctop.applications_icon = "appicon.icns"
    RUBY
    FileUtils.cp(appicon, "appicon.icns")
  end
end

Given /^is configured for an asset file "([^\"]*)" to be included in dmg$/ do |file|
  choctop_add_file(file)
end

When /^dmg "(.*)" is mounted as "(.*)"$/ do |dmg, name|
  @stdout = File.expand_path(File.join(@tmp_root, "hdiutil.out"))
  in_project_folder do
    @mountpoint = ChocTop::Configuration.new.mountpoint
    FileUtils.mkdir_p @mountpoint
    @volume_path = "#{@mountpoint}/#{name}"
    `hdiutil attach '#{dmg}' -mountpoint '#{@volume_path}' -noautoopen > #{@stdout}`
  end
end

def in_mounted_volume(&block)
  FileUtils.chdir(@volume_path, &block)
end

Then %r{^folder "(.*)" in mounted volume (is|is not) created} do |folder, is|
  in_mounted_volume do
    File.exists?(folder).should(is == 'is' ? be_true : be_false)
  end
end

Then %r{^file "(.*)" in mounted volume (is|is not) created} do |file, is|
  in_mounted_volume do
    File.exists?(file).should(is == 'is' ? be_true : be_false)
  end
end

Then /^file "(.*)" in mounted volume (is|is not) invisible$/ do |file, is|
  in_mounted_volume do
    `GetFileInfo -aV '#{@volume_path}/#{file}'`.to_i.should_not == (is == 'is' ? 0 : 1)
  end
end

When /^webloc file "([^"]*)" links to "([^"]*)"$/ do |name, url|
  in_mounted_volume do
    File.exists?(name).should be_true
    
    `cp '#{name}' /tmp/link.plist`
    webloc_url = `defaults read /tmp/link URL`.strip
    webloc_url.should == url
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
choctop-0.14.1 features/step_definitions/dmg_steps.rb
choctop-0.14.0 features/step_definitions/dmg_steps.rb
choctop-0.13.1 features/step_definitions/dmg_steps.rb