betabuilder 0.6.0 → 0.7.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/CHANGES.md CHANGED
@@ -1,4 +1,15 @@
1
- ## 0.4.2
1
+ ## 0.7.0
2
+ * Much improved Xcode 4 support.
3
+ * Generate Xcode 4 style archives using the :xcode4_archive_mode
4
+ * Xcode 4 style archives appear in Xcode organiser complete with your release notes.
5
+ * Added a :skip_clean option to skip cleaning when building
6
+ * Allow the app name to be explicitly set using :app_name
7
+ * WARNING: Xcode 3 support is officially deprecated as of this release!
8
+
9
+ ## 0.6.0
10
+ * Support Xcode 4 workspaces and schemes.
11
+
12
+ ## 0.5.0
2
13
  * Support configurable path to xcodebuild executable
3
14
  * Support configurable path to Xcode project file
4
15
 
@@ -12,7 +12,7 @@ module BetaBuilder
12
12
  :configuration => "Adhoc",
13
13
  :build_dir => "build",
14
14
  :auto_archive => false,
15
- :archive_path => File.expand_path("~/Library/Application Support/Developer/Shared/Archived Applications"),
15
+ :archive_path => File.expand_path("~/Library/Developer/Xcode/Archives"),
16
16
  :xcodebuild_path => "xcodebuild",
17
17
  :project_file_path => nil,
18
18
  :workspace_path => nil,
@@ -43,6 +43,10 @@ module BetaBuilder
43
43
  end
44
44
  end
45
45
 
46
+ def archive_name
47
+ app_name || target
48
+ end
49
+
46
50
  def app_file_name
47
51
  if app_name
48
52
  "#{app_name}.app"
@@ -149,8 +153,10 @@ module BetaBuilder
149
153
 
150
154
  desc "Build and archive the app"
151
155
  task :archive => :build do
152
- archive = BetaBuilder::ArchivedBuild.new(@configuration)
153
- archive.save_to(@configuration.archive_path)
156
+ puts "Archiving build..."
157
+ archive = BetaBuilder.archive(@configuration)
158
+ output_path = archive.save_to(@configuration.archive_path)
159
+ puts "Archive saved to #{output_path}."
154
160
  end
155
161
  end
156
162
  end
@@ -1,7 +1,16 @@
1
1
  require 'uuid'
2
2
  require 'fileutils'
3
+ require 'CFPropertyList'
3
4
 
4
5
  module BetaBuilder
6
+ def self.archive(configuration)
7
+ if configuration.xcode4_archive_mode
8
+ Xcode4ArchivedBuild.new(configuration)
9
+ else
10
+ ArchivedBuild.new(configuration)
11
+ end
12
+ end
13
+
5
14
  class ArchivedBuild
6
15
  def initialize(configuration)
7
16
  @configuration = configuration
@@ -9,17 +18,83 @@ module BetaBuilder
9
18
  end
10
19
 
11
20
  def save_to(path)
12
- if @configuration.xcode4_archive_mode
13
- date_path = File.join(path, "#{Time.now.strftime('%Y-%m-%d')}")
14
- FileUtils.mkdir_p(date_path)
15
- archive_path = File.join(date_path, "#{@configuration.target}.xcarchive")
16
- else
17
- archive_path = File.join(path, "#{@uuid}.apparchive")
18
- end
19
-
21
+ archive_path = File.join(path, "#{@uuid}.apparchive")
20
22
  FileUtils.mkdir(archive_path)
21
23
  FileUtils.cp_r(@configuration.built_app_path, archive_path)
22
24
  FileUtils.cp_r(@configuration.built_app_dsym_path, archive_path)
25
+ archive_path
26
+ end
27
+ end
28
+
29
+ class Xcode4ArchivedBuild
30
+ def initialize(configuration)
31
+ @configuration = configuration
32
+ end
33
+
34
+ def archive_file_name
35
+ "#{@configuration.archive_name} #{Time.now.strftime('%Y-%m-%d %H.%M')}.xcarchive"
36
+ end
37
+
38
+ def archive_path_within(path)
39
+ File.join(path, "#{Time.now.strftime('%Y-%m-%d')}", archive_file_name)
40
+ end
41
+
42
+ def applications_path
43
+ File.join("Products", "Applications")
44
+ end
45
+
46
+ def dsyms_path
47
+ "dSYMs"
48
+ end
49
+
50
+ def plist_info_path
51
+ File.join(@configuration.built_app_path, "Info.plist")
52
+ end
53
+
54
+ def save_to(path)
55
+ archive_path = archive_path_within(path)
56
+ FileUtils.mkdir_p(archive_path)
57
+
58
+ application_path = File.join(archive_path, applications_path)
59
+ FileUtils.mkdir_p(application_path)
60
+ FileUtils.cp_r(@configuration.built_app_path, application_path)
61
+
62
+ dsym_path = File.join(archive_path, dsyms_path)
63
+ FileUtils.mkdir_p(dsym_path)
64
+ FileUtils.cp_r(@configuration.built_app_dsym_path, dsym_path)
65
+
66
+ write_plist_to(archive_path)
67
+ archive_path
68
+ end
69
+
70
+ private
71
+
72
+ def write_plist_to(path)
73
+ plist = {
74
+ "ApplicationProperties" => {
75
+ "ApplicationPath" => File.join("Applications", "#{@configuration.app_file_name}.app"),
76
+ "CFBundleIdentifier" => metadata["CFBundleIdentifier"],
77
+ "CFBundleShortVersionString" => metadata["CFBundleShortVersionString"],
78
+ "IconPaths" => metadata["CFBundleIconFiles"].map { |file| File.join("Applications", @configuration.app_file_name, file) }
79
+ },
80
+ "ArchiveVersion" => 1.0,
81
+ "Comment" => @configuration.release_notes,
82
+ "CreationDate" => Time.now,
83
+ "Name" => @configuration.archive_name,
84
+ "SchemeName" => @configuration.scheme
85
+ }
86
+ File.open(File.join(path, "Info.plist"), "w") do |io|
87
+ io.write plist.to_plist
88
+ end
89
+ end
90
+
91
+ def metadata
92
+ @metadata ||= load_property_list(plist_info_path)
93
+ end
94
+
95
+ def load_property_list(path)
96
+ plist = CFPropertyList::List.new(:file => path)
97
+ CFPropertyList.native_types(plist.value)
23
98
  end
24
99
  end
25
100
  end
@@ -53,7 +53,7 @@ module BetaBuilder
53
53
  begin
54
54
  filepath = "#{dir}/release_notes"
55
55
  system("#{editor} #{filepath}")
56
- notes = File.read(filepath)
56
+ @configuration.release_notes = File.read(filepath)
57
57
  ensure
58
58
  rm_rf(dir)
59
59
  end
@@ -61,7 +61,7 @@ module BetaBuilder
61
61
 
62
62
  def get_notes_using_prompt
63
63
  puts "Enter the release notes for this build (hit enter twice when done):\n"
64
- gets_until_match(/\n{2}$/).strip
64
+ @configuration.release_notes = gets_until_match(/\n{2}$/).strip
65
65
  end
66
66
 
67
67
  def gets_until_match(pattern, string = "")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: betabuilder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: CFPropertyList
17
- requirement: &2156056740 !ruby/object:Gem::Requirement
17
+ requirement: &2152291440 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 2.0.0
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2156056740
25
+ version_requirements: *2152291440
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: uuid
28
- requirement: &2156056260 !ruby/object:Gem::Requirement
28
+ requirement: &2152290800 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 2.3.1
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *2156056260
36
+ version_requirements: *2152290800
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: rest-client
39
- requirement: &2156054940 !ruby/object:Gem::Requirement
39
+ requirement: &2152290280 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ~>
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: 1.6.1
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *2156054940
47
+ version_requirements: *2152290280
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: json
50
- requirement: &2156053160 !ruby/object:Gem::Requirement
50
+ requirement: &2152289800 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ~>
@@ -55,7 +55,7 @@ dependencies:
55
55
  version: 1.4.6
56
56
  type: :runtime
57
57
  prerelease: false
58
- version_requirements: *2156053160
58
+ version_requirements: *2152289800
59
59
  description:
60
60
  email: luke@lukeredpath.co.uk
61
61
  executables: []