xcode 0.0.1

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/.tmignore ADDED
@@ -0,0 +1 @@
1
+ /*.gemspec
data/LICENSE-xcodeide ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2007 Jared Hanson
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Ivan Kuchin
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.md ADDED
@@ -0,0 +1,9 @@
1
+ # xcode
2
+
3
+ Rake tasks to help packaging products made with Xcode.
4
+
5
+ Includes modified xcodeide gem by Jared Hanson.
6
+
7
+ ## Copyright
8
+
9
+ Copyright (c) 2011 Ivan Kuchin. See LICENSE.txt for details.
data/Rakefile ADDED
@@ -0,0 +1,19 @@
1
+ require 'rake'
2
+ require 'jeweler'
3
+ require 'rake/gem_ghost_task'
4
+
5
+ name = 'xcode'
6
+
7
+ Jeweler::Tasks.new do |gem|
8
+ gem.name = name
9
+ gem.summary = %Q{Rake tasks to deploy xcode project}
10
+ gem.homepage = "http://github.com/toy/#{name}"
11
+ gem.license = 'MIT'
12
+ gem.authors = ['Ivan Kuchin']
13
+ gem.add_runtime_dependency 'plist'
14
+ gem.add_runtime_dependency 'fspath'
15
+ gem.add_development_dependency 'jeweler', '~> 1.5.2'
16
+ gem.add_development_dependency 'rake-gem-ghost'
17
+ end
18
+ Jeweler::RubygemsDotOrgTasks.new
19
+ Rake::GemGhostTask.new
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
data/lib/xcode.rb ADDED
@@ -0,0 +1,3 @@
1
+ module Xcode
2
+ autoload :Tasks, 'xcode/tasks'
3
+ end
@@ -0,0 +1,40 @@
1
+ require 'fspath'
2
+
3
+ module Xcode
4
+ class Project
5
+ autoload :PlistChanger, 'xcode/project/plist_changer'
6
+ autoload :Version, 'xcode/project/version'
7
+ autoload :Build, 'xcode/project/build'
8
+ autoload :Config, 'xcode/project/config'
9
+
10
+ attr_reader :path
11
+ def initialize(path)
12
+ @path = FSPath(path)
13
+ end
14
+
15
+ def name
16
+ path.basename(path.extname).to_s
17
+ end
18
+
19
+ def variables
20
+ @variables ||= {}
21
+ end
22
+
23
+ attr_writer :configuration
24
+ def configuration
25
+ @configuration ||= 'Release'
26
+ end
27
+
28
+ def version
29
+ Version.new
30
+ end
31
+
32
+ def build
33
+ Build.new
34
+ end
35
+
36
+ def config
37
+ Config.new(path)
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,29 @@
1
+ require 'plist'
2
+
3
+ module Xcode
4
+ class Project
5
+ class Build < PlistChanger
6
+ attr_reader :number
7
+
8
+ KEY = 'CFBundleVersion'
9
+
10
+ def to_s
11
+ number.to_s
12
+ end
13
+
14
+ def set(string)
15
+ if /^(\d+)/ =~ string
16
+ @number = $1.to_i
17
+ self
18
+ else
19
+ raise "Can't parse build #{string.inspect}"
20
+ end
21
+ end
22
+
23
+ def increment
24
+ @number += 1
25
+ self
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ require 'fspath'
2
+
3
+ module Xcode
4
+ class Project
5
+ class Config
6
+ autoload :Decomment, 'xcode/project/config/decomment'
7
+ autoload :IOScanner, 'xcode/project/config/io_scanner'
8
+ autoload :ObjectNode, 'xcode/project/config/object_node'
9
+ autoload :ArrayNode, 'xcode/project/config/array_node'
10
+
11
+ attr_reader :path, :pbxproj_path, :root
12
+ def initialize(path)
13
+ @path = FSPath(path)
14
+ @pbxproj_path = path / 'project.pbxproj'
15
+ parse
16
+ end
17
+
18
+ def parse
19
+ @root = nil
20
+ File.open(pbxproj_path) do |io|
21
+ ios = IOScanner.new(io)
22
+ token = ios.tokenize
23
+ raise 'Unable to deserialize root object.' if token != ?{
24
+ @root = ObjectNode.new(io)
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,23 @@
1
+ module Xcode
2
+ class Project
3
+ class Config
4
+ class ArrayNode < Array
5
+ include Decomment
6
+
7
+ def initialize(io)
8
+ ios = IOScanner.new(io)
9
+
10
+ while delim = ios.delimit
11
+ case delim
12
+ when ?)
13
+ return
14
+ when ?,
15
+ item = decomment(ios.term)
16
+ self << item
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,11 @@
1
+ module Xcode
2
+ class Project
3
+ class Config
4
+ module Decomment
5
+ def decomment(string)
6
+ string.gsub(/\/\/(.*)\n/, '').gsub(/\/\*(.*?)\*\//m, '').strip
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,38 @@
1
+ module Xcode
2
+ class Project
3
+ class Config
4
+ class IOScanner
5
+ TOKENS = [ ?}, ?=, ?;, ?{, ?( ].freeze
6
+ DELIMS = [ ?), ?, ].freeze
7
+
8
+ attr_reader :term
9
+
10
+ def initialize(io)
11
+ @io = io
12
+ end
13
+
14
+ def tokenize
15
+ @term = ''
16
+
17
+ while c = @io.getc
18
+ return c if TOKENS.include? c
19
+ term << c
20
+ end
21
+
22
+ return nil
23
+ end
24
+
25
+ def delimit
26
+ @term = ''
27
+
28
+ while c = @io.getc
29
+ return c if DELIMS.include? c
30
+ term << c
31
+ end
32
+
33
+ return nil
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,36 @@
1
+ module Xcode
2
+ class Project
3
+ class Config
4
+ class ObjectNode < Hash
5
+ include Decomment
6
+
7
+ def initialize(io)
8
+ ios = IOScanner.new(io)
9
+ key = nil
10
+ value = nil
11
+
12
+ while token = ios.tokenize
13
+ case token
14
+ when ?}
15
+ return
16
+ when ?=
17
+ key = decomment(ios.term)
18
+ value = nil
19
+ when ?{
20
+ value = ObjectNode.new(io)
21
+ when ?(
22
+ value = ArrayNode.new(io)
23
+ when ?;
24
+ value = decomment(ios.term) if value.nil?
25
+ self[key] = value
26
+ end
27
+ end
28
+ end
29
+
30
+ def isa
31
+ self['isa']
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,34 @@
1
+ require 'plist'
2
+
3
+ module Xcode
4
+ class Project
5
+ class PlistChanger
6
+ attr_reader :plist_path
7
+
8
+ def initialize(plist_path = 'Info.plist')
9
+ @plist_path = plist_path
10
+ read
11
+ end
12
+
13
+ def read
14
+ set(plist[key])
15
+ end
16
+
17
+ def write
18
+ plist.tap do |plist|
19
+ plist[key] = to_s
20
+ end.save_plist(plist_path)
21
+ end
22
+
23
+ private
24
+
25
+ def key
26
+ self.class.const_get(:KEY)
27
+ end
28
+
29
+ def plist
30
+ Plist::parse_xml(plist_path)
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,41 @@
1
+ require 'plist'
2
+
3
+ module Xcode
4
+ class Project
5
+ class Version < PlistChanger
6
+ attr_reader :major, :minor, :patch
7
+
8
+ KEY = 'CFBundleShortVersionString'
9
+
10
+ def to_s
11
+ "#{major}.#{minor}.#{patch}".sub(/\.0/, '')
12
+ end
13
+
14
+ def set(string)
15
+ if /^(\d+)(?:\.(\d+)(?:\.(\d+))?)?/ =~ string
16
+ @major, @minor, @patch = $1.to_i, $2.to_i, $3.to_i
17
+ self
18
+ else
19
+ raise "Can't parse version #{string.inspect}"
20
+ end
21
+ end
22
+
23
+ def bump_major
24
+ @major += 1
25
+ @minor, @patch = 0, 0
26
+ self
27
+ end
28
+
29
+ def bump_minor
30
+ @minor += 1
31
+ @patch = 0
32
+ self
33
+ end
34
+
35
+ def bump_patch
36
+ @patch += 1
37
+ self
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,100 @@
1
+ require 'fspath'
2
+
3
+ module Xcode
4
+ class Tasks
5
+ autoload :Project, 'xcode/project'
6
+
7
+ attr_reader :project
8
+
9
+ def initialize(project_name = nil, &block)
10
+ project_path = FSPath("#{project_name || File.basename(Dir.pwd)}.xcodeproj")
11
+ abort "project #{project_path} not found" unless project_path.directory?
12
+ @project = Project.new(project_path)
13
+ block.call(project)
14
+ define_tasks
15
+ end
16
+
17
+ def define_tasks
18
+ return if @defined_tasks
19
+ @defined_tasks = true
20
+
21
+ desc 'build'
22
+ task :build do
23
+ arguments = %w[xcodebuild]
24
+ arguments += %W[-project #{project.path}]
25
+ arguments += %W[-configuration #{project.configuration}]
26
+ arguments += project.variables.map{ |key, value| "#{key}=#{value}" }
27
+ arguments += %w[clean build]
28
+
29
+ sh *arguments
30
+ end
31
+
32
+ desc 'pack'
33
+ task :pack do
34
+ pkg_dir = FSPath('pkg')
35
+ pack_path = pkg_dir + "#{project.name}-#{project.version}.zip"
36
+ if pack_path.exist?
37
+ abort "#{pack_path} already exists"
38
+ else
39
+ Rake::Task['build'].invoke
40
+
41
+ products = []
42
+ objects = project.config.root['objects']
43
+ objects.each do |_, object|
44
+ if reference = object['productReference']
45
+ products << objects[reference]['path']
46
+ end
47
+ end
48
+
49
+ arguments = %w[ditto -c -k]
50
+ arguments += products.map{ |product| FSPath('build') / project.configuration / product }.select(&:exist?)
51
+ arguments << pack_path
52
+
53
+ sh *arguments
54
+ end
55
+ end
56
+
57
+ desc 'current version'
58
+ task :version do
59
+ puts project.version
60
+ end
61
+
62
+ namespace :version do
63
+ desc 'write version specified using VERSION variable'
64
+ task :write do
65
+ version = project.version
66
+ if version.set(ENV['VERSION']).write
67
+ $stderr.puts "Wrote version #{version}"
68
+ end
69
+ end
70
+
71
+ namespace :bump do
72
+ %w[major minor patch].each do |level|
73
+ desc "bump #{level}"
74
+ task level do
75
+ version = project.version
76
+ if version.send("bump_#{level}").write
77
+ $stderr.puts "Bumped version to #{version}"
78
+ end
79
+ end
80
+ end
81
+ end
82
+ end
83
+
84
+ desc 'current build number'
85
+ task :build do
86
+ puts project.build
87
+ end
88
+
89
+ namespace :build do
90
+ desc 'increment build number'
91
+ task :increment do
92
+ build = project.build
93
+ if build.increment.write
94
+ $stderr.puts "Incremented build number to #{build}"
95
+ end
96
+ end
97
+ end
98
+ end
99
+ end
100
+ end
data/xcode.gemspec ADDED
@@ -0,0 +1,65 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{xcode}
8
+ s.version = "0.0.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Ivan Kuchin"]
12
+ s.date = %q{2011-02-01}
13
+ s.extra_rdoc_files = [
14
+ "LICENSE-xcodeide",
15
+ "LICENSE.txt",
16
+ "README.md"
17
+ ]
18
+ s.files = [
19
+ ".tmignore",
20
+ "LICENSE-xcodeide",
21
+ "LICENSE.txt",
22
+ "README.md",
23
+ "Rakefile",
24
+ "VERSION",
25
+ "lib/xcode.rb",
26
+ "lib/xcode/project.rb",
27
+ "lib/xcode/project/build.rb",
28
+ "lib/xcode/project/config.rb",
29
+ "lib/xcode/project/config/array_node.rb",
30
+ "lib/xcode/project/config/decomment.rb",
31
+ "lib/xcode/project/config/io_scanner.rb",
32
+ "lib/xcode/project/config/object_node.rb",
33
+ "lib/xcode/project/plist_changer.rb",
34
+ "lib/xcode/project/version.rb",
35
+ "lib/xcode/tasks.rb",
36
+ "xcode.gemspec"
37
+ ]
38
+ s.homepage = %q{http://github.com/toy/xcode}
39
+ s.licenses = ["MIT"]
40
+ s.require_paths = ["lib"]
41
+ s.rubygems_version = %q{1.4.1}
42
+ s.summary = %q{Rake tasks to deploy xcode project}
43
+
44
+ if s.respond_to? :specification_version then
45
+ s.specification_version = 3
46
+
47
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
48
+ s.add_runtime_dependency(%q<plist>, [">= 0"])
49
+ s.add_runtime_dependency(%q<fspath>, [">= 0"])
50
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
51
+ s.add_development_dependency(%q<rake-gem-ghost>, [">= 0"])
52
+ else
53
+ s.add_dependency(%q<plist>, [">= 0"])
54
+ s.add_dependency(%q<fspath>, [">= 0"])
55
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
56
+ s.add_dependency(%q<rake-gem-ghost>, [">= 0"])
57
+ end
58
+ else
59
+ s.add_dependency(%q<plist>, [">= 0"])
60
+ s.add_dependency(%q<fspath>, [">= 0"])
61
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
62
+ s.add_dependency(%q<rake-gem-ghost>, [">= 0"])
63
+ end
64
+ end
65
+
metadata ADDED
@@ -0,0 +1,143 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: xcode
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Ivan Kuchin
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-02-01 00:00:00 +03: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
+ - 0
32
+ version: "0"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: fspath
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
46
+ version: "0"
47
+ type: :runtime
48
+ version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ name: jeweler
51
+ prerelease: false
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ~>
56
+ - !ruby/object:Gem::Version
57
+ hash: 7
58
+ segments:
59
+ - 1
60
+ - 5
61
+ - 2
62
+ version: 1.5.2
63
+ type: :development
64
+ version_requirements: *id003
65
+ - !ruby/object:Gem::Dependency
66
+ name: rake-gem-ghost
67
+ prerelease: false
68
+ requirement: &id004 !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ hash: 3
74
+ segments:
75
+ - 0
76
+ version: "0"
77
+ type: :development
78
+ version_requirements: *id004
79
+ description:
80
+ email:
81
+ executables: []
82
+
83
+ extensions: []
84
+
85
+ extra_rdoc_files:
86
+ - LICENSE-xcodeide
87
+ - LICENSE.txt
88
+ - README.md
89
+ files:
90
+ - .tmignore
91
+ - LICENSE-xcodeide
92
+ - LICENSE.txt
93
+ - README.md
94
+ - Rakefile
95
+ - VERSION
96
+ - lib/xcode.rb
97
+ - lib/xcode/project.rb
98
+ - lib/xcode/project/build.rb
99
+ - lib/xcode/project/config.rb
100
+ - lib/xcode/project/config/array_node.rb
101
+ - lib/xcode/project/config/decomment.rb
102
+ - lib/xcode/project/config/io_scanner.rb
103
+ - lib/xcode/project/config/object_node.rb
104
+ - lib/xcode/project/plist_changer.rb
105
+ - lib/xcode/project/version.rb
106
+ - lib/xcode/tasks.rb
107
+ - xcode.gemspec
108
+ has_rdoc: true
109
+ homepage: http://github.com/toy/xcode
110
+ licenses:
111
+ - MIT
112
+ post_install_message:
113
+ rdoc_options: []
114
+
115
+ require_paths:
116
+ - lib
117
+ required_ruby_version: !ruby/object:Gem::Requirement
118
+ none: false
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ hash: 3
123
+ segments:
124
+ - 0
125
+ version: "0"
126
+ required_rubygems_version: !ruby/object:Gem::Requirement
127
+ none: false
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ hash: 3
132
+ segments:
133
+ - 0
134
+ version: "0"
135
+ requirements: []
136
+
137
+ rubyforge_project:
138
+ rubygems_version: 1.4.1
139
+ signing_key:
140
+ specification_version: 3
141
+ summary: Rake tasks to deploy xcode project
142
+ test_files: []
143
+