xcodeide 0.1.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/LICENSE 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/README ADDED
@@ -0,0 +1 @@
1
+ = XcodeIDE
@@ -0,0 +1,44 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'rake/clean'
4
+ require 'rake/gempackagetask'
5
+ require 'rake/rdoctask'
6
+ require 'rake/testtask'
7
+
8
+ PKG_NAME = 'xcodeide'
9
+ PKG_VERSION = '0.1.0'
10
+
11
+ PKG_FILES = FileList[
12
+ '[A-Z]*',
13
+ 'lib/**/*'
14
+ ]
15
+
16
+
17
+ spec = Gem::Specification.new do |s|
18
+ s.name = PKG_NAME
19
+ s.version = PKG_VERSION
20
+ s.files = PKG_FILES
21
+
22
+ s.author = "Jared Hanson"
23
+ s.email = "jaredhanson@gmail.com"
24
+ s.homepage = "http://xcodeide.rubyforge.org/"
25
+ s.rubyforge_project = "xcodeide"
26
+
27
+ s.summary = "A Ruby library for parsing Xcode file formats."
28
+ end
29
+
30
+ Rake::GemPackageTask.new(spec) do |pkg|
31
+ pkg.gem_spec = spec
32
+ end
33
+
34
+ Rake::RDocTask.new do |rdoc|
35
+ rdoc.rdoc_dir = 'doc'
36
+ rdoc.rdoc_files.include('README')
37
+ rdoc.rdoc_files.include('lib/xcodeide.rb')
38
+ rdoc.rdoc_files.include('lib/xcodeide/**/*.rb')
39
+ end
40
+
41
+ Rake::TestTask.new do |test|
42
+ test.libs << "test"
43
+ test.test_files = FileList['test/test_suite.rb']
44
+ end
@@ -0,0 +1,2 @@
1
+ require 'vstudioide/version'
2
+ require 'vstudioide/project'
@@ -0,0 +1,30 @@
1
+ require 'xcodeide/core_ext/string'
2
+
3
+
4
+ module XcodeIDE
5
+
6
+ class ArrayNode
7
+
8
+ def initialize(io)
9
+ @array = []
10
+ parse(io)
11
+ end
12
+
13
+ private
14
+ def parse(io)
15
+ ios = IOScanner.new(io)
16
+
17
+ while delim = ios.delimit
18
+ case delim
19
+ when ?)
20
+ return
21
+ when ?,
22
+ item = ios.term.decomment.strip
23
+ @array << item
24
+ end
25
+ end
26
+ end
27
+
28
+ end
29
+
30
+ end
@@ -0,0 +1,17 @@
1
+ class String
2
+
3
+ def decomment
4
+ orig = self
5
+ subd = orig.sub(/\/\*[^\*]*\*\//, '')
6
+ subd = subd.sub(/\/\/.*\n/, '')
7
+
8
+ until orig == subd
9
+ orig = subd
10
+ subd = orig.sub(/\/\*[^\*]*\*\//, '')
11
+ subd = subd.sub(/\/\/.*\n/, '')
12
+ end
13
+
14
+ subd
15
+ end
16
+
17
+ end
@@ -0,0 +1,37 @@
1
+ module XcodeIDE
2
+
3
+ class IOScanner
4
+ TOKENS = [ ?}, ?=, ?;, ?{, ?( ].freeze
5
+ DELIMS = [ ?), ?, ].freeze
6
+
7
+ attr_reader :term
8
+
9
+ def initialize(io)
10
+ @io = io
11
+ end
12
+
13
+ def tokenize
14
+ @term = ""
15
+
16
+ while c = @io.getc
17
+ return c if TOKENS.include? c
18
+ term << c
19
+ end
20
+
21
+ return nil
22
+ end
23
+
24
+ def delimit
25
+ @term = ""
26
+
27
+ while c = @io.getc
28
+ return c if DELIMS.include? c
29
+ term << c
30
+ end
31
+
32
+ return nil
33
+ end
34
+
35
+ end
36
+
37
+ end
@@ -0,0 +1,51 @@
1
+ require 'xcodeide/core_ext/string'
2
+
3
+
4
+ module XcodeIDE
5
+
6
+ class ObjectNode
7
+
8
+ def initialize(io)
9
+ @hash = {}
10
+ parse(io)
11
+ end
12
+
13
+ def [](arg)
14
+ @hash[arg]
15
+ end
16
+
17
+ def each
18
+ @hash.each { |k, v| yield k, v }
19
+ end
20
+
21
+ def is_a
22
+ @hash['isa']
23
+ end
24
+
25
+ private
26
+ def parse(io)
27
+ ios = IOScanner.new(io)
28
+ key = nil
29
+ value = nil
30
+
31
+ while token = ios.tokenize
32
+ case token
33
+ when ?}
34
+ return
35
+ when ?=
36
+ key = ios.term.decomment.strip
37
+ value = nil
38
+ when ?{
39
+ value = ObjectNode.new(io)
40
+ when ?(
41
+ value = ArrayNode.new(io)
42
+ when ?;
43
+ value = ios.term.decomment.strip if value.nil?
44
+ @hash[key] = value
45
+ end
46
+ end
47
+ end
48
+
49
+ end
50
+
51
+ end
@@ -0,0 +1,64 @@
1
+ require 'xcodeide/io_scanner'
2
+ require 'xcodeide/obj_node'
3
+ require 'xcodeide/arr_node'
4
+
5
+
6
+ module XcodeIDE
7
+
8
+ class Project
9
+
10
+ def initialize(package)
11
+ @package = package
12
+ @file = package + '/project.pbxproj'
13
+ parse
14
+ end
15
+
16
+ def configurations
17
+ @pbx.configurations
18
+ end
19
+
20
+ private
21
+ def parse
22
+ File.open(@file) do |io|
23
+ @pbx = PBX.load(io)
24
+ end
25
+ end
26
+
27
+ end
28
+
29
+
30
+ class PBX
31
+ def self.load(io)
32
+ ios = IOScanner.new(io)
33
+
34
+ token = ios.tokenize
35
+ raise "Unable to deserialize root object." if token != ?{
36
+
37
+ pbx = PBX.new
38
+ pbx.parse(io)
39
+ pbx
40
+ end
41
+
42
+ def initialize
43
+ @root = nil
44
+ end
45
+
46
+ def configurations
47
+ configs = []
48
+
49
+ objects = @root['objects']
50
+ objects.each do |key, value|
51
+ if value.is_a == 'PBXBuildStyle' || value.is_a == 'XCBuildConfiguration'
52
+ configs << value['name']
53
+ end
54
+ end
55
+
56
+ return configs.uniq
57
+ end
58
+
59
+ def parse(io)
60
+ @root = ObjectNode.new(io)
61
+ end
62
+ end
63
+
64
+ end
@@ -0,0 +1,5 @@
1
+ module XcodeIDE
2
+
3
+ VERSION = '0.1.0'.freeze
4
+
5
+ end
metadata ADDED
@@ -0,0 +1,57 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.9.4
3
+ specification_version: 1
4
+ name: xcodeide
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.1.0
7
+ date: 2008-01-19 00:00:00 -08:00
8
+ summary: A Ruby library for parsing Xcode file formats.
9
+ require_paths:
10
+ - lib
11
+ email: jaredhanson@gmail.com
12
+ homepage: http://xcodeide.rubyforge.org/
13
+ rubyforge_project: xcodeide
14
+ description:
15
+ autorequire:
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: false
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
24
+ version:
25
+ platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ post_install_message:
29
+ authors:
30
+ - Jared Hanson
31
+ files:
32
+ - LICENSE
33
+ - Rakefile
34
+ - README
35
+ - lib/xcodeide
36
+ - lib/xcodeide/arr_node.rb
37
+ - lib/xcodeide/core_ext
38
+ - lib/xcodeide/core_ext/string.rb
39
+ - lib/xcodeide/io_scanner.rb
40
+ - lib/xcodeide/obj_node.rb
41
+ - lib/xcodeide/project.rb
42
+ - lib/xcodeide/version.rb
43
+ - lib/xcodeide.rb
44
+ test_files: []
45
+
46
+ rdoc_options: []
47
+
48
+ extra_rdoc_files: []
49
+
50
+ executables: []
51
+
52
+ extensions: []
53
+
54
+ requirements: []
55
+
56
+ dependencies: []
57
+