choctop 0.10.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. data/History.txt +12 -0
  2. data/Manifest.txt +0 -57
  3. data/README.rdoc +6 -0
  4. data/Rakefile +18 -22
  5. data/features/development.feature +1 -1
  6. data/features/dmg.feature +8 -0
  7. data/features/rake_tasks.feature +1 -0
  8. data/features/step_definitions/common_steps.rb +0 -9
  9. data/features/step_definitions/dmg_steps.rb +2 -6
  10. data/features/step_definitions/generator_steps.rb +13 -2
  11. data/features/step_definitions/remote_steps.rb +5 -5
  12. data/features/support/env.rb +10 -3
  13. data/lib/choctop.rb +41 -12
  14. data/lib/choctop/appcast.rb +17 -4
  15. data/lib/choctop/dmg.rb +38 -6
  16. data/spec/choctop_spec.rb +30 -2
  17. metadata +16 -95
  18. data/features/fixtures/App With Whitespace/App With Whitespace.xcodeproj/TemplateIcon.icns +0 -0
  19. data/features/fixtures/App With Whitespace/App With Whitespace.xcodeproj/drnic.mode1v3 +0 -1360
  20. data/features/fixtures/App With Whitespace/App With Whitespace.xcodeproj/drnic.pbxuser +0 -108
  21. data/features/fixtures/App With Whitespace/App With Whitespace.xcodeproj/project.pbxproj +0 -276
  22. data/features/fixtures/App With Whitespace/App With Whitespace_Prefix.pch +0 -7
  23. data/features/fixtures/App With Whitespace/English.lproj/InfoPlist.strings +0 -0
  24. data/features/fixtures/App With Whitespace/English.lproj/MainMenu.xib +0 -3034
  25. data/features/fixtures/App With Whitespace/Info.plist +0 -30
  26. data/features/fixtures/App With Whitespace/build/App With Whitespace.build/App With Whitespace.pbxindex/categories.pbxbtree +0 -0
  27. data/features/fixtures/App With Whitespace/build/App With Whitespace.build/App With Whitespace.pbxindex/cdecls.pbxbtree +0 -0
  28. data/features/fixtures/App With Whitespace/build/App With Whitespace.build/App With Whitespace.pbxindex/decls.pbxbtree +0 -0
  29. data/features/fixtures/App With Whitespace/build/App With Whitespace.build/App With Whitespace.pbxindex/files.pbxbtree +0 -0
  30. data/features/fixtures/App With Whitespace/build/App With Whitespace.build/App With Whitespace.pbxindex/imports.pbxbtree +0 -0
  31. data/features/fixtures/App With Whitespace/build/App With Whitespace.build/App With Whitespace.pbxindex/pbxindex.header +0 -0
  32. data/features/fixtures/App With Whitespace/build/App With Whitespace.build/App With Whitespace.pbxindex/protocols.pbxbtree +0 -0
  33. data/features/fixtures/App With Whitespace/build/App With Whitespace.build/App With Whitespace.pbxindex/refs.pbxbtree +0 -0
  34. data/features/fixtures/App With Whitespace/build/App With Whitespace.build/App With Whitespace.pbxindex/strings.pbxstrings/control +0 -0
  35. data/features/fixtures/App With Whitespace/build/App With Whitespace.build/App With Whitespace.pbxindex/strings.pbxstrings/strings +0 -0
  36. data/features/fixtures/App With Whitespace/build/App With Whitespace.build/App With Whitespace.pbxindex/subclasses.pbxbtree +0 -0
  37. data/features/fixtures/App With Whitespace/build/App With Whitespace.build/App With Whitespace.pbxindex/symbols0.pbxsymbols +0 -0
  38. data/features/fixtures/App With Whitespace/main.m +0 -14
  39. data/features/fixtures/SampleApp/English.lproj/InfoPlist.strings +0 -0
  40. data/features/fixtures/SampleApp/English.lproj/MainMenu.xib +0 -3034
  41. data/features/fixtures/SampleApp/Info.plist +0 -30
  42. data/features/fixtures/SampleApp/README.txt +0 -1
  43. data/features/fixtures/SampleApp/SampleApp.xcodeproj/TemplateIcon.icns +0 -0
  44. data/features/fixtures/SampleApp/SampleApp.xcodeproj/project.pbxproj +0 -284
  45. data/features/fixtures/SampleApp/SampleApp_Prefix.pch +0 -7
  46. data/features/fixtures/SampleApp/build/Release/README.txt +0 -1
  47. data/features/fixtures/SampleApp/build/Release/dmg/README.txt +0 -1
  48. data/features/fixtures/SampleApp/main.m +0 -14
  49. data/website/_layouts/default.html +0 -41
  50. data/website/_layouts/post.html +0 -86
  51. data/website/_posts/2009-02-02-first-post.markdown +0 -6
  52. data/website/_site/2009/02/02/first-post.html +0 -86
  53. data/website/_site/atom.xml +0 -24
  54. data/website/_site/config.yml +0 -6
  55. data/website/_site/css/stylesheet.css +0 -135
  56. data/website/_site/images/logo.gif +0 -0
  57. data/website/_site/images/logo.jpg +0 -0
  58. data/website/_site/images/logo.png +0 -0
  59. data/website/_site/images/love-16.gif +0 -0
  60. data/website/_site/images/love.gif +0 -0
  61. data/website/_site/images/mocra-keynote-bg.jpg +0 -0
  62. data/website/_site/images/title slide.jpg +0 -0
  63. data/website/_site/images/title-slide.png +0 -0
  64. data/website/_site/index.html +0 -85
  65. data/website/atom.xml +0 -27
  66. data/website/config.yml +0 -6
  67. data/website/css/stylesheet.css +0 -135
  68. data/website/images/logo.gif +0 -0
  69. data/website/images/logo.png +0 -0
  70. data/website/images/love-16.gif +0 -0
  71. data/website/images/love.gif +0 -0
  72. data/website/images/mocra-keynote-bg.jpg +0 -0
  73. data/website/images/title-slide.png +0 -0
  74. data/website/index.markdown +0 -63
data/History.txt CHANGED
@@ -1,3 +1,15 @@
1
+
2
+ * ChocTop no longer solely for Cocoa applications
3
+ * Applications shortcut only included if the primary target is a .app bundle
4
+ * Creates a non-versioned symlink to latest released DMG
5
+ * Files to be included can be specified by relative path, method helper (as a symbol) or a proc that returns a string path.
6
+ Examples:
7
+ file 'build/Release/SampleApp.app', :position => [50, 100]
8
+ file :target_bundle, :position => [50, 100]
9
+ file proc { 'README.txt' }, :position => [50, 100]
10
+ file :position => [50, 100] { 'README.txt' }
11
+
12
+
1
13
  == 0.10.0 2009-06-11
2
14
 
3
15
  * Extra files supported: +add_file 'project/path/to/file_or_folder_or_bundle', :position => [x, y]+
data/Manifest.txt CHANGED
@@ -14,37 +14,6 @@ assets/wood.jpg
14
14
  bin/install_choctop
15
15
  features/development.feature
16
16
  features/dmg.feature
17
- features/fixtures/App With Whitespace/App With Whitespace.xcodeproj/TemplateIcon.icns
18
- features/fixtures/App With Whitespace/App With Whitespace.xcodeproj/drnic.mode1v3
19
- features/fixtures/App With Whitespace/App With Whitespace.xcodeproj/drnic.pbxuser
20
- features/fixtures/App With Whitespace/App With Whitespace.xcodeproj/project.pbxproj
21
- features/fixtures/App With Whitespace/App With Whitespace_Prefix.pch
22
- features/fixtures/App With Whitespace/English.lproj/InfoPlist.strings
23
- features/fixtures/App With Whitespace/English.lproj/MainMenu.xib
24
- features/fixtures/App With Whitespace/Info.plist
25
- features/fixtures/App With Whitespace/build/App With Whitespace.build/App With Whitespace.pbxindex/categories.pbxbtree
26
- features/fixtures/App With Whitespace/build/App With Whitespace.build/App With Whitespace.pbxindex/cdecls.pbxbtree
27
- features/fixtures/App With Whitespace/build/App With Whitespace.build/App With Whitespace.pbxindex/decls.pbxbtree
28
- features/fixtures/App With Whitespace/build/App With Whitespace.build/App With Whitespace.pbxindex/files.pbxbtree
29
- features/fixtures/App With Whitespace/build/App With Whitespace.build/App With Whitespace.pbxindex/imports.pbxbtree
30
- features/fixtures/App With Whitespace/build/App With Whitespace.build/App With Whitespace.pbxindex/pbxindex.header
31
- features/fixtures/App With Whitespace/build/App With Whitespace.build/App With Whitespace.pbxindex/protocols.pbxbtree
32
- features/fixtures/App With Whitespace/build/App With Whitespace.build/App With Whitespace.pbxindex/refs.pbxbtree
33
- features/fixtures/App With Whitespace/build/App With Whitespace.build/App With Whitespace.pbxindex/strings.pbxstrings/control
34
- features/fixtures/App With Whitespace/build/App With Whitespace.build/App With Whitespace.pbxindex/strings.pbxstrings/strings
35
- features/fixtures/App With Whitespace/build/App With Whitespace.build/App With Whitespace.pbxindex/subclasses.pbxbtree
36
- features/fixtures/App With Whitespace/build/App With Whitespace.build/App With Whitespace.pbxindex/symbols0.pbxsymbols
37
- features/fixtures/App With Whitespace/main.m
38
- features/fixtures/SampleApp/English.lproj/InfoPlist.strings
39
- features/fixtures/SampleApp/English.lproj/MainMenu.xib
40
- features/fixtures/SampleApp/Info.plist
41
- features/fixtures/SampleApp/README.txt
42
- features/fixtures/SampleApp/SampleApp.xcodeproj/TemplateIcon.icns
43
- features/fixtures/SampleApp/SampleApp.xcodeproj/project.pbxproj
44
- features/fixtures/SampleApp/SampleApp_Prefix.pch
45
- features/fixtures/SampleApp/build/Release/README.txt
46
- features/fixtures/SampleApp/build/Release/dmg/README.txt
47
- features/fixtures/SampleApp/main.m
48
17
  features/fixtures/custom_assets/appicon.icns
49
18
  features/initial_generator.feature
50
19
  features/rake_tasks.feature
@@ -68,29 +37,3 @@ spec/choctop_spec.rb
68
37
  spec/spec.opts
69
38
  spec/spec_helper.rb
70
39
  tasks/rspec.rake
71
- website/_layouts/default.html
72
- website/_layouts/post.html
73
- website/_posts/2009-02-02-first-post.markdown
74
- website/_site/2009/02/02/first-post.html
75
- website/_site/atom.xml
76
- website/_site/config.yml
77
- website/_site/css/stylesheet.css
78
- website/_site/images/logo.gif
79
- website/_site/images/logo.jpg
80
- website/_site/images/logo.png
81
- website/_site/images/love-16.gif
82
- website/_site/images/love.gif
83
- website/_site/images/mocra-keynote-bg.jpg
84
- website/_site/images/title slide.jpg
85
- website/_site/images/title-slide.png
86
- website/_site/index.html
87
- website/atom.xml
88
- website/config.yml
89
- website/css/stylesheet.css
90
- website/images/logo.gif
91
- website/images/logo.png
92
- website/images/love-16.gif
93
- website/images/love.gif
94
- website/images/mocra-keynote-bg.jpg
95
- website/images/title-slide.png
96
- website/index.markdown
data/README.rdoc CHANGED
@@ -4,6 +4,9 @@
4
4
 
5
5
  == DESCRIPTION:
6
6
 
7
+ Build and deploy tools for Cocoa apps using Sparkle for distributions and upgrades;
8
+ it’s like Hoe but for Cocoa apps.
9
+
7
10
  Package up your OS X/Cocoa applications into Custom DMGs, generate Sparkle XML, and
8
11
  upload. Instead of hours, its only 30 seconds to release each new version of an application.
9
12
 
@@ -67,6 +70,9 @@ to the end:
67
70
 
68
71
  # Extra files
69
72
  s.add_file 'path/to/README.txt', :position => [250, 90]
73
+ s.file :target_bundle, :position => [50, 100]
74
+ s.file proc { 'README.txt' }, :position => [50, 100]
75
+ s.file :position => [50, 100] { 'README.txt' }
70
76
 
71
77
  # Custom DMG options
72
78
  s.volume_icon = "dmg.icns"
data/Rakefile CHANGED
@@ -1,29 +1,25 @@
1
- %w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f }
2
- require File.dirname(__FILE__) + '/lib/choctop'
1
+ gem 'hoe', '>= 2.3.2'
2
+ require 'hoe'
3
+ gem 'newgem', '>= 1.5.0'
4
+ require 'newgem'
5
+ require './lib/choctop'
3
6
 
4
- # Generate all the Rake tasks
5
- # Run 'rake -T' to see list of generated tasks (from gem root directory)
6
- $hoe = Hoe.new('choctop', ChocTop::VERSION) do |p|
7
- p.developer('Dr Nic Williams', 'drnicwilliams@gmail.com')
8
- p.developer('Chris Bailey', 'chris@cobaltedge.com')
9
- p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
10
- p.extra_deps = [
11
- ['activesupport'],
12
- ['builder','>= 2.1.2'],
13
- ['RedCloth', '>=4.1.1']
14
- ]
15
- p.extra_dev_deps = [
16
- ['newgem', ">= #{::Newgem::VERSION}"]
17
- ]
18
-
19
- p.clean_globs |= %w[**/.DS_Store tmp *.log]
20
- path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
21
- p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
22
- p.rsync_args = '-av --delete --ignore-errors'
7
+ Hoe.plugin :newgem
8
+
9
+ $hoe = Hoe.spec 'choctop' do
10
+ developer 'Dr Nic Williams', 'drnicwilliams@gmail.com'
11
+ developer 'Chris Bailey', 'chris@cobaltedge.com'
12
+
13
+ extra_deps << ['activesupport']
14
+ extra_deps << ['builder','>= 2.1.2']
15
+ extra_dev_deps << ['newgem', ">= #{::Newgem::VERSION}"]
16
+ end
17
+
18
+ task :release do
19
+ sh "gem push pkg/#{$hoe.name}-#{$hoe.version}.gem"
23
20
  end
24
21
 
25
22
  require 'newgem/tasks' # load /tasks/*.rake
26
23
  Dir['tasks/**/*.rake'].each { |t| load t }
27
24
 
28
- # TODO - want other tests/tasks run by default? Add them to the list
29
25
  task :default => [:features]
@@ -10,4 +10,4 @@ Feature: Development processes of newgem itself (rake tasks)
10
10
  When I invoke task "rake gem"
11
11
  Then folder "pkg" is created
12
12
  And file with name matching "pkg/*.gem" is created else you should run "rake manifest" to fix this
13
- And gem spec key "rdoc_options" contains /--mainREADME.rdoc/
13
+ And gem spec key "rdoc_options" contains /(--mainREADME.rdoc|\[\"--main\", \"README.rdoc\"\])/
data/features/dmg.feature CHANGED
@@ -43,3 +43,11 @@ Feature: Can build a customised DMG image from application build
43
43
  And dmg "appcast/build/SampleApp-0.1.0.dmg" is mounted as "SampleApp"
44
44
  And file "README.txt" in mounted volume is created
45
45
  And file "SampleApp.app.dSYM" in mounted volume is not created
46
+
47
+ Scenario: Build a DMG for non-Xcode project
48
+ Given a non-Xcode chcotop project "MyProject" with files: README.txt, SomeBundle.thingy
49
+ When I invoke task "rake dmg"
50
+ And dmg "appcast/build/MyProject.dmg" is mounted as "MyProject"
51
+ And file "README.txt" in mounted volume is created
52
+ And file "SomeBundle.thingy" in mounted volume is created
53
+ And file "Applications" in mounted volume is not created
@@ -20,6 +20,7 @@ Feature: Rake tasks are available to build and deploy Cocoa apps with Sparkle
20
20
  When I invoke task "rake upload"
21
21
  Then remote file "my_feed.xml" is created
22
22
  Then remote file "SampleApp-0.1.0.dmg" is created
23
+ Then remote file "SampleApp.dmg" is created
23
24
  Then remote file "index.php" is created
24
25
 
25
26
  Scenario: change the version number in the Info.plist
@@ -1,13 +1,4 @@
1
- Given /^a safe folder/ do
2
- FileUtils.rm_rf @tmp_root = File.dirname(__FILE__) + "/../../tmp"
3
- FileUtils.mkdir_p @tmp_root
4
- FileUtils.mkdir_p @home_path = File.expand_path(File.join(@tmp_root, "home"))
5
- @lib_path = File.expand_path(File.dirname(__FILE__) + '/../../lib')
6
- Given %Q{env variable $HOME set to "#{@home_path}"}
7
- end
8
-
9
1
  Given /^this project is active project folder/ do
10
- Given "a safe folder"
11
2
  @active_project_folder = File.expand_path(File.dirname(__FILE__) + "/../..")
12
3
  end
13
4
 
@@ -2,18 +2,14 @@ Given /is configured for custom Applications icon$/ do
2
2
  appicon = File.expand_path(File.dirname(__FILE__) + "/../fixtures/custom_assets/appicon.icns")
3
3
  in_project_folder do
4
4
  append_to_file "Rakefile", <<-RUBY.gsub(/^ /, '')
5
- $sparkle.applications_icon = "appicon.icns"
5
+ $choctop.applications_icon = "appicon.icns"
6
6
  RUBY
7
7
  FileUtils.cp(appicon, "appicon.icns")
8
8
  end
9
9
  end
10
10
 
11
11
  Given /^is configured for an asset file "([^\"]*)" to be included in dmg$/ do |file|
12
- in_project_folder do
13
- append_to_file "Rakefile", <<-RUBY.gsub(/^ /, '')
14
- $sparkle.add_file "#{file}", :position=> [347, 65]
15
- RUBY
16
- end
12
+ choctop_add_file(file)
17
13
  end
18
14
 
19
15
  When /^dmg "(.*)" is mounted as "(.*)"$/ do |dmg, name|
@@ -1,5 +1,4 @@
1
1
  Given /^a Cocoa app that does not have an existing Rakefile$/ do
2
- Given "a safe folder"
3
2
  setup_active_project_folder "SampleApp"
4
3
  end
5
4
 
@@ -25,7 +24,6 @@ Given /Rakefile constants rewired for local rsync/ do
25
24
  end
26
25
 
27
26
  Given /^a Cocoa app with choctop installed called "(.*)"$/ do |name|
28
- Given "a safe folder"
29
27
  @remote_folder = File.expand_path(File.join(@tmp_root, 'website'))
30
28
  FileUtils.rm_rf @remote_folder
31
29
  FileUtils.mkdir_p @remote_folder
@@ -38,3 +36,16 @@ Given /^a Cocoa app with choctop installed called "(.*)"$/ do |name|
38
36
  Given "Rakefile constants rewired for local rsync"
39
37
  ENV['NO_FINDER'] = 'YES' # disable Finder during tests
40
38
  end
39
+
40
+ Given /^a non\-Xcode chcotop project "([^\"]*)" with files: (.*)$/ do |name, files|
41
+ files = files.strip.split(/\s*,\s*/)
42
+ setup_active_project_folder name
43
+ Given %Q{I run local executable "install_choctop" with arguments "."}
44
+ Given "Rakefile wired to use development code instead of installed RubyGem"
45
+ Given "Rakefile constants rewired for local rsync"
46
+ ENV['NO_FINDER'] = 'YES' # disable Finder during tests
47
+ in_project_folder do
48
+ files.each { |file| `touch #{file}` }
49
+ end
50
+ files.each { |file| choctop_add_file(file) }
51
+ end
@@ -13,8 +13,8 @@ end
13
13
  Given /^ChocTop config is configured for local rsync$/ do
14
14
  in_project_folder do
15
15
  append_to_file "Rakefile", <<-RUBY.gsub(/^ /, '')
16
- $sparkle.host = ""
17
- $sparkle.remote_dir = #{@remote_folder.inspect}
16
+ $choctop.host = ""
17
+ $choctop.remote_dir = #{@remote_folder.inspect}
18
18
  RUBY
19
19
  end
20
20
  end
@@ -22,9 +22,9 @@ end
22
22
  Given /^ChocTop config is configured for remote Sparkle$/ do
23
23
  in_project_folder do
24
24
  append_to_file "Rakefile", <<-RUBY.gsub(/^ /, '')
25
- $sparkle.host = "mocra.com"
26
- $sparkle.base_url = "http://mocra.com/sample_app"
27
- $sparkle.remote_dir = "/opt/apps/mocra/downloads/sample_app"
25
+ $choctop.host = "mocra.com"
26
+ $choctop.base_url = "http://mocra.com/sample_app"
27
+ $choctop.remote_dir = "/opt/apps/mocra/downloads/sample_app"
28
28
  RUBY
29
29
  end
30
30
  end
@@ -1,9 +1,16 @@
1
1
  require File.dirname(__FILE__) + "/../../lib/choctop"
2
2
 
3
3
  require "rubygems"
4
- gem 'cucumber'
5
4
  require 'cucumber'
6
- gem 'rspec'
7
5
  require 'spec'
8
6
 
9
- require "activesupport"
7
+ require "activesupport"
8
+
9
+ Before do
10
+ @tmp_root = File.dirname(__FILE__) + "/../../tmp"
11
+ @home_path = File.expand_path(File.join(@tmp_root, "home"))
12
+ FileUtils.rm_rf @tmp_root
13
+ FileUtils.mkdir_p @home_path
14
+ ENV['HOME'] = @home_path
15
+ @lib_path = File.expand_path(File.dirname(__FILE__) + '/../../lib')
16
+ end
data/lib/choctop.rb CHANGED
@@ -11,7 +11,7 @@ require "active_support"
11
11
  require "RedCloth"
12
12
 
13
13
  class ChocTop
14
- VERSION = '0.10.0'
14
+ VERSION = '0.11.0'
15
15
 
16
16
  # Path to the Info.plist
17
17
  # Default: "Info.plist"
@@ -28,6 +28,13 @@ class ChocTop
28
28
  # The target name of the distributed DMG file
29
29
  # Default: #{name}.app
30
30
  attr_accessor :target
31
+ def target
32
+ @target ||= File.basename(target_bundle) if target_bundle
33
+ end
34
+
35
+ def target_bundle
36
+ @target_bundle ||= Dir["build/#{build_type}/#{name}.*"].first
37
+ end
31
38
 
32
39
  # The build type of the distributed DMG file
33
40
  # Default: Release
@@ -39,7 +46,11 @@ class ChocTop
39
46
 
40
47
  # The host name, e.g. some-domain.com
41
48
  # Default: host from base_url
42
- attr_accessor :host
49
+ attr_accessor :host
50
+
51
+ # The user to log in on the remote server.
52
+ # Default: empty
53
+ attr_accessor :user
43
54
 
44
55
  # The url from where the xml + dmg files will be downloaded
45
56
  # Default: dir path from appcast_filename
@@ -49,6 +60,10 @@ class ChocTop
49
60
  # Default: release_notes.html
50
61
  attr_accessor :release_notes
51
62
 
63
+ # The file name for the project readme file
64
+ # Default: README.txt
65
+ attr_accessor :readme
66
+
52
67
  # List of files/bundles to be packaged into the DMG
53
68
  attr_accessor :files
54
69
 
@@ -84,7 +99,13 @@ class ChocTop
84
99
  # Generated filename for a distribution, from name, version and .dmg
85
100
  # e.g. MyApp-1.0.0.dmg
86
101
  def pkg_name
87
- "#{name}-#{version}.dmg"
102
+ version ? "#{name}-#{version}.dmg" : versionless_pkg_name
103
+ end
104
+
105
+ # Version-less generated filename for a distribution, from name and .dmg
106
+ # e.g. MyApp.dmg
107
+ def versionless_pkg_name
108
+ "#{name}.dmg"
88
109
  end
89
110
 
90
111
  # Path to generated package DMG
@@ -161,25 +182,31 @@ class ChocTop
161
182
  end
162
183
 
163
184
  # Add an explicit file/bundle/folder into the DMG
185
+ # Examples:
186
+ # file 'build/Release/SampleApp.app', :position => [50, 100]
187
+ # file :target_bundle, :position => [50, 100]
188
+ # file proc { 'README.txt' }, :position => [50, 100]
189
+ # file :position => [50, 100] { 'README.txt' }
164
190
  # Required option:
165
191
  # +:position+ - two item array [x, y] window position
166
- def add_file(path, options)
167
- throw "add_files #{path}, :position => [x,y] option is missing" unless options[:position]
192
+ def file(*args, &block)
193
+ path_or_helper, options = args.first.is_a?(Hash) ? [block, args.first] : [args.first, args.last]
194
+ throw "add_files #{path_or_helper}, :position => [x,y] option is missing" unless options[:position]
168
195
  self.files ||= {}
169
- files[path] = options
196
+ files[path_or_helper] = options
170
197
  end
171
-
198
+ alias_method :add_file, :file
199
+
172
200
  def initialize
173
- $sparkle = self # define a global variable for this object
201
+ $choctop = $sparkle = self # define a global variable for this object ($sparkle is legacy)
174
202
 
175
203
  yield self if block_given?
176
204
 
177
205
  # Defaults
178
206
  @info_plist_path ||= 'Info.plist'
179
- @name ||= info_plist['CFBundleExecutable']
180
- @name = File.basename(File.expand_path(".")) if name.to_s == "${EXECUTABLE_NAME}"
207
+ @name ||= info_plist['CFBundleExecutable'] || File.basename(File.expand_path("."))
208
+ @name = File.basename(File.expand_path(".")) if @name == '${EXECUTABLE_NAME}'
181
209
  @version ||= info_plist['CFBundleVersion']
182
- @target ||= "#{name}.app"
183
210
  @build_type = ENV['BUILD_TYPE'] || 'Release'
184
211
 
185
212
  if @su_feed_url = info_plist['SUFeedURL']
@@ -190,6 +217,7 @@ class ChocTop
190
217
  @host ||= URI.parse(base_url).host
191
218
  end
192
219
  @release_notes ||= 'release_notes.html'
220
+ @readme ||= 'README.txt'
193
221
  @release_notes_template ||= "release_notes_template.html.erb"
194
222
  @rsync_args ||= '-aCv --progress'
195
223
 
@@ -200,7 +228,7 @@ class ChocTop
200
228
  @icon_size ||= 104
201
229
  @icon_text_size ||= 12
202
230
 
203
- add_file "build/#{build_type}/#{target}", :position => app_icon_position
231
+ add_file :target_bundle, :position => app_icon_position
204
232
 
205
233
  define_tasks
206
234
  end
@@ -227,6 +255,7 @@ class ChocTop
227
255
  desc "Create/update the appcast file"
228
256
  task :feed do
229
257
  make_appcast
258
+ make_dmg_symlink
230
259
  make_index_redirect
231
260
  make_release_notes
232
261
  end
@@ -1,6 +1,6 @@
1
1
  module ChocTop::Appcast
2
2
  def make_build
3
- if ENV['NO_BUILD']
3
+ if skip_build
4
4
  puts "Skipping build task..."
5
5
  else
6
6
  sh "xcodebuild -configuration #{build_type}"
@@ -9,8 +9,7 @@ module ChocTop::Appcast
9
9
 
10
10
  def make_appcast
11
11
  app_name = File.basename(File.expand_path('.'))
12
-
13
- FileUtils.mkdir_p "#{build_path}"
12
+ FileUtils.mkdir_p(build_path)
14
13
  appcast = File.open("#{build_path}/#{appcast_filename}", 'w') do |f|
15
14
  xml = Builder::XmlMarkup.new(:indent => 2)
16
15
  xml.instruct!
@@ -44,12 +43,25 @@ module ChocTop::Appcast
44
43
  end
45
44
  end
46
45
 
46
+ def make_dmg_symlink
47
+ FileUtils.chdir(build_path) do
48
+ `ln -s #{pkg_name} #{versionless_pkg_name}`
49
+ end
50
+ end
51
+
47
52
  def make_index_redirect
48
53
  File.open("#{build_path}/index.php", 'w') do |f|
49
54
  f << %Q{<?php header("Location: #{pkg_relative_url}"); ?>}
50
55
  end
51
56
  end
52
57
 
58
+ def skip_build
59
+ return true if ENV['NO_BUILD']
60
+ return false if File.exists?('Info.plist')
61
+ return false if Dir['*.xcodeproj'].size > 0
62
+ true
63
+ end
64
+
53
65
  def make_release_notes
54
66
  File.open("#{build_path}/#{release_notes}", "w") do |f|
55
67
  template = File.read(release_notes_template)
@@ -75,7 +87,8 @@ module ChocTop::Appcast
75
87
 
76
88
  def upload_appcast
77
89
  _host = host.blank? ? "" : "#{host}:"
78
- sh %{rsync #{rsync_args} #{build_path}/ #{_host}#{remote_dir}}
90
+ _user = user.blank? ? "" : "#{user}@"
91
+ sh %{rsync #{rsync_args} #{build_path}/ #{_user}#{_host}#{remote_dir}}
79
92
  end
80
93
 
81
94
  # Returns a file path to the dsa_priv.pem file