Class: ChocTop::Configuration
- Inherits:
-
Object
- Object
- ChocTop::Configuration
- Defined in:
- lib/choctop.rb
Constant Summary collapse
- VERSION =
'0.13.1'
Instance Attribute Summary collapse
-
#app_icon_position ⇒ Object
x, y position of this project’s icon on the custom DMG Default: a useful position for the icon against the default background.
- #appcast_filename ⇒ Object
-
#applications_icon ⇒ Object
Custom icon for the Applications symlink icon Default: none.
-
#applications_icon_position ⇒ Object
x, y position of the Applications symlink icon on the custom DMG Default: a useful position for the icon against the default background.
-
#background_file ⇒ Object
Path to background .icns image file for custom DMG Value should be file path relative to root of project Default: a choctop supplied background image that matches to default app_icon_position + applications_icon_position To have no custom background, set value to
nil. - #base_url ⇒ Object
- #build_opts ⇒ Object
-
#build_products ⇒ Object
Returns the value of attribute build_products.
-
#build_target ⇒ Object
The name of the target in Xcode, such as MacRuby’s Compile or Embed.
-
#build_type ⇒ Object
The build type of the distributed DMG file Default: Release.
-
#dmg_src_folder ⇒ Object
Folder from where all files will be copied into the DMG Files are copied here if specified with
add_filebefore DMG creation. -
#files ⇒ Object
List of files/bundles to be packaged into the DMG.
-
#host ⇒ Object
The host name, e.g.
-
#icon_size ⇒ Object
Size of icons, in pixels, within custom DMG (between 16 and 128) Default: 104 - this is nice and big.
-
#icon_text_size ⇒ Object
Icon text size Can pass integer (12) or string (“12” or “12 px”) Default: 12 (px).
-
#name ⇒ Object
The name of the Cocoa application Default: info_plist or project folder name if “$EXECUTABLE_NAME”.
-
#readme ⇒ Object
The file name for the project readme file Default: README.txt.
-
#release_notes ⇒ Object
The file name for generated release notes for the latest release Default: release_notes.html.
-
#release_notes_template ⇒ Object
The path for an HTML template into which the release_notes.txt are inserted after conversion to HTML.
-
#remote_dir ⇒ Object
The remote directory where the xml + dmg files will be uploaded.
-
#rsync_args ⇒ Object
The argument flags passed to rsync Default: -aCv.
-
#scp_args ⇒ Object
Additional arguments to pass to scp e.g.
- #su_feed_url ⇒ Object
-
#target ⇒ Object
The target name of the distributed DMG file Default: ##name.app.
-
#transport ⇒ Object
Defines the transport to use for upload, default is :rsync, :scp is also available.
-
#user ⇒ Object
The user to log in on the remote server.
-
#version ⇒ Object
The version of the Cocoa application Default: info_plist.
-
#volume_icon ⇒ Object
Path to an .icns file for the DMG’s volume icon (looks like a disk or drive) Default: a DMG icon provided within choctop To get default, boring blank DMG volume icon, set value to
nil.
Instance Method Summary collapse
-
#build_path ⇒ Object
Path to built DMG, sparkle’s xml file and other assets to be uploaded to remote server.
-
#file(*args, &block) ⇒ Object
(also: #add_file)
Add an explicit file/bundle/folder into the DMG Examples: file ‘build/Release/SampleApp.app’, :position => [50, 100] file :target_bundle, :position => [50, 100] file proc { ‘README.txt’ }, :position => [50, 100] file :position => [50, 100] { ‘README.txt’ } Required option:
:position- two item array [x, y] window position Options::name- override the name of the project when mounted in the DMG:exclude- do not include files/folders. - #info_plist ⇒ Object
-
#info_plist_name ⇒ Object
Name of the Info.plist file Default: “Info.plist”.
-
#info_plist_path ⇒ Object
Path to the Info.plist Default: project directory.
-
#initialize {|_self| ... } ⇒ Configuration
constructor
A new instance of Configuration.
-
#link(url, *options) ⇒ Object
(also: #add_link)
Add the whole project as a mounted item; e.g.
- #mountpoint ⇒ Object
-
#pkg ⇒ Object
Path to generated package DMG.
-
#pkg_name ⇒ Object
Generated filename for a distribution, from name, version and .dmg e.g.
-
#pkg_relative_url ⇒ Object
The url for the remote package, without the protocol + host e.g.
-
#root(options) ⇒ Object
(also: #add_root)
Add the whole project as a mounted item; e.g.
- #target_bundle ⇒ Object
-
#versionless_pkg_name ⇒ Object
Version-less generated filename for a distribution, from name and .dmg e.g.
-
#volume_path ⇒ Object
Path to Volume when DMG is mounted.
Methods included from RakeTasks
Methods included from Dmg
#add_eula, #add_file_to_dmg_src_folder, #add_link_to_dmg_src_folder, #background_bounds, #configure_applications_icon, #configure_dmg_window, #configure_volume_icon, #convert_dmg_readonly, #copy_files, #detach_dmg, #include_applications_icon?, #make_dmg, #prepare_files, #run_applescript, #set_position_of_files, #set_position_of_shortcuts, #statusbar_height, #tmp_dmg_src_folder, #volume_background, #window_bounds, #window_position
Methods included from Appcast
#dsa_signature, #make_appcast, #make_build, #make_dmg_symlink, #make_index_redirect, #make_release_notes, #private_key, #release_notes_content, #release_notes_html, #skip_xcode_build, #upload_appcast
Constructor Details
#initialize {|_self| ... } ⇒ Configuration
Returns a new instance of Configuration.
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 |
# File 'lib/choctop.rb', line 301 def initialize $choctop = $sparkle = self # define a global variable for this object ($sparkle is legacy) yield self if block_given? # Defaults @name ||= info_plist['CFBundleExecutable'] || File.basename(File.(".")) @name = File.basename(File.(".")) if @name == '${EXECUTABLE_NAME}' @version ||= info_plist['CFBundleVersion'] @build_type = ENV['BUILD_TYPE'] || 'Release' if base_url @host ||= URI.parse(base_url).host end @release_notes ||= 'release_notes.html' @readme ||= 'README.txt' @release_notes_template ||= "release_notes_template.html.erb" @rsync_args ||= '-aCv --progress' @background_file ||= File.dirname(__FILE__) + "/../assets/sky_background.jpg" @app_icon_position ||= [175, 65] @applications_icon_position ||= [347, 270] @volume_icon ||= File.dirname(__FILE__) + "/../assets/DefaultVolumeIcon.icns" @icon_size ||= 104 @icon_text_size ||= 12 add_file :target_bundle, :position => app_icon_position define_tasks end |
Instance Attribute Details
#app_icon_position ⇒ Object
x, y position of this project’s icon on the custom DMG Default: a useful position for the icon against the default background
201 202 203 |
# File 'lib/choctop.rb', line 201 def app_icon_position @app_icon_position end |
#appcast_filename ⇒ Object
123 124 125 |
# File 'lib/choctop.rb', line 123 def appcast_filename @appcast_filename ||= su_feed_url ? File.basename(su_feed_url) : 'my_feed.xml' end |
#applications_icon ⇒ Object
Custom icon for the Applications symlink icon Default: none
214 215 216 |
# File 'lib/choctop.rb', line 214 def applications_icon @applications_icon end |
#applications_icon_position ⇒ Object
x, y position of the Applications symlink icon on the custom DMG Default: a useful position for the icon against the default background
205 206 207 |
# File 'lib/choctop.rb', line 205 def applications_icon_position @applications_icon_position end |
#background_file ⇒ Object
Path to background .icns image file for custom DMG Value should be file path relative to root of project Default: a choctop supplied background image that matches to default app_icon_position + applications_icon_position To have no custom background, set value to nil
197 198 199 |
# File 'lib/choctop.rb', line 197 def background_file @background_file end |
#base_url ⇒ Object
90 91 92 93 94 95 96 |
# File 'lib/choctop.rb', line 90 def base_url if su_feed_url @base_url ||= File.dirname(su_feed_url) else @base_url end end |
#build_opts ⇒ Object
24 25 26 |
# File 'lib/choctop.rb', line 24 def build_opts @build_opts ||= '' end |
#build_products ⇒ Object
Returns the value of attribute build_products.
144 145 146 |
# File 'lib/choctop.rb', line 144 def build_products @build_products end |
#build_target ⇒ Object
The name of the target in Xcode, such as MacRuby’s Compile or Embed. Uses the application name by default.
59 60 61 |
# File 'lib/choctop.rb', line 59 def build_target @build_target end |
#build_type ⇒ Object
The build type of the distributed DMG file Default: Release
70 71 72 |
# File 'lib/choctop.rb', line 70 def build_type @build_type end |
#dmg_src_folder ⇒ Object
Folder from where all files will be copied into the DMG Files are copied here if specified with add_file before DMG creation
151 152 153 |
# File 'lib/choctop.rb', line 151 def dmg_src_folder @dmg_src_folder end |
#files ⇒ Object
List of files/bundles to be packaged into the DMG
107 108 109 |
# File 'lib/choctop.rb', line 107 def files @files end |
#host ⇒ Object
The host name, e.g. some-domain.com Default: host from base_url
81 82 83 |
# File 'lib/choctop.rb', line 81 def host @host end |
#icon_size ⇒ Object
Size of icons, in pixels, within custom DMG (between 16 and 128) Default: 104 - this is nice and big
218 219 220 |
# File 'lib/choctop.rb', line 218 def icon_size @icon_size end |
#icon_text_size ⇒ Object
Icon text size Can pass integer (12) or string (“12” or “12 px”) Default: 12 (px)
223 224 225 |
# File 'lib/choctop.rb', line 223 def icon_text_size @icon_text_size end |
#name ⇒ Object
The name of the Cocoa application Default: info_plist or project folder name if “$EXECUTABLE_NAME”
43 44 45 |
# File 'lib/choctop.rb', line 43 def name @name end |
#readme ⇒ Object
The file name for the project readme file Default: README.txt
104 105 106 |
# File 'lib/choctop.rb', line 104 def readme @readme end |
#release_notes ⇒ Object
The file name for generated release notes for the latest release Default: release_notes.html
100 101 102 |
# File 'lib/choctop.rb', line 100 def release_notes @release_notes end |
#release_notes_template ⇒ Object
The path for an HTML template into which the release_notes.txt are inserted after conversion to HTML
The template file is an ERb template, with <%= yield %> as the placeholder for the generated release notes.
Currently, any CSS or JavaScript must be inline
Default: release_notes_template.html.erb, which was generated by install_choctop into each project
118 119 120 |
# File 'lib/choctop.rb', line 118 def release_notes_template @release_notes_template end |
#remote_dir ⇒ Object
The remote directory where the xml + dmg files will be uploaded
128 129 130 |
# File 'lib/choctop.rb', line 128 def remote_dir @remote_dir end |
#rsync_args ⇒ Object
The argument flags passed to rsync Default: -aCv
138 139 140 |
# File 'lib/choctop.rb', line 138 def rsync_args @rsync_args end |
#scp_args ⇒ Object
Additional arguments to pass to scp e.g. -P 11222
142 143 144 |
# File 'lib/choctop.rb', line 142 def scp_args @scp_args end |
#su_feed_url ⇒ Object
75 76 77 |
# File 'lib/choctop.rb', line 75 def su_feed_url @su_feed_url ||= info_plist['SUFeedURL'] end |
#target ⇒ Object
The target name of the distributed DMG file Default: ##name.app
51 52 53 |
# File 'lib/choctop.rb', line 51 def target @target end |
#transport ⇒ Object
Defines the transport to use for upload, default is :rsync, :scp is also available
131 132 133 |
# File 'lib/choctop.rb', line 131 def transport @transport end |
#user ⇒ Object
The user to log in on the remote server. Default: empty
85 86 87 |
# File 'lib/choctop.rb', line 85 def user @user end |
#version ⇒ Object
The version of the Cocoa application Default: info_plist
47 48 49 |
# File 'lib/choctop.rb', line 47 def version @version end |
#volume_icon ⇒ Object
Path to an .icns file for the DMG’s volume icon (looks like a disk or drive) Default: a DMG icon provided within choctop To get default, boring blank DMG volume icon, set value to nil
210 211 212 |
# File 'lib/choctop.rb', line 210 def volume_icon @volume_icon end |
Instance Method Details
#build_path ⇒ Object
Path to built DMG, sparkle’s xml file and other assets to be uploaded to remote server
174 175 176 |
# File 'lib/choctop.rb', line 174 def build_path "appcast/build" end |
#file(*args, &block) ⇒ Object Also known as: add_file
Add an explicit file/bundle/folder into the DMG Examples:
file 'build/Release/SampleApp.app', :position => [50, 100]
file :target_bundle, :position => [50, 100]
file proc { 'README.txt' }, :position => [50, 100]
file :position => [50, 100] { 'README.txt' }
Required option:
+:position+ - two item array [x, y] window position
Options:
+:name+ - override the name of the project when mounted in the DMG
+:exclude+ - do not include files/folders
255 256 257 258 259 260 |
# File 'lib/choctop.rb', line 255 def file(*args, &block) path_or_helper, = args.first.is_a?(Hash) ? [block, args.first] : [args.first, args.last] throw "add_files #{path_or_helper}, :position => [x,y] option is missing" unless [:position] self.files ||= {} files[path_or_helper] = end |
#info_plist ⇒ Object
240 241 242 |
# File 'lib/choctop.rb', line 240 def info_plist @info_plist ||= OSX::NSDictionary.dictionaryWithContentsOfFile(info_plist_path) || {} end |
#info_plist_name ⇒ Object
Name of the Info.plist file Default: “Info.plist”
36 37 38 |
# File 'lib/choctop.rb', line 36 def info_plist_name @info_plist_name ||= 'Info.plist' end |
#info_plist_path ⇒ Object
Path to the Info.plist Default: project directory
30 31 32 |
# File 'lib/choctop.rb', line 30 def info_plist_path @info_plist_path ||= File.(info_plist_name) end |
#link(url, *options) ⇒ Object Also known as: add_link
Add the whole project as a mounted item; e.g. a TextMate bundle Examples:
add_link "http://github.com/drnic/choctop", :name => 'Github', :position => [50, 100]
add_link "http://github.com/drnic/choctop", 'Github.webloc', :position => [50, 100]
Required option:
+:position+ - two item array [x, y] window position
+:name+ - override the name of the project when mounted in the DMG
287 288 289 290 291 292 293 294 295 296 297 298 |
# File 'lib/choctop.rb', line 287 def link(url, *) name = .first if .first.is_a?(String) = .last || {} [:url] = url [:name] = name if name throw "add_link :position => [x,y] option is missing" unless [:position] throw "add_link :name => 'Name' option is missing" unless [:name] [:name].gsub!(/(\.webloc|\.url)$/, '') [:name] += ".webloc" self.files ||= {} files[[:name]] = end |
#mountpoint ⇒ Object
178 179 180 181 |
# File 'lib/choctop.rb', line 178 def mountpoint # @mountpoint ||= "/tmp/build/mountpoint#{rand(10000000)}" @mountpoint ||= "/Volumes" end |
#pkg ⇒ Object
Path to generated package DMG
169 170 171 |
# File 'lib/choctop.rb', line 169 def pkg "#{build_path}/#{pkg_name}" end |
#pkg_name ⇒ Object
Generated filename for a distribution, from name, version and .dmg e.g. MyApp-1.0.0.dmg
158 159 160 |
# File 'lib/choctop.rb', line 158 def pkg_name version ? "#{name}-#{version}.dmg" : versionless_pkg_name end |
#pkg_relative_url ⇒ Object
The url for the remote package, without the protocol + host e.g. if absolute url is mydomain.com/downloads/MyApp-1.0.dmg then pkg_relative_url is /downloads/MyApp-1.0.dmg
232 233 234 235 236 237 238 |
# File 'lib/choctop.rb', line 232 def pkg_relative_url unless base_url raise "The base url should be set in order to create a sparkle feed. Set the SUFeedURL in your Info.plist." end _base_url = base_url.gsub(%r{/$}, '') "#{_base_url}/#{pkg_name}".gsub(%r{^.*#{host}}, '') end |
#root(options) ⇒ Object Also known as: add_root
Add the whole project as a mounted item; e.g. a TextMate bundle Examples:
root :position => [50, 100]
add_root :position => [50, 100], :name => 'My Thing'
Required option:
+:position+ - two item array [x, y] window position
Options:
+:name+ - override the name of the project when mounted in the DMG
+:exclude+ - do not include files/folders
272 273 274 275 276 277 |
# File 'lib/choctop.rb', line 272 def root() throw "add_root :position => [x,y] option is missing" unless [:position] [:name] ||= File.basename(File.(".")) self.files ||= {} files['.'] = end |
#target_bundle ⇒ Object
64 65 66 |
# File 'lib/choctop.rb', line 64 def target_bundle @target_bundle ||= Dir["#{build_products}/#{name}.*"].first end |
#versionless_pkg_name ⇒ Object
Version-less generated filename for a distribution, from name and .dmg e.g. MyApp.dmg
164 165 166 |
# File 'lib/choctop.rb', line 164 def versionless_pkg_name "#{name}.dmg" end |
#volume_path ⇒ Object
Path to Volume when DMG is mounted
184 185 186 |
# File 'lib/choctop.rb', line 184 def volume_path "#{mountpoint}/#{name}" end |