forked from NREL/OpenStudio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDarwinPostFlight.sh.in
39 lines (31 loc) · 2.48 KB
/
DarwinPostFlight.sh.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
ruby_install_dir="$2/Applications/${CMAKE_PROJECT_NAME} ${OPENSTUDIO_VERSION}/Ruby"
#---------- Create Symbolic Links to the Ruby bindings ----------
ln -sf "$2/Applications/${CMAKE_PROJECT_NAME} ${OPENSTUDIO_VERSION}/Ruby/openstudio.rb" /Library/Ruby/Site/
ln -sFf "$2/Applications/${CMAKE_PROJECT_NAME} ${OPENSTUDIO_VERSION}/Ruby/openstudio" /Library/Ruby/Site/
#---------- Create Symbolic Links to the openstudio-standards gem ----------
ln -sFf "$2/Applications/${CMAKE_PROJECT_NAME} ${OPENSTUDIO_VERSION}/ruby-2.0.0-aws-Darwin/lib/ruby/gems/2.0.0/gems/openstudio-standards-0.1.3" /Library/Ruby/Gems/2.0.0/gems/
ln -sf "$2/Applications/${CMAKE_PROJECT_NAME} ${OPENSTUDIO_VERSION}/ruby-2.0.0-aws-Darwin/lib/ruby/gems/2.0.0/specifications/openstudio-standards-0.1.3.gemspec" /Library/Ruby/Gems/2.0.0/specifications/
#---------- Write a plugin-config.rb file for later installation ----------
# And put it in the install folder for later reuse by the user if needed
config_file="$ruby_install_dir/Plugins/OpenStudio/OpenStudio-config"
echo "\$OPENSTUDIO_SKETCHUPPLUGIN_VERSION = '${OPENSTUDIO_VERSION}' ; require '$2/Applications/${CMAKE_PROJECT_NAME} ${OPENSTUDIO_VERSION}/Ruby/openstudio'" > "$config_file"
chmod 755 "$config_file"
chown $USER "$config_file"
#---------- Install plugin for SketchUp 201 ----------
# Check for the SketchUp 16 Application Support directory
SU16_support_dir="/Library/Application Support/SketchUp 2016"
mkdir -p "$SU16_support_dir/SketchUp/Plugins/OpenStudio"
# copy the plugin into the directory
cp "$ruby_install_dir/Plugins/OpenStudio.rb" "$SU16_support_dir/SketchUp/Plugins/OpenStudio.rb"
cp "$ruby_install_dir/Plugins/OpenStudio/Startup.rb" "$SU16_support_dir/SketchUp/Plugins/OpenStudio/Startup.rb"
cp "$config_file" "$SU16_support_dir/SketchUp/Plugins/OpenStudio/OpenStudio-config"
cp "$ruby_install_dir/Plugins/OpenStudio/OpenStudio.hash" "$SU16_support_dir/SketchUp/Plugins/OpenStudio/OpenStudio.hash"
#---------- Installation Directory Icon ----------
icon="$2/Applications/${CMAKE_PROJECT_NAME} ${OPENSTUDIO_VERSION}/$(printf 'Icon\r')"
touch "$icon"
chflags hidden "$icon"
# copy the icon into the resource fork
cp "$2/Applications/${CMAKE_PROJECT_NAME} ${OPENSTUDIO_VERSION}/OpenStudio.app/Contents/Resources/folder_icon.rsrc" "$icon/..namedfork/rsrc"
# set the custom icon extended attribute on the directory
xattr -wx com.apple.FinderInfo 0000000000000000040000000000000000000000000000000000000000000000 "$2/Applications/${CMAKE_PROJECT_NAME} ${OPENSTUDIO_VERSION}/"