choctop 0.13.1 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/History.txt CHANGED
@@ -1,3 +1,9 @@
1
+ == 0.14.0 2010-07-30
2
+
3
+ * install_choctop: added --tmbundle/--textmate flag
4
+ * Added s.defaults/s.project_type to allow alternate default backgrounds; e.g. for all TextMate bundles
5
+ * Don't mention CocoaApp in usage; choctop can do more now
6
+
1
7
  == 0.13.1 2010-07-07
2
8
 
3
9
  * Can add URL .webloc files into DMG via #add_link/#link helper
data/Manifest.txt CHANGED
@@ -8,12 +8,18 @@ Manifest.txt
8
8
  README.rdoc
9
9
  Rakefile
10
10
  app_generators/install_choctop/install_choctop_generator.rb
11
+ app_generators/install_choctop/templates/README.normal
12
+ app_generators/install_choctop/templates/README.textmate
11
13
  app_generators/install_choctop/templates/Rakefile.erb
14
+ app_generators/install_choctop/templates/Rakefile.textmate.erb
12
15
  app_generators/install_choctop/templates/release_notes.txt.erb
13
16
  app_generators/install_choctop/templates/release_notes_template.html.erb
14
- assets/DefaultVolumeIcon.icns
17
+ assets/default_background.jpg
18
+ assets/default_volume.icns
15
19
  assets/sky.jpg
16
20
  assets/sky_background.jpg
21
+ assets/textmate_background.jpg
22
+ assets/textmate_volume.icns
17
23
  assets/vanillia_dmg_icon.png
18
24
  assets/wood.jpg
19
25
  bin/install_choctop
@@ -1,7 +1,5 @@
1
1
  class InstallChoctopGenerator < RubiGen::Base
2
- attr_reader :name, :module_name, :urlname, :version
3
-
4
- default_options :version => "0.1.0"
2
+ attr_reader :name, :module_name, :urlname, :version, :github_user
5
3
 
6
4
  def initialize(runtime_args, runtime_options = {})
7
5
  super
@@ -17,20 +15,27 @@ class InstallChoctopGenerator < RubiGen::Base
17
15
  record do |m|
18
16
  %w( appcast/build ).each { |path| m.directory path }
19
17
 
20
- m.template "Rakefile.erb", "Rakefile"
21
- m.template "release_notes.txt.erb", "release_notes.txt"
22
- m.file "release_notes_template.html.erb", "release_notes_template.html.erb"
18
+ case options[:project_type]
19
+ when :textmate
20
+ m.template "Rakefile.textmate.erb", "Rakefile"
21
+ m.readme "README.textmate"
22
+ else
23
+ m.template "Rakefile.erb", "Rakefile"
24
+ m.template "release_notes.txt.erb", "release_notes.txt"
25
+ m.file "release_notes_template.html.erb", "release_notes_template.html.erb"
26
+ m.readme "README.normal"
27
+ end
23
28
  end
24
29
  end
25
30
 
26
31
  protected
27
32
  def banner
28
33
  <<-EOS
29
- Installs choctop into your Cocoa application. This gives you
30
- rake tasks to build and deploy your Cocoa app's latest version for
31
- Sparkle appcast mechanism.
34
+ Installs choctop into your project/Cocoa application. This gives you
35
+ rake tasks to build and deploy your project's latest version into a DMG
36
+ and for release via Sparkle appcast mechanism.
32
37
 
33
- USAGE: #{spec.name} path/to/CocoaApp
38
+ USAGE: #{spec.name} path/to/project
34
39
  EOS
35
40
  end
36
41
 
@@ -38,12 +43,23 @@ EOS
38
43
  opts.separator ''
39
44
  opts.separator 'Options:'
40
45
  opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
46
+ opts.on("--textmate", "--tmbundle",
47
+ "Target project is a TextMate bundle",
48
+ "Default: false") { |o| options[:project_type] = :textmate }
41
49
  opts.on("-V", "--initial-version",
42
- "Show the #{File.basename($0)} version number and quit.",
50
+ "Set initial version number.",
43
51
  "Default: 0.1.0") { |o| options[:version] = o }
44
52
  end
45
53
 
46
54
  def extract_options
47
- @version = options[:version]
55
+ @version = options[:version]
56
+ @github_user = options[:github_user]
57
+ end
58
+
59
+ def self.default_github_user
60
+ `git config github.user || whoami`.strip
48
61
  end
49
- end
62
+
63
+ default_options :version => "0.1.0", :github_user => default_github_user
64
+
65
+ end
@@ -0,0 +1,5 @@
1
+ You use choctop with the following rake tasks:
2
+ rake appcast # Create dmg, update appcast file, and upload to host
3
+ rake build # Create/update the appcast file
4
+ rake dmg # Create the dmg file for appcasting
5
+ rake upload # Upload the dmg and appcast files to the host
@@ -0,0 +1,3 @@
1
+ You use choctop with the following rake tasks:
2
+ rake dmg # Create the dmg file for appcasting
3
+ rake upload # Upload the dmg file to the host
@@ -0,0 +1,15 @@
1
+ require "rubygems"
2
+ require "rake"
3
+
4
+ require "choctop"
5
+
6
+ ChocTop::Configuration.new do |s|
7
+ s.name = '<%= name %>'
8
+
9
+ s.add_root :position => [90, 70], :exclude => %w[build .bundle .git]
10
+ # s.add_link 'http://github.com/<%= github_user %>/<%= name %>', 'GitHub', :position => [220, 70]
11
+
12
+ s.defaults :textmate
13
+ # s.background_file = 'Support/dmg/dmg_background.png'
14
+ # s.volume_icon = 'Support/dmg/dmg_volume_icon.icns'
15
+ end
Binary file
Binary file
Binary file
data/bin/install_choctop CHANGED
@@ -15,10 +15,3 @@ source = RubiGen::PathSource.new(:application,
15
15
  RubiGen::Base.reset_sources
16
16
  RubiGen::Base.append_sources source
17
17
  RubiGen::Scripts::Generate.new.run(ARGV, :generator => 'install_choctop')
18
- puts <<-EOS
19
- You use choctop with the following rake tasks:
20
- rake appcast # Create dmg, update appcast file, and upload to host
21
- rake build # Create/update the appcast file
22
- rake dmg # Create the dmg file for appcasting
23
- rake upload # Upload the appcast file to the host
24
- EOS
@@ -14,11 +14,22 @@ Feature: Setup a Cocoa app with choctop
14
14
  Scenario: Run "install_choctop" without arguments shows an error
15
15
  Given a Cocoa app that does not have an existing Rakefile
16
16
  When I run local executable "install_choctop" with arguments ""
17
- Then I should see /USAGE: install_choctop path/to/CocoaApp/
17
+ Then I should see /USAGE: install_choctop path/to/project/
18
18
 
19
19
  Scenario: Install choctop and generate a release_notes file
20
20
  Given a Cocoa app that does not have an existing Rakefile
21
21
  When I run local executable "install_choctop" with arguments "."
22
22
  Then file "release_notes.txt" is created
23
23
  And file "release_notes.txt" contents does match /Initial release/
24
-
24
+
25
+ Scenario: Install into a tmbundle
26
+ Given a TextMate bundle project "MyBundle"
27
+ When I run local executable "install_choctop" with arguments ". --textmate"
28
+ Then file "Rakefile" is created
29
+ Then file "release_notes.txt" is not created
30
+ When I invoke task "rake dmg"
31
+ And dmg "appcast/build/MyBundle.tmbundle.dmg" is mounted as "MyBundle.tmbundle"
32
+ And file "MyBundle.tmbundle" in mounted volume is created
33
+ And file "Applications" in mounted volume is not created
34
+
35
+
data/lib/choctop.rb CHANGED
@@ -18,7 +18,7 @@ module ChocTop
18
18
  include Dmg
19
19
  include RakeTasks
20
20
 
21
- VERSION = '0.13.1'
21
+ VERSION = '0.14.0'
22
22
 
23
23
  attr_writer :build_opts
24
24
  def build_opts
@@ -297,6 +297,31 @@ module ChocTop
297
297
  files[options[:name]] = options
298
298
  end
299
299
  alias_method :add_link, :link
300
+
301
+ # Specify which background + volume images to use by default
302
+ # Can also add default targets
303
+ # Supports
304
+ # * :normal (default)
305
+ # * :textmate
306
+ def defaults(project_type)
307
+ case @project_type = project_type.to_sym
308
+ when :normal
309
+ @background_file ||= File.dirname(__FILE__) + "/../assets/default_background.jpg"
310
+ @volume_icon ||= File.dirname(__FILE__) + "/../assets/default_volume.icns"
311
+ @app_icon_position ||= [175, 65]
312
+ @applications_icon_position ||= [347, 270]
313
+ @icon_size ||= 104
314
+ @icon_text_size ||= 12
315
+
316
+ add_file :target_bundle, :position => app_icon_position
317
+ when :textmate
318
+ @background_file ||= File.dirname(__FILE__) + "/../assets/textmate_background.jpg"
319
+ @volume_icon ||= File.dirname(__FILE__) + "/../assets/textmate_volume.icns"
320
+ @icon_size ||= 104
321
+ @icon_text_size ||= 12
322
+ end
323
+ end
324
+ alias_method :project_type, :defaults
300
325
 
301
326
  def initialize
302
327
  $choctop = $sparkle = self # define a global variable for this object ($sparkle is legacy)
@@ -317,16 +342,9 @@ module ChocTop
317
342
  @readme ||= 'README.txt'
318
343
  @release_notes_template ||= "release_notes_template.html.erb"
319
344
  @rsync_args ||= '-aCv --progress'
320
-
321
- @background_file ||= File.dirname(__FILE__) + "/../assets/sky_background.jpg"
322
- @app_icon_position ||= [175, 65]
323
- @applications_icon_position ||= [347, 270]
324
- @volume_icon ||= File.dirname(__FILE__) + "/../assets/DefaultVolumeIcon.icns"
325
- @icon_size ||= 104
326
- @icon_text_size ||= 12
327
345
 
328
- add_file :target_bundle, :position => app_icon_position
329
-
346
+ defaults :normal unless @project_type
347
+
330
348
  define_tasks
331
349
  end
332
350
  end
@@ -44,9 +44,11 @@ module ChocTop
44
44
  end
45
45
 
46
46
  def make_dmg_symlink
47
- FileUtils.chdir(build_path) do
48
- `rm '#{versionless_pkg_name}'`
49
- `ln -s '#{pkg_name}' '#{versionless_pkg_name}'`
47
+ if pkg_name != versionless_pkg_name
48
+ FileUtils.chdir(build_path) do
49
+ `rm '#{versionless_pkg_name}'`
50
+ `ln -s '#{pkg_name}' '#{versionless_pkg_name}'`
51
+ end
50
52
  end
51
53
  end
52
54
 
@@ -63,9 +65,11 @@ module ChocTop
63
65
  end
64
66
 
65
67
  def make_release_notes
66
- File.open("#{build_path}/#{release_notes}", "w") do |f|
67
- template = File.read(release_notes_template)
68
- f << ERB.new(template).result(binding)
68
+ if File.exist?(release_notes_template)
69
+ File.open("#{build_path}/#{release_notes}", "w") do |f|
70
+ template = File.read(release_notes_template)
71
+ f << ERB.new(template).result(binding)
72
+ end
69
73
  end
70
74
  end
71
75
 
@@ -40,10 +40,6 @@ module ChocTop
40
40
  detach_dmg
41
41
  end
42
42
 
43
- task :size do
44
- puts configure_dmg_window
45
- end
46
-
47
43
  namespace :version do
48
44
  desc "Display the current version"
49
45
  task :current do
@@ -25,6 +25,11 @@ module ChocTop
25
25
  @minor = $2.to_i
26
26
  @patch = $3.to_i
27
27
  @build = $4
28
+ else
29
+ @major = 0
30
+ @minor = 0
31
+ @patch = 0
32
+ @build = nil
28
33
  end
29
34
  end
30
35
 
data/spec/choctop_spec.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  require File.dirname(__FILE__) + '/spec_helper.rb'
2
2
 
3
3
  describe ChocTop::Configuration do
4
-
5
4
  describe "default" do
6
5
  before(:each) do
7
6
  FileUtils.chdir(File.dirname(__FILE__) + "/../features/fixtures/SampleApp") do
@@ -93,4 +92,48 @@ describe ChocTop::Configuration do
93
92
  @choctop.set_position_of_shortcuts.should_not =~ /applications_folder/
94
93
  end
95
94
  end
95
+
96
+ describe "defaults" do
97
+ before do
98
+ @my_project_path = File.dirname(__FILE__) + "/../tmp/MyProject"
99
+ FileUtils.rm_rf(@my_project_path)
100
+ FileUtils.mkdir_p(@my_project_path)
101
+ end
102
+
103
+ describe ":textmate" do
104
+ before do
105
+ FileUtils.chdir(@my_project_path) do
106
+ @choctop = ChocTop::Configuration.new do |s|
107
+ s.defaults :textmate
108
+ end
109
+ @choctop.prepare_files
110
+ end
111
+ end
112
+
113
+ it "should have textmate background" do
114
+ @choctop.background_file.should =~ /textmate_background.jpg$/
115
+ end
116
+
117
+ it "should have textmate volume icon" do
118
+ @choctop.volume_icon.should =~ /textmate_volume.icns$/
119
+ end
120
+ end
121
+
122
+ describe "normal" do
123
+ before do
124
+ FileUtils.chdir(@my_project_path) do
125
+ @choctop = ChocTop::Configuration.new
126
+ @choctop.prepare_files
127
+ end
128
+ end
129
+
130
+ it "should have default background" do
131
+ @choctop.background_file.should =~ /default_background.jpg$/
132
+ end
133
+
134
+ it "should have default volume icon" do
135
+ @choctop.volume_icon.should =~ /default_volume.icns$/
136
+ end
137
+ end
138
+ end
96
139
  end
data/spec/dmg_spec.rb CHANGED
@@ -10,7 +10,7 @@ describe ChocTop::Dmg do
10
10
  end
11
11
 
12
12
  context "#prepare_files" do
13
- it "should process :target_bundle into a path" do
13
+ it "should process :readme into a path" do
14
14
  FileUtils.chdir(@project_path) do
15
15
  @choctop.file :readme, :position=>[175, 65]
16
16
  @choctop.prepare_files
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: choctop
3
3
  version: !ruby/object:Gem::Version
4
- hash: 41
4
+ hash: 39
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 13
9
- - 1
10
- version: 0.13.1
8
+ - 14
9
+ - 0
10
+ version: 0.14.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Dr Nic Williams
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2010-07-07 00:00:00 +10:00
20
+ date: 2010-07-30 00:00:00 +10:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
@@ -163,12 +163,18 @@ files:
163
163
  - README.rdoc
164
164
  - Rakefile
165
165
  - app_generators/install_choctop/install_choctop_generator.rb
166
+ - app_generators/install_choctop/templates/README.normal
167
+ - app_generators/install_choctop/templates/README.textmate
166
168
  - app_generators/install_choctop/templates/Rakefile.erb
169
+ - app_generators/install_choctop/templates/Rakefile.textmate.erb
167
170
  - app_generators/install_choctop/templates/release_notes.txt.erb
168
171
  - app_generators/install_choctop/templates/release_notes_template.html.erb
169
- - assets/DefaultVolumeIcon.icns
172
+ - assets/default_background.jpg
173
+ - assets/default_volume.icns
170
174
  - assets/sky.jpg
171
175
  - assets/sky_background.jpg
176
+ - assets/textmate_background.jpg
177
+ - assets/textmate_volume.icns
172
178
  - assets/vanillia_dmg_icon.png
173
179
  - assets/wood.jpg
174
180
  - bin/install_choctop