| |   |
| 21 | 21 | copy_deployment_to @java_app_deploy_path |
| 22 | 22 | generate_info_plist |
| 23 | 23 | generate_pkg_info |
| 24 | deploy_info_plist |
| 24 | 25 | deploy_artwork |
| 25 | 26 | deploy_app_stub |
| 26 | 27 | end |
| … | … | |
| 56 | 56 | end |
| 57 | 57 | end |
| 58 | 58 | |
| 59 | def deploy_info_plist |
| 60 | cp "Info.plist", "#{@mac_app_path}/Contents/" |
| 61 | end |
| 62 | |
| 59 | 63 | def generate_info_plist |
| 60 | | File.open "#{@mac_app_path}/Contents/Info.plist", 'w' do |file| |
| 61 | | file << <<-INFO_ENDL |
| 64 | unless File.exists? "Info.plist" |
| 65 | File.open "Info.plist", 'w' do |file| |
| 66 | file << <<-INFO_ENDL |
| 62 | 67 | <?xml version="1.0" encoding="UTF-8"?> |
| 63 | 68 | <!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd"> |
| 64 | 69 | <plist version="0.9"> |
| … | … | |
| 108 | 108 | </dict> |
| 109 | 109 | </plist> |
| 110 | 110 | INFO_ENDL |
| 111 | end |
| 111 | 112 | end |
| 112 | 113 | end |
| 113 | 114 | end |
| toggle raw diff |
--- a/lib/app_bundler.rb
+++ b/lib/app_bundler.rb
@@ -21,6 +21,7 @@ module Rawr
copy_deployment_to @java_app_deploy_path
generate_info_plist
generate_pkg_info
+ deploy_info_plist
deploy_artwork
deploy_app_stub
end
@@ -55,9 +56,14 @@ module Rawr
end
end
+ def deploy_info_plist
+ cp "Info.plist", "#{@mac_app_path}/Contents/"
+ end
+
def generate_info_plist
- File.open "#{@mac_app_path}/Contents/Info.plist", 'w' do |file|
- file << <<-INFO_ENDL
+ unless File.exists? "Info.plist"
+ File.open "Info.plist", 'w' do |file|
+ file << <<-INFO_ENDL
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">
@@ -102,6 +108,7 @@ module Rawr
</dict>
</plist>
INFO_ENDL
+ end
end
end
end |
| |   |
| 4 | 4 | describe Rawr::AppBundler do |
| 5 | 5 | include CustomFileMatchers |
| 6 | 6 | |
| 7 | | it "creates the proper directory structure" do |
| 7 | it "creates the proper directory structure for a .app" do |
| 8 | 8 | begin |
| 9 | 9 | Rawr::AppBundler.new.create_clean_deployment_directory_structure("spec-temp", "spec-temp/native_deploy/mac", "spec-temp/native_deploy/mac/RawrSpec.app") |
| 10 | 10 | |
| … | … | |
| 14 | 14 | "spec-temp/native_deploy/mac/RawrSpec.app/Contents/Resources".should be_existing_file |
| 15 | 15 | ensure |
| 16 | 16 | FileUtils.rm_rf "spec-temp" |
| 17 | FileUtils.rm_f "Info.plist" |
| 18 | end |
| 19 | end |
| 20 | |
| 21 | it "creates an Info.plist file if it didn't exist before in the application root" do |
| 22 | begin |
| 23 | "Info.plist".should_not be_existing_file |
| 24 | |
| 25 | app_bundler = Rawr::AppBundler.new |
| 26 | app_bundler.generate_info_plist |
| 27 | |
| 28 | "Info.plist".should be_existing_file |
| 29 | ensure |
| 30 | FileUtils.rm_f "Info.plist" |
| 31 | end |
| 32 | end |
| 33 | |
| 34 | it "copies the Info.plist file to .app/Contents directory during packaging" do |
| 35 | begin |
| 36 | FileUtils.mkdir_p "spec-temp/native_deploy/mac/RawrSpec.app/Contents/" |
| 37 | File.open("Info.plist", File::CREAT) do |file| |
| 38 | file << "" |
| 39 | end |
| 40 | |
| 41 | "spec-temp/native_deploy/mac/RawrSpec.app/Contents/Info.plist".should_not be_existing_file |
| 42 | |
| 43 | app_bundler = Rawr::AppBundler.new |
| 44 | app_bundler.instance_variable_set(:@mac_app_path, "spec-temp/native_deploy/mac/RawrSpec.app") |
| 45 | app_bundler.deploy_info_plist |
| 46 | |
| 47 | "spec-temp/native_deploy/mac/RawrSpec.app/Contents/Info.plist".should be_existing_file |
| 48 | ensure |
| 49 | FileUtils.rm_rf "spec-temp" |
| 50 | FileUtils.rm_f "Info.plist" |
| 17 | 51 | end |
| 18 | 52 | end |
| 19 | 53 | end |
| toggle raw diff |
--- a/test/unit/app_bundler_spec.rb
+++ b/test/unit/app_bundler_spec.rb
@@ -4,7 +4,7 @@ require 'spec_helpers'
describe Rawr::AppBundler do
include CustomFileMatchers
- it "creates the proper directory structure" do
+ it "creates the proper directory structure for a .app" do
begin
Rawr::AppBundler.new.create_clean_deployment_directory_structure("spec-temp", "spec-temp/native_deploy/mac", "spec-temp/native_deploy/mac/RawrSpec.app")
@@ -14,6 +14,40 @@ describe Rawr::AppBundler do
"spec-temp/native_deploy/mac/RawrSpec.app/Contents/Resources".should be_existing_file
ensure
FileUtils.rm_rf "spec-temp"
+ FileUtils.rm_f "Info.plist"
+ end
+ end
+
+ it "creates an Info.plist file if it didn't exist before in the application root" do
+ begin
+ "Info.plist".should_not be_existing_file
+
+ app_bundler = Rawr::AppBundler.new
+ app_bundler.generate_info_plist
+
+ "Info.plist".should be_existing_file
+ ensure
+ FileUtils.rm_f "Info.plist"
+ end
+ end
+
+ it "copies the Info.plist file to .app/Contents directory during packaging" do
+ begin
+ FileUtils.mkdir_p "spec-temp/native_deploy/mac/RawrSpec.app/Contents/"
+ File.open("Info.plist", File::CREAT) do |file|
+ file << ""
+ end
+
+ "spec-temp/native_deploy/mac/RawrSpec.app/Contents/Info.plist".should_not be_existing_file
+
+ app_bundler = Rawr::AppBundler.new
+ app_bundler.instance_variable_set(:@mac_app_path, "spec-temp/native_deploy/mac/RawrSpec.app")
+ app_bundler.deploy_info_plist
+
+ "spec-temp/native_deploy/mac/RawrSpec.app/Contents/Info.plist".should be_existing_file
+ ensure
+ FileUtils.rm_rf "spec-temp"
+ FileUtils.rm_f "Info.plist"
end
end
end
\ No newline at end of file |