choctop 0.11.1 → 0.12.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.
@@ -0,0 +1,74 @@
1
+ module ChocTop
2
+ module RakeTasks
3
+ def define_tasks
4
+ return unless Object.const_defined?("Rake")
5
+
6
+ desc "Build Xcode #{build_type}"
7
+ task :build => "build/#{build_type}/#{target}/Contents/Info.plist"
8
+
9
+ task "build/#{build_type}/#{target}/Contents/Info.plist" do
10
+ make_build
11
+ end
12
+
13
+ desc "Create the dmg file for appcasting"
14
+ task :dmg => :build do
15
+ detach_dmg
16
+ make_dmg
17
+ detach_dmg
18
+ convert_dmg_readonly
19
+ add_eula
20
+ end
21
+
22
+ desc "Create/update the appcast file"
23
+ task :feed do
24
+ make_appcast
25
+ make_dmg_symlink
26
+ make_index_redirect
27
+ make_release_notes
28
+ end
29
+
30
+ desc "Upload the appcast file to the host"
31
+ task :upload => :feed do
32
+ upload_appcast
33
+ end
34
+
35
+ task :detach_dmg do
36
+ detach_dmg
37
+ end
38
+
39
+ task :size do
40
+ puts configure_dmg_window
41
+ end
42
+
43
+ namespace :version do
44
+ desc "Display the current version"
45
+ task :current do
46
+ puts VersionHelper.new(info_plist_path).to_s
47
+ end
48
+
49
+ namespace :bump do
50
+ desc "Bump the gemspec by a major version."
51
+ task :major do
52
+ VersionHelper.new(info_plist_path) do |version|
53
+ version.bump_major
54
+ end
55
+ end
56
+
57
+ desc "Bump the gemspec by a minor version."
58
+ task :minor do
59
+ VersionHelper.new(info_plist_path) do |version|
60
+ version.bump_minor
61
+ end
62
+ end
63
+
64
+ desc "Bump the gemspec by a patch version."
65
+ task :patch do
66
+ VersionHelper.new(info_plist_path) do |version|
67
+ version.bump_patch
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,66 @@
1
+ module ChocTop
2
+ class VersionHelper
3
+ attr_accessor :info_plist_path
4
+ attr_reader :major, :minor, :patch, :build
5
+
6
+ def initialize(info_plist_path)
7
+ self.info_plist_path = info_plist_path
8
+ parse_version
9
+ if block_given?
10
+ yield self
11
+ write
12
+ end
13
+ end
14
+
15
+ def info_plist
16
+ @info_plist ||= OSX::NSDictionary.dictionaryWithContentsOfFile(info_plist_path) || {}
17
+ end
18
+
19
+ def parse_version
20
+ # http://rubular.com/regexes/10467 -> 3.5.4.a1
21
+ # http://rubular.com/regexes/10468 -> 3.5.4
22
+ # regex on nsstring is broken so convert it to a ruby string
23
+ if info_plist['CFBundleVersion'].to_s =~ /^(\d+)\.(\d+)\.?(\d+)?(?:\.(.*?))?$/
24
+ @major = $1.to_i
25
+ @minor = $2.to_i
26
+ @patch = $3.to_i
27
+ @build = $4
28
+ end
29
+ end
30
+
31
+ def bump_major
32
+ @major += 1
33
+ @minor = 0
34
+ @patch = 0
35
+ @build = nil
36
+ end
37
+
38
+ def bump_minor
39
+ @minor += 1
40
+ @patch = 0
41
+ @build = nil
42
+ end
43
+
44
+ def bump_patch
45
+ @patch += 1
46
+ @build = nil
47
+ end
48
+
49
+ def update_to(major, minor, patch, build=nil)
50
+ @major = major
51
+ @minor = minor
52
+ @patch = patch
53
+ @build = build
54
+ end
55
+
56
+ def write
57
+ info_plist['CFBundleVersion'] = to_s
58
+ info_plist['CFBundleShortVersionString'] = to_s
59
+ info_plist.writeToFile_atomically(info_plist_path,true)
60
+ end
61
+
62
+ def to_s
63
+ [major, minor, patch, build].compact.join('.')
64
+ end
65
+ end
66
+ end
@@ -1,46 +1,55 @@
1
1
  require File.dirname(__FILE__) + '/spec_helper.rb'
2
2
 
3
- describe ChocTop do
4
- attr_reader :choctop
3
+ describe ChocTop::Configuration do
5
4
 
6
5
  describe "default" do
7
6
  before(:each) do
8
7
  FileUtils.chdir(File.dirname(__FILE__) + "/../features/fixtures/SampleApp") do
9
- @choctop = ChocTop.new
8
+ @choctop = ChocTop::Configuration.new
10
9
  end
11
10
  end
12
11
 
13
12
  it "should get name from Info.plist['CFBundleExecutable']" do
14
- choctop.name.should == 'SampleApp'
13
+ @choctop.name.should == 'SampleApp'
15
14
  end
16
15
 
17
16
  it "should get version from Info.plist['CFBundleVersion']" do
18
- choctop.version.should == '0.1.0'
17
+ @choctop.version.should == '0.1.0'
19
18
  end
20
19
 
21
20
  it "should derive host from Info.plist['SUFeedURL']" do
22
- choctop.host.should == 'mocra.com'
21
+ @choctop.host.should == 'mocra.com'
23
22
  end
24
23
 
25
24
  it "should derive base_url from Info.plist['SUFeedURL']" do
26
- choctop.base_url.should == 'http://mocra.com/sample_app'
25
+ @choctop.base_url.should == 'http://mocra.com/sample_app'
27
26
  end
28
27
 
29
28
  it "should derive appcast_filename from Info.plist['SUFeedURL']" do
30
- choctop.appcast_filename.should == 'my_feed.xml'
29
+ @choctop.appcast_filename.should == 'my_feed.xml'
30
+ end
31
+
32
+ it "should default the appcast_filename to my_feed.xml" do
33
+ ChocTop::Configuration.new.appcast_filename.should == 'my_feed.xml'
34
+ end
35
+
36
+ it "should raise an exception if the base_url is nil" do
37
+ lambda{
38
+ ChocTop::Configuration.new.pkg_relative_url
39
+ }.should raise_error(Exception, "The base url should be set in order to create a sparkle feed. Set the SUFeedURL in your Info.plist.")
31
40
  end
32
41
  end
33
42
 
34
43
  describe "add_files" do
35
44
  before(:each) do
36
45
  FileUtils.chdir(File.dirname(__FILE__) + "/../features/fixtures/SampleApp") do
37
- @choctop = ChocTop.new
46
+ @choctop = ChocTop::Configuration.new
38
47
  @choctop.add_file "README.txt", :position => [50, 100]
39
48
  end
40
49
  end
41
50
 
42
- it "should have build/Release/SampleApp.app as a file/bundle" do
43
- @choctop.files.keys.should be_include('build/Release/SampleApp.app')
51
+ it "should have target_bundle as a file/bundle" do
52
+ @choctop.files.keys.should include(:target_bundle)
44
53
  end
45
54
 
46
55
  it "should have README.txt as a file" do
@@ -57,30 +66,10 @@ describe ChocTop do
57
66
  @choctop.prepare_files
58
67
  end
59
68
  end
60
-
61
- it "should have SampleApp.app in build/Release/dmg ready for inclusion in DMG" do
62
- FileUtils.chdir(File.dirname(__FILE__) + "/../features/fixtures/SampleApp") do
63
- File.should be_exists('build/Release/dmg/SampleApp.app')
64
- end
65
- end
66
-
67
- it "should position SampleApp.app at [175, 65]" do
68
- @choctop.set_position_of_files.should =~ /set position of item "SampleApp.app" to \{175, 65\}/
69
- end
70
-
71
- it "should have README.txt in build/Release ready for inclusion in DMG" do
72
- FileUtils.chdir(File.dirname(__FILE__) + "/../features/fixtures/SampleApp") do
73
- File.should be_exists('build/Release/dmg/README.txt')
74
- end
75
- end
76
-
69
+
77
70
  it "should position README.txt at [50, 100]" do
78
71
  @choctop.set_position_of_files.should =~ /set position of item "README.txt" to \{50, 100\}/
79
72
  end
80
-
81
- it "should render an Applications shortcut" do
82
- @choctop.set_position_of_shortcuts.should =~ /applications_folder/
83
- end
84
73
  end
85
74
 
86
75
  end
@@ -93,19 +82,13 @@ describe ChocTop do
93
82
  `touch #{File.join(@my_project_path, 'README.txt')}`
94
83
  `touch #{File.join(@my_project_path, 'some_other_file.txt')}`
95
84
  FileUtils.chdir(@my_project_path) do
96
- @choctop = ChocTop.new
85
+ @choctop = ChocTop::Configuration.new
97
86
  @choctop.add_file "README.txt", :position => [50, 100]
98
87
  @choctop.add_file "some_other_file.txt", :position => [50, 150]
99
88
  @choctop.prepare_files
100
89
  end
101
90
  end
102
91
 
103
- it "should have README.txt in build/Release/dmg ready for inclusion in DMG" do
104
- FileUtils.chdir(@my_project_path) do
105
- File.should be_exists('build/Release/dmg/README.txt')
106
- end
107
- end
108
-
109
92
  it "should not render an Applications shortcut" do
110
93
  @choctop.set_position_of_shortcuts.should_not =~ /applications_folder/
111
94
  end
metadata CHANGED
@@ -1,58 +1,103 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: choctop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.1
4
+ hash: 47
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 12
9
+ - 0
10
+ version: 0.12.0
5
11
  platform: ruby
6
12
  authors:
7
13
  - Dr Nic Williams
8
14
  - Chris Bailey
15
+ - Patrick Huesler
9
16
  autorequire:
10
17
  bindir: bin
11
18
  cert_chain: []
12
19
 
13
- date: 2009-11-17 00:00:00 +10:00
20
+ date: 2010-05-29 00:00:00 +02:00
14
21
  default_executable:
15
22
  dependencies:
16
23
  - !ruby/object:Gem::Dependency
17
24
  name: activesupport
18
- type: :runtime
19
- version_requirement:
20
- version_requirements: !ruby/object:Gem::Requirement
25
+ prerelease: false
26
+ requirement: &id001 !ruby/object:Gem::Requirement
27
+ none: false
21
28
  requirements:
22
29
  - - ">="
23
30
  - !ruby/object:Gem::Version
31
+ hash: 3
32
+ segments:
33
+ - 0
24
34
  version: "0"
25
- version:
35
+ type: :runtime
36
+ version_requirements: *id001
26
37
  - !ruby/object:Gem::Dependency
27
38
  name: builder
28
- type: :runtime
29
- version_requirement:
30
- version_requirements: !ruby/object:Gem::Requirement
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
31
42
  requirements:
32
43
  - - ">="
33
44
  - !ruby/object:Gem::Version
45
+ hash: 15
46
+ segments:
47
+ - 2
48
+ - 1
49
+ - 2
34
50
  version: 2.1.2
35
- version:
51
+ type: :runtime
52
+ version_requirements: *id002
36
53
  - !ruby/object:Gem::Dependency
37
- name: newgem
54
+ name: rubyforge
55
+ prerelease: false
56
+ requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ hash: 7
62
+ segments:
63
+ - 2
64
+ - 0
65
+ - 4
66
+ version: 2.0.4
38
67
  type: :development
39
- version_requirement:
40
- version_requirements: !ruby/object:Gem::Requirement
68
+ version_requirements: *id003
69
+ - !ruby/object:Gem::Dependency
70
+ name: newgem
71
+ prerelease: false
72
+ requirement: &id004 !ruby/object:Gem::Requirement
73
+ none: false
41
74
  requirements:
42
75
  - - ">="
43
76
  - !ruby/object:Gem::Version
44
- version: 1.5.2
45
- version:
77
+ hash: 5
78
+ segments:
79
+ - 1
80
+ - 5
81
+ - 3
82
+ version: 1.5.3
83
+ type: :development
84
+ version_requirements: *id004
46
85
  - !ruby/object:Gem::Dependency
47
86
  name: hoe
48
- type: :development
49
- version_requirement:
50
- version_requirements: !ruby/object:Gem::Requirement
87
+ prerelease: false
88
+ requirement: &id005 !ruby/object:Gem::Requirement
89
+ none: false
51
90
  requirements:
52
91
  - - ">="
53
92
  - !ruby/object:Gem::Version
54
- version: 2.3.3
55
- version:
93
+ hash: 23
94
+ segments:
95
+ - 2
96
+ - 6
97
+ - 0
98
+ version: 2.6.0
99
+ type: :development
100
+ version_requirements: *id005
56
101
  description: "Build and deploy tools for Cocoa apps using Sparkle for distributions and upgrades; \n\
57
102
  it\xE2\x80\x99s like Hoe but for Cocoa apps.\n\n\
58
103
  Package up your OS X/Cocoa applications into Custom DMGs, generate Sparkle XML, and\n\
@@ -62,10 +107,11 @@ description: "Build and deploy tools for Cocoa apps using Sparkle for distributi
62
107
  The main feature is a powerful rake task \"rake appcast\" which builds a release of your\n\
63
108
  application, creates a DMG package, generates a Sparkle XML file, and posts the package\n\
64
109
  and XML file to your remote host via rsync.\n\n\
65
- All rake tasks:\n\n rake appcast # Create dmg, update appcast file, and upload to host\n rake build # Build Xcode Release\n rake dmg # Create the dmg file for appcasting\n rake feed # Create/update the appcast file\n rake upload # Upload the appcast file to the host"
110
+ All rake tasks:\n rake build # Build Xcode Release\n rake dmg # Create the dmg file for appcasting\n rake feed # Create/update the appcast file\n rake upload # Upload the appcast file to the host\n rake version:bump:major # Bump the gemspec by a major version.\n rake version:bump:minor # Bump the gemspec by a minor version.\n rake version:bump:patch # Bump the gemspec by a patch version.\n rake version:current # Display the current version"
66
111
  email:
67
112
  - drnicwilliams@gmail.com
68
113
  - chris@cobaltedge.com
114
+ - patrick.huesler@gmail.com
69
115
  executables:
70
116
  - install_choctop
71
117
  extensions: []
@@ -106,6 +152,8 @@ files:
106
152
  - lib/choctop.rb
107
153
  - lib/choctop/appcast.rb
108
154
  - lib/choctop/dmg.rb
155
+ - lib/choctop/rake_tasks.rb
156
+ - lib/choctop/version_helper.rb
109
157
  - script/console
110
158
  - script/destroy
111
159
  - script/generate
@@ -124,21 +172,27 @@ rdoc_options:
124
172
  require_paths:
125
173
  - lib
126
174
  required_ruby_version: !ruby/object:Gem::Requirement
175
+ none: false
127
176
  requirements:
128
177
  - - ">="
129
178
  - !ruby/object:Gem::Version
179
+ hash: 3
180
+ segments:
181
+ - 0
130
182
  version: "0"
131
- version:
132
183
  required_rubygems_version: !ruby/object:Gem::Requirement
184
+ none: false
133
185
  requirements:
134
186
  - - ">="
135
187
  - !ruby/object:Gem::Version
188
+ hash: 3
189
+ segments:
190
+ - 0
136
191
  version: "0"
137
- version:
138
192
  requirements: []
139
193
 
140
194
  rubyforge_project: choctop
141
- rubygems_version: 1.3.5
195
+ rubygems_version: 1.3.7
142
196
  signing_key:
143
197
  specification_version: 3
144
198
  summary: "Build and deploy tools for Cocoa apps using Sparkle for distributions and upgrades; it\xE2\x80\x99s like Hoe but for Cocoa apps"