choctop 0.12.1 → 0.13.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.
Files changed (42) hide show
  1. data/.bundle/config +2 -0
  2. data/.bundle/environment.rb +276 -0
  3. data/{spec/spec.opts → .rspec} +0 -0
  4. data/Gemfile +26 -0
  5. data/Gemfile.lock +89 -0
  6. data/History.txt +5 -0
  7. data/Manifest.txt +27 -2
  8. data/README.rdoc +15 -2
  9. data/Rakefile +7 -15
  10. data/choctop.gemspec +71 -0
  11. data/features/dmg.feature +10 -0
  12. data/features/fixtures/App With Whitespace/App With Whitespace.xcodeproj/TemplateIcon.icns +0 -0
  13. data/features/fixtures/App With Whitespace/App With Whitespace.xcodeproj/project.pbxproj +276 -0
  14. data/features/fixtures/App With Whitespace/App With Whitespace_Prefix.pch +7 -0
  15. data/features/fixtures/App With Whitespace/English.lproj/InfoPlist.strings +0 -0
  16. data/features/fixtures/App With Whitespace/English.lproj/MainMenu.xib +3034 -0
  17. data/features/fixtures/App With Whitespace/Info.plist +30 -0
  18. data/features/fixtures/App With Whitespace/main.m +14 -0
  19. data/features/fixtures/MyBundle.tmbundle/Snippets/hello world.tmSnippet +16 -0
  20. data/features/fixtures/MyBundle.tmbundle/info.plist +10 -0
  21. data/features/fixtures/SampleApp/English.lproj/InfoPlist.strings +0 -0
  22. data/features/fixtures/SampleApp/English.lproj/MainMenu.xib +3034 -0
  23. data/features/fixtures/SampleApp/Info.plist +30 -0
  24. data/features/fixtures/SampleApp/README.txt +1 -0
  25. data/features/fixtures/SampleApp/SampleApp.xcodeproj/TemplateIcon.icns +0 -0
  26. data/features/fixtures/SampleApp/SampleApp.xcodeproj/project.pbxproj +284 -0
  27. data/features/fixtures/SampleApp/SampleApp_Prefix.pch +7 -0
  28. data/features/fixtures/SampleApp/main.m +14 -0
  29. data/features/step_definitions/generator_steps.rb +14 -0
  30. data/features/support/dmg_helpers.rb +14 -0
  31. data/features/support/env.rb +3 -5
  32. data/features/support/matchers.rb +7 -9
  33. data/lib/choctop.rb +26 -5
  34. data/lib/choctop/appcast.rb +2 -3
  35. data/lib/choctop/dmg.rb +19 -6
  36. data/lib/choctop/rake_tasks.rb +4 -0
  37. data/spec/dmg_spec.rb +37 -0
  38. data/spec/fixtures/Info.plist +30 -0
  39. data/spec/spec_helper.rb +3 -2
  40. data/spec/version_helper_spec.rb +26 -0
  41. metadata +108 -36
  42. data/tasks/rspec.rake +0 -21
@@ -1,7 +1,7 @@
1
1
  module ChocTop
2
2
  module Appcast
3
3
  def make_build
4
- if skip_build
4
+ if skip_xcode_build
5
5
  puts "Skipping build task..."
6
6
  else
7
7
  sh "xcodebuild -configuration #{build_type} -target #{build_target} #{build_opts}"
@@ -56,9 +56,8 @@ module ChocTop
56
56
  end
57
57
  end
58
58
 
59
- def skip_build
59
+ def skip_xcode_build
60
60
  return true if ENV['NO_BUILD']
61
- return false if File.exists?('Info.plist')
62
61
  return false if Dir['*.xcodeproj'].size > 0
63
62
  true
64
63
  end
@@ -11,17 +11,30 @@ module ChocTop
11
11
  else
12
12
  path_or_helper
13
13
  end
14
- files[path] = options if path && File.exists?(path) && File.basename(path) != '.'
14
+ if path && File.exists?(path)
15
+ files[path] = options
16
+ options[:name] ||= File.basename(path)
17
+ end
15
18
  files
16
19
  end
17
20
  end
18
21
 
22
+ # Two-phase copy: first to a tmp folder (to prevent recursion); then tmp folder to +dmg_src_folder+
19
23
  def copy_files
20
- FileUtils.rm_r(src_folder) if File.exists? src_folder
21
- FileUtils.mkdir_p(src_folder)
24
+ require 'tmpdir'
25
+ tmp_dmg_src_folder = File.join(Dir.tmpdir, Time.now.to_i.to_s) # probably unique folder
26
+ FileUtils.mkdir_p(tmp_dmg_src_folder)
22
27
  files.each do |path, options|
23
- FileUtils.cp_r(path, src_folder)
28
+ target = File.join(tmp_dmg_src_folder, options[:name])
29
+ sh ::Escape.shell_command(['cp', '-r', path, target])
30
+ if options[:exclude]
31
+ exclude_list = options[:exclude].is_a?(Array) ? options[:exclude] : [options[:exclude].to_s]
32
+ exclude_list.each { |exclude| sh ::Escape.shell_command(['rm', '-rf', File.join(target, exclude)]) }
33
+ end
24
34
  end
35
+ FileUtils.rm_r(dmg_src_folder) if File.exists? dmg_src_folder
36
+ FileUtils.mkdir_p(dmg_src_folder)
37
+ Dir["#{tmp_dmg_src_folder}/*"].each { |f| FileUtils.cp_r(f, dmg_src_folder) }
25
38
  end
26
39
 
27
40
  def make_dmg
@@ -30,7 +43,7 @@ module ChocTop
30
43
  FileUtils.mkdir_p build_path
31
44
  FileUtils.mkdir_p mountpoint # TODO can we remove random mountpoints?
32
45
  FileUtils.rm_f(pkg) # make sure destination pkg doesn't already exist, or hdiutil will barf
33
- sh "hdiutil create -format UDRW -quiet -volname '#{name}' -srcfolder '#{src_folder}' '#{pkg}'"
46
+ sh "hdiutil create -format UDRW -quiet -volname '#{name}' -srcfolder '#{dmg_src_folder}' '#{pkg}'"
34
47
  sh "hdiutil attach '#{pkg}' -mountpoint '#{volume_path}' -noautoopen -quiet"
35
48
  sh "bless --folder '#{volume_path}' --openfolder '#{volume_path}'"
36
49
  sh "sleep 1"
@@ -115,7 +128,7 @@ module ChocTop
115
128
  def set_position_of_files
116
129
  files.map do |file_options|
117
130
  path, options = file_options
118
- target = File.basename(path)
131
+ target = options[:name]
119
132
  position = options[:position].join(", ")
120
133
  %Q{set position of item "#{target}" to {#{position}}}
121
134
  end.join("\n")
@@ -9,6 +9,10 @@ module ChocTop
9
9
  task "build/#{build_type}/#{target}/Contents/Info.plist" do
10
10
  make_build
11
11
  end
12
+
13
+ task :clean_build do
14
+ FileUtils.rm_rf(build_path)
15
+ end
12
16
 
13
17
  desc "Create the dmg file for appcasting"
14
18
  task :dmg => :build do
@@ -0,0 +1,37 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ describe ChocTop::Dmg do
4
+ before(:each) do
5
+ @project_path = File.dirname(__FILE__) + "/../features/fixtures/SampleApp"
6
+ FileUtils.chdir(@project_path) do
7
+ @choctop = ChocTop::Configuration.new
8
+ @choctop.files = {}
9
+ end
10
+ end
11
+
12
+ context "#prepare_files" do
13
+ it "should process :target_bundle into a path" do
14
+ FileUtils.chdir(@project_path) do
15
+ @choctop.file :readme, :position=>[175, 65]
16
+ @choctop.prepare_files
17
+ @choctop.files['README.txt'].should == {:position=>[175, 65]}
18
+ end
19
+ end
20
+
21
+ it "should process procs into a path" do
22
+ FileUtils.chdir(@project_path) do
23
+ @choctop.file proc { 'README.txt' }, :position=>[175, 65]
24
+ @choctop.prepare_files
25
+ @choctop.files['README.txt'].should == {:position=>[175, 65]}
26
+ end
27
+ end
28
+
29
+ it "should process blocks into a path" do
30
+ FileUtils.chdir(@project_path) do
31
+ @choctop.file(:position => [175, 65]) { 'README.txt' }
32
+ @choctop.prepare_files
33
+ @choctop.files['README.txt'].should == {:position=>[175, 65]}
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,30 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>CFBundleDevelopmentRegion</key>
6
+ <string>English</string>
7
+ <key>CFBundleExecutable</key>
8
+ <string>SampleApp</string>
9
+ <key>CFBundleIconFile</key>
10
+ <string></string>
11
+ <key>CFBundleIdentifier</key>
12
+ <string>com.yourcompany.${PRODUCT_NAME:identifier}</string>
13
+ <key>CFBundleInfoDictionaryVersion</key>
14
+ <string>6.0</string>
15
+ <key>CFBundleName</key>
16
+ <string>${PRODUCT_NAME}</string>
17
+ <key>CFBundlePackageType</key>
18
+ <string>APPL</string>
19
+ <key>CFBundleSignature</key>
20
+ <string>????</string>
21
+ <key>CFBundleVersion</key>
22
+ <string>1.0</string>
23
+ <key>NSMainNibFile</key>
24
+ <string>MainMenu</string>
25
+ <key>NSPrincipalClass</key>
26
+ <string>NSApplication</string>
27
+ <key>SUFeedURL</key>
28
+ <string>http://mocra.com/sample_app/my_feed.xml</string>
29
+ </dict>
30
+ </plist>
@@ -1,5 +1,6 @@
1
- require 'rubygems'
2
- require 'spec'
1
+ require "bundler"
2
+ Bundler.setup
3
+ Bundler.require :spec
3
4
 
4
5
  $:.unshift(File.dirname(__FILE__) + '/../lib')
5
6
  require 'choctop'
@@ -0,0 +1,26 @@
1
+ require 'spec_helper'
2
+
3
+ describe ChocTop::VersionHelper do
4
+ before(:each) do
5
+ @version_helper = ChocTop::VersionHelper.new(File.expand_path("spec/fixtures/Info.plist"))
6
+ end
7
+
8
+ it "should handle Xcodes default format d.d" do
9
+ @version_helper.to_s.should == "1.0.0"
10
+ end
11
+
12
+ it "should bump major" do
13
+ @version_helper.bump_major
14
+ @version_helper.to_s.should == "2.0.0"
15
+ end
16
+
17
+ it "should bump minor" do
18
+ @version_helper.bump_minor
19
+ @version_helper.to_s.should == "1.1.0"
20
+ end
21
+
22
+ it "should bump patch" do
23
+ @version_helper.bump_patch
24
+ @version_helper.to_s.should == "1.0.1"
25
+ end
26
+ end
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: 45
4
+ hash: 43
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 12
9
- - 1
10
- version: 0.12.1
8
+ - 13
9
+ - 0
10
+ version: 0.13.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Dr Nic Williams
@@ -17,73 +17,119 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2010-06-08 00:00:00 +02:00
20
+ date: 2010-07-06 00:00:00 +10:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
24
- name: builder
25
- prerelease: false
26
24
  requirement: &id001 !ruby/object:Gem::Requirement
27
25
  none: false
28
26
  requirements:
29
27
  - - ">="
30
28
  - !ruby/object:Gem::Version
31
- hash: 15
29
+ hash: 7
32
30
  segments:
33
31
  - 2
34
- - 1
35
- - 2
36
- version: 2.1.2
37
- type: :runtime
32
+ - 0
33
+ - 4
34
+ version: 2.0.4
35
+ type: :development
36
+ prerelease: false
37
+ name: rubyforge
38
38
  version_requirements: *id001
39
39
  - !ruby/object:Gem::Dependency
40
- name: rubyforge
41
- prerelease: false
42
40
  requirement: &id002 !ruby/object:Gem::Requirement
43
41
  none: false
44
42
  requirements:
45
43
  - - ">="
46
44
  - !ruby/object:Gem::Version
47
- hash: 7
45
+ hash: 21
48
46
  segments:
49
47
  - 2
50
- - 0
51
- - 4
52
- version: 2.0.4
48
+ - 6
49
+ - 1
50
+ version: 2.6.1
53
51
  type: :development
52
+ prerelease: false
53
+ name: hoe
54
54
  version_requirements: *id002
55
55
  - !ruby/object:Gem::Dependency
56
- name: newgem
57
- prerelease: false
58
56
  requirement: &id003 !ruby/object:Gem::Requirement
59
57
  none: false
60
58
  requirements:
61
- - - ">="
59
+ - - "="
62
60
  - !ruby/object:Gem::Version
63
- hash: 5
61
+ hash: 23
64
62
  segments:
65
- - 1
66
- - 5
67
- - 3
68
- version: 1.5.3
69
- type: :development
63
+ - 0
64
+ - 0
65
+ - 4
66
+ version: 0.0.4
67
+ type: :runtime
68
+ prerelease: false
69
+ name: escape
70
70
  version_requirements: *id003
71
71
  - !ruby/object:Gem::Dependency
72
- name: hoe
73
- prerelease: false
74
72
  requirement: &id004 !ruby/object:Gem::Requirement
75
73
  none: false
76
74
  requirements:
77
- - - ">="
75
+ - - "="
78
76
  - !ruby/object:Gem::Version
79
- hash: 23
77
+ hash: 21
80
78
  segments:
79
+ - 0
81
80
  - 2
82
- - 6
81
+ - 1
82
+ version: 0.2.1
83
+ type: :runtime
84
+ prerelease: false
85
+ name: awesome_print
86
+ version_requirements: *id004
87
+ - !ruby/object:Gem::Dependency
88
+ requirement: &id005 !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ hash: 3
94
+ segments:
83
95
  - 0
84
- version: 2.6.0
96
+ version: "0"
85
97
  type: :development
86
- version_requirements: *id004
98
+ prerelease: false
99
+ name: bundler
100
+ version_requirements: *id005
101
+ - !ruby/object:Gem::Dependency
102
+ requirement: &id006 !ruby/object:Gem::Requirement
103
+ none: false
104
+ requirements:
105
+ - - "="
106
+ - !ruby/object:Gem::Version
107
+ hash: 49
108
+ segments:
109
+ - 4
110
+ - 2
111
+ - 3
112
+ version: 4.2.3
113
+ type: :runtime
114
+ prerelease: false
115
+ name: RedCloth
116
+ version_requirements: *id006
117
+ - !ruby/object:Gem::Dependency
118
+ requirement: &id007 !ruby/object:Gem::Requirement
119
+ none: false
120
+ requirements:
121
+ - - "="
122
+ - !ruby/object:Gem::Version
123
+ hash: 15
124
+ segments:
125
+ - 2
126
+ - 1
127
+ - 2
128
+ version: 2.1.2
129
+ type: :runtime
130
+ prerelease: false
131
+ name: builder
132
+ version_requirements: *id007
87
133
  description: "Build and deploy tools for Cocoa apps using Sparkle for distributions and upgrades; \n\
88
134
  it\xE2\x80\x99s like Hoe but for Cocoa apps.\n\n\
89
135
  Package up your OS X/Cocoa applications into Custom DMGs, generate Sparkle XML, and\n\
@@ -105,7 +151,13 @@ extensions: []
105
151
  extra_rdoc_files:
106
152
  - History.txt
107
153
  - Manifest.txt
154
+ - features/fixtures/SampleApp/README.txt
108
155
  files:
156
+ - .bundle/config
157
+ - .bundle/environment.rb
158
+ - .rspec
159
+ - Gemfile
160
+ - Gemfile.lock
109
161
  - History.txt
110
162
  - Manifest.txt
111
163
  - README.rdoc
@@ -120,8 +172,26 @@ files:
120
172
  - assets/vanillia_dmg_icon.png
121
173
  - assets/wood.jpg
122
174
  - bin/install_choctop
175
+ - choctop.gemspec
123
176
  - features/development.feature
124
177
  - features/dmg.feature
178
+ - features/fixtures/App With Whitespace/App With Whitespace.xcodeproj/TemplateIcon.icns
179
+ - features/fixtures/App With Whitespace/App With Whitespace.xcodeproj/project.pbxproj
180
+ - features/fixtures/App With Whitespace/App With Whitespace_Prefix.pch
181
+ - features/fixtures/App With Whitespace/English.lproj/InfoPlist.strings
182
+ - features/fixtures/App With Whitespace/English.lproj/MainMenu.xib
183
+ - features/fixtures/App With Whitespace/Info.plist
184
+ - features/fixtures/App With Whitespace/main.m
185
+ - features/fixtures/MyBundle.tmbundle/Snippets/hello world.tmSnippet
186
+ - features/fixtures/MyBundle.tmbundle/info.plist
187
+ - features/fixtures/SampleApp/English.lproj/InfoPlist.strings
188
+ - features/fixtures/SampleApp/English.lproj/MainMenu.xib
189
+ - features/fixtures/SampleApp/Info.plist
190
+ - features/fixtures/SampleApp/README.txt
191
+ - features/fixtures/SampleApp/SampleApp.xcodeproj/TemplateIcon.icns
192
+ - features/fixtures/SampleApp/SampleApp.xcodeproj/project.pbxproj
193
+ - features/fixtures/SampleApp/SampleApp_Prefix.pch
194
+ - features/fixtures/SampleApp/main.m
125
195
  - features/fixtures/custom_assets/appicon.icns
126
196
  - features/initial_generator.feature
127
197
  - features/rake_tasks.feature
@@ -133,6 +203,7 @@ files:
133
203
  - features/step_definitions/remote_steps.rb
134
204
  - features/step_definitions/xcode_steps.rb
135
205
  - features/support/common.rb
206
+ - features/support/dmg_helpers.rb
136
207
  - features/support/env.rb
137
208
  - features/support/matchers.rb
138
209
  - lib/choctop.rb
@@ -144,9 +215,10 @@ files:
144
215
  - script/destroy
145
216
  - script/generate
146
217
  - spec/choctop_spec.rb
147
- - spec/spec.opts
218
+ - spec/dmg_spec.rb
219
+ - spec/fixtures/Info.plist
148
220
  - spec/spec_helper.rb
149
- - tasks/rspec.rake
221
+ - spec/version_helper_spec.rb
150
222
  has_rdoc: true
151
223
  homepage: http://drnic.github.com/choctop
152
224
  licenses: []
@@ -1,21 +0,0 @@
1
- begin
2
- require 'spec'
3
- rescue LoadError
4
- require 'rubygems'
5
- require 'spec'
6
- end
7
- begin
8
- require 'spec/rake/spectask'
9
- rescue LoadError
10
- puts <<-EOS
11
- To use rspec for testing you must install rspec gem:
12
- gem install rspec
13
- EOS
14
- exit(0)
15
- end
16
-
17
- desc "Run the specs under spec/models"
18
- Spec::Rake::SpecTask.new do |t|
19
- t.spec_opts = ['--options', "spec/spec.opts"]
20
- t.spec_files = FileList['spec/**/*_spec.rb']
21
- end