objective_release 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.gitignore ADDED
@@ -0,0 +1,7 @@
1
+ rdoc
2
+ doc
3
+ .yardoc
4
+ .bundle
5
+ pkg
6
+ .DS_Store
7
+ .rvmrc
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'http://rubygems.org'
2
+
3
+ # Gem dependencies specified in objective_release.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,33 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ objective_release (0.1.5)
5
+ grit (~> 2.4.1)
6
+ plist (~> 3.1.0)
7
+
8
+ GEM
9
+ remote: http://rubygems.org/
10
+ specs:
11
+ diff-lcs (1.1.2)
12
+ grit (2.4.1)
13
+ diff-lcs (~> 1.1)
14
+ mime-types (~> 1.15)
15
+ mime-types (1.16)
16
+ mocha (0.9.12)
17
+ plist (3.1.0)
18
+ rspec (2.6.0)
19
+ rspec-core (~> 2.6.0)
20
+ rspec-expectations (~> 2.6.0)
21
+ rspec-mocks (~> 2.6.0)
22
+ rspec-core (2.6.4)
23
+ rspec-expectations (2.6.0)
24
+ diff-lcs (~> 1.1.2)
25
+ rspec-mocks (2.6.0)
26
+
27
+ PLATFORMS
28
+ ruby
29
+
30
+ DEPENDENCIES
31
+ mocha (~> 0.9.12)
32
+ objective_release!
33
+ rspec (~> 2.6.0)
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Shay Frendt
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.markdown ADDED
@@ -0,0 +1,21 @@
1
+ ## ObjectiveRelease
2
+
3
+ This goal of this project is to automate the deployment of iOS applications as much as possible. I use ruby as a scripting language, and am bringing it into the Objective-C world because it's an awesome scripting language.
4
+
5
+ Add the following to your iOS project's `Rakefile` to make nice releases:
6
+
7
+ require 'objective_release'
8
+
9
+ namespace :version do
10
+ desc "Bump version and update release notes"
11
+ task :bump do
12
+ basedir = File.join(File.dirname(__FILE__), 'MyApp')
13
+ config = File.join(basedir, "MyApp-Info.plist")
14
+ release_notes = File.join(basedir, "RELEASE_NOTES")
15
+
16
+ release = ObjectiveRelease::Release.new
17
+ release.update_bundle_version(config)
18
+ release.update_release_notes(release_notes)
19
+ end
20
+ end
21
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ require 'rspec/core/rake_task'
5
+ RSpec::Core::RakeTask.new(:spec)
6
+ task :default => :spec
@@ -0,0 +1,2 @@
1
+ require 'plist'
2
+ require 'objective_release/release'
@@ -0,0 +1,58 @@
1
+ module ObjectiveRelease
2
+ class Release
3
+ def update_bundle_version(plist_file)
4
+ parsed_plist = parse_plist(plist_file)
5
+ version_string = parsed_plist['CFBundleVersion']
6
+ parsed_plist['CFBundleVersion'] = increment_version(version_string)
7
+ exported_plist = Plist::Emit.dump(parsed_plist)
8
+ export_plist(plist_file, exported_plist)
9
+ end
10
+
11
+ def update_release_notes(release_notes_file)
12
+ release_notes = File.read(release_notes_file)
13
+
14
+ version_number = release_notes.split("\n").first
15
+ new_version_number = increment_version(version_number)
16
+
17
+ last_deployed_sha = release_notes.split("\n")[2].split.first
18
+ system "git log --since #{last_deployed_sha} --pretty=oneline > /tmp/commit-log.txt"
19
+ latest_commits = File.read(File.expand_path("/tmp/commit-log.txt"))
20
+
21
+ new_release_notes = latest_commits.insert(0, "v#{new_version_number}")
22
+ export_release_notes(release_notes_file, new_release_notes)
23
+ end
24
+
25
+ private
26
+
27
+ def parse_plist(plist)
28
+ Plist::parse_xml plist
29
+ end
30
+
31
+ def zerofill(number)
32
+ sprintf("%02d", number)
33
+ end
34
+
35
+ def increment_version(version_string)
36
+ if version_string =~ /(\d+)\.(\d+)/
37
+ major = $1.to_i
38
+ minor = $2.to_i
39
+ return "#{major}.#{zerofill(minor + 1)}"
40
+ else
41
+ raise "Version number could not be incremented."
42
+ end
43
+ end
44
+
45
+ def export_plist(file, contents)
46
+ contents.gsub!("Apple Computer", "Apple")
47
+ File.open(file, 'w+') do |f|
48
+ f.write contents
49
+ end
50
+ end
51
+
52
+ def export_release_notes(file, contents)
53
+ File.open(file, 'w+') do |f|
54
+ f.write contents
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,3 @@
1
+ module ObjectiveRelease
2
+ VERSION = "0.1.5"
3
+ end
@@ -0,0 +1,27 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "objective_release/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "objective_release"
7
+ s.homepage = "http://github.com/shayfrendt/objective_release"
8
+ s.license = "MIT"
9
+ s.version = ObjectiveRelease::VERSION
10
+ s.platform = Gem::Platform::RUBY
11
+ s.authors = ["Shay Frendt"]
12
+ s.email = ["shay.frendt@gmail.com"]
13
+ s.summary = %Q{Deploy your iOS applications with gusto!}
14
+ s.description = %Q{ObjectiveRelease gives you nice methods for updating your build version and release notes}
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {spec}/*`.split("\n")
18
+ s.require_paths = ["lib"]
19
+
20
+ # Runtime Dependencies
21
+ s.add_runtime_dependency 'plist', ['~> 3.1.0']
22
+ s.add_runtime_dependency 'grit', ['~> 2.4.1']
23
+
24
+ # Development Dependencies
25
+ s.add_development_dependency 'rspec', ['~> 2.6.0']
26
+ s.add_development_dependency 'mocha', ['~> 0.9.12']
27
+ end
@@ -0,0 +1,10 @@
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>CFBundleName</key>
6
+ <string>Objective Release Sample</string>
7
+ <key>CFBundleVersion</key>
8
+ <string>1.43</string>
9
+ </dict>
10
+ </plist>
@@ -0,0 +1,10 @@
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>CFBundleName</key>
6
+ <string>Objective Release Sample</string>
7
+ <key>CFBundleVersion</key>
8
+ <string>1.42</string>
9
+ </dict>
10
+ </plist>
@@ -0,0 +1,10 @@
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>CFBundleName</key>
6
+ <string>Objective Release Sample</string>
7
+ <key>CFBundleVersion</key>
8
+ <string>1.43</string>
9
+ </dict>
10
+ </plist>
@@ -0,0 +1,5 @@
1
+ v1.43
2
+
3
+ Commit Message 7
4
+ Commit Message 6
5
+ Commit Message 5
@@ -0,0 +1,6 @@
1
+ v1.42
2
+
3
+ Commit Message 4
4
+ Commit Message 3
5
+ Commit Message 2
6
+ Commit Message 1
@@ -0,0 +1 @@
1
+ v1.43
@@ -0,0 +1,47 @@
1
+ require 'spec_helper'
2
+ require 'fileutils'
3
+
4
+ module ObjectiveRelease
5
+ describe Release do
6
+ let(:release_notes_start) { File.read(fixture_file_path("RELEASE_NOTES_START")) }
7
+ let(:release_notes_end) { File.read(fixture_file_path("RELEASE_NOTES_END")) }
8
+ let(:config_start) { File.read(fixture_file_path("Config-Start.plist")) }
9
+ let(:config_end) { File.read(fixture_file_path("Config-End.plist")) }
10
+
11
+ context ".update_release_notes" do
12
+ let(:release_notes_test_file) { fixture_file_path("RELEASE_NOTES_TEST") }
13
+
14
+ before do
15
+ FileUtils.rm_rf(release_notes_test_file)
16
+ test_file = File.open(release_notes_test_file, 'w') do |f|
17
+ f.write(release_notes_start)
18
+ end
19
+ end
20
+
21
+ it "includes the current app version number" do
22
+ release = Release.new
23
+ release.update_release_notes(release_notes_test_file)
24
+ File.read(release_notes_test_file).should include('v1.43')
25
+ end
26
+ end
27
+
28
+ context ".update_bundle_version" do
29
+ let(:config_test_file) { fixture_file_path("Config-Test.plist") }
30
+
31
+ before do
32
+ FileUtils.rm_rf(config_test_file)
33
+ test_file = File.open(config_test_file, 'w') do |f|
34
+ f.write(config_start)
35
+ end
36
+ end
37
+
38
+ it "increments the minor version by 1" do
39
+ release = Release.new
40
+ release.update_bundle_version(config_test_file)
41
+ File.read(config_test_file).should == config_end
42
+ end
43
+ end
44
+
45
+ end
46
+ end
47
+
@@ -0,0 +1,21 @@
1
+ $LOAD_PATH.unshift "../lib"
2
+
3
+ require 'rspec'
4
+ require 'objective_release'
5
+
6
+ # Requires supporting files with custom matchers and macros, etc,
7
+ # in ./support/ and its subdirectories.
8
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
9
+
10
+ RSpec.configure do |config|
11
+ config.mock_with :mocha
12
+ config.filter_run :focused => true
13
+ config.run_all_when_everything_filtered = true
14
+ config.alias_example_to :fit, :focused => true
15
+ config.alias_example_to :xit, :disabled => true
16
+ config.color_enabled = true
17
+ end
18
+
19
+ def fixture_file_path(file_name)
20
+ File.expand_path("spec/fixtures/#{file_name}")
21
+ end
metadata ADDED
@@ -0,0 +1,150 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: objective_release
3
+ version: !ruby/object:Gem::Version
4
+ hash: 17
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 5
10
+ version: 0.1.5
11
+ platform: ruby
12
+ authors:
13
+ - Shay Frendt
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-07-07 00:00:00 -04:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: plist
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 3
32
+ - 1
33
+ - 0
34
+ version: 3.1.0
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: grit
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ hash: 29
46
+ segments:
47
+ - 2
48
+ - 4
49
+ - 1
50
+ version: 2.4.1
51
+ type: :runtime
52
+ version_requirements: *id002
53
+ - !ruby/object:Gem::Dependency
54
+ name: rspec
55
+ prerelease: false
56
+ requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ hash: 23
62
+ segments:
63
+ - 2
64
+ - 6
65
+ - 0
66
+ version: 2.6.0
67
+ type: :development
68
+ version_requirements: *id003
69
+ - !ruby/object:Gem::Dependency
70
+ name: mocha
71
+ prerelease: false
72
+ requirement: &id004 !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ hash: 35
78
+ segments:
79
+ - 0
80
+ - 9
81
+ - 12
82
+ version: 0.9.12
83
+ type: :development
84
+ version_requirements: *id004
85
+ description: ObjectiveRelease gives you nice methods for updating your build version and release notes
86
+ email:
87
+ - shay.frendt@gmail.com
88
+ executables: []
89
+
90
+ extensions: []
91
+
92
+ extra_rdoc_files: []
93
+
94
+ files:
95
+ - .document
96
+ - .gitignore
97
+ - .rspec
98
+ - Gemfile
99
+ - Gemfile.lock
100
+ - LICENSE.txt
101
+ - README.markdown
102
+ - Rakefile
103
+ - lib/objective_release.rb
104
+ - lib/objective_release/release.rb
105
+ - lib/objective_release/version.rb
106
+ - objective_release.gemspec
107
+ - spec/fixtures/Config-End.plist
108
+ - spec/fixtures/Config-Start.plist
109
+ - spec/fixtures/Config-Test.plist
110
+ - spec/fixtures/RELEASE_NOTES_END
111
+ - spec/fixtures/RELEASE_NOTES_START
112
+ - spec/fixtures/RELEASE_NOTES_TEST
113
+ - spec/objective_release/release_spec.rb
114
+ - spec/spec_helper.rb
115
+ has_rdoc: true
116
+ homepage: http://github.com/shayfrendt/objective_release
117
+ licenses:
118
+ - MIT
119
+ post_install_message:
120
+ rdoc_options: []
121
+
122
+ require_paths:
123
+ - lib
124
+ required_ruby_version: !ruby/object:Gem::Requirement
125
+ none: false
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ hash: 3
130
+ segments:
131
+ - 0
132
+ version: "0"
133
+ required_rubygems_version: !ruby/object:Gem::Requirement
134
+ none: false
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ hash: 3
139
+ segments:
140
+ - 0
141
+ version: "0"
142
+ requirements: []
143
+
144
+ rubyforge_project:
145
+ rubygems_version: 1.6.2
146
+ signing_key:
147
+ specification_version: 3
148
+ summary: Deploy your iOS applications with gusto!
149
+ test_files: []
150
+