Skip to content

Commit

Permalink
Add some specs for the ruby_deploy --embed option
Browse files Browse the repository at this point in the history
  • Loading branch information
ferrous26 committed May 6, 2011
1 parent ff0cdc5 commit c80d230
Showing 1 changed file with 54 additions and 3 deletions.
57 changes: 54 additions & 3 deletions spec/macruby/command_line/ruby_deploy_spec.rb
Expand Up @@ -17,16 +17,24 @@ def install_name(path)
`/usr/bin/otool -L '#{path}'`
end

def resources
File.join(@app_bundle, 'Contents', 'Resources')
end

def rbos
Dir.glob("#{@app_bundle}/Contents/Resources/**/*.rbo")
Dir.glob("#{resources}/**/*.rbo")
end

def rbs
Dir.glob("#{@app_bundle}/Contents/Resources/**/*.rb")
Dir.glob("#{resources}/**/*.rb")
end

def binaries
rbos + [File.join(@app_bundle, 'Contents/MacOS/Dummy')]
rbos + [File.join(@app_bundle, 'Contents', 'MacOS', 'Dummy')]
end

def framework
File.join(@app_bundle, 'Contents', 'Frameworks', 'MacRuby.framework', 'Versions')
end
end

Expand Down Expand Up @@ -120,4 +128,47 @@ def binaries
end
end

describe 'the --embed option' do
it 'copies the framework to Contents/Frameworks' do
deploy('--embed')
Dir.exists?(framework).should == true
Dir.exists?(File.join(framework, 'Current/usr/lib/ruby')).should == true
File.exists?(File.join(framework, 'Current/usr/lib/libmacruby.1.9.2.dylib'))
end

it 'only copies the Current version' do
deploy('--embed')
dirs = Dir.entries(framework) - ['.','..']
dirs.count.should == 1
dirs.should include('Current')
end

it 'does not copy headers, binaries, or documentation into the app bundle' do
deploy('--embed')
dirs = Dir.entries(File.join(framework, 'Current', 'usr'))
['bin','include','share'].each do |dir|
dirs.should_not include(dir)
end
# TODO is the libmacruby-static.a file used by anyone?
end

# TODO is this test too naive?
it 'embeds bridge support files when combined with --bs' do
deploy('--embed --bs')
bs_dir = File.join(resources, 'BridgeSupport')
Dir.exists?(bs_dir)
(Dir.entries(bs_dir) - ['.', '..']).should_not be_empty
end

it 'removes the stdlib when combined with --no-stdlib' do
deploy('--embed --no-stdlib')
stdlib_dir = File.join(framework, 'Current', 'usr', 'lib', 'ruby')
Dir.exists?(stdlib_dir).should == false
end

# TODO --gem GEM
# TODO make sure installed gems aren't embedded by default
# TODO --stdlib LIB
end

end

0 comments on commit c80d230

Please sign in to comment.