xcode-yamlizer 0.0.3 → 0.0.4
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/README.md +5 -1
- data/lib/xcode-yamlizer.rb +12 -19
- data/lib/xcode-yamlizer/dumpers.rb +1 -2
- data/lib/xcode-yamlizer/version.rb +1 -1
- data/xcode-yamlizer.gemspec +0 -1
- metadata +2 -18
data/README.md
CHANGED
@@ -9,7 +9,11 @@ They are pain to merge and are impossible to read. YAML is pretty.
|
|
9
9
|
Imagine a brave new world with XCode's `nib`s, model files, storyboards,
|
10
10
|
project files - all in YAML. Thats what that project do!
|
11
11
|
|
12
|
-
You can see how
|
12
|
+
You can see [how] (https://github.com/darvin/iHubot/blob/xcode-yamlizer/iHubot/iHubot.xcdatamodeld/iHubot.xcdatamodel/contents.yaml)
|
13
|
+
[pretty] (https://github.com/darvin/iHubot/blob/xcode-yamlizer/iHubot/iHubot.xcdatamodeld/.xccurrentversion.yaml)
|
14
|
+
[it] (https://github.com/darvin/iHubot/blob/xcode-yamlizer/iHubot/ViewController.xib.yaml)
|
15
|
+
[looks] (https://github.com/darvin/iHubot/blob/xcode-yamlizer/iHubot.xcodeproj/project.pbxproj.yaml)
|
16
|
+
on Github in this sample [repo](https://github.com/darvin/iHubot/blob/xcode-yamlizer/).
|
13
17
|
|
14
18
|
|
15
19
|
## Installation
|
data/lib/xcode-yamlizer.rb
CHANGED
@@ -12,7 +12,10 @@ require 'pp'
|
|
12
12
|
|
13
13
|
YAML_FORMATS = [".yaml", ".yml"]
|
14
14
|
PLIST_FORMATS = [".pbxproj"]
|
15
|
-
XML_FORMATS = [".xib", ".storyboard",
|
15
|
+
XML_FORMATS = [".xib", ".storyboard", \
|
16
|
+
/(.*).xcdatamodeld\/(.*).xcdatamodel\/contents$/, \
|
17
|
+
/(.*).xccurrentversion$/
|
18
|
+
]
|
16
19
|
|
17
20
|
|
18
21
|
XCODE_FORMATS = PLIST_FORMATS + XML_FORMATS
|
@@ -28,7 +31,7 @@ DUMPERS = [
|
|
28
31
|
module Enumerable
|
29
32
|
def include_filename?(filename)
|
30
33
|
self.each do |elem|
|
31
|
-
if elem.kind_of? Regexp and filename
|
34
|
+
if elem.kind_of? Regexp and elem.match(filename)
|
32
35
|
return true
|
33
36
|
end
|
34
37
|
end
|
@@ -62,26 +65,14 @@ end
|
|
62
65
|
|
63
66
|
|
64
67
|
def repo_add_files(files)
|
65
|
-
repo_dir = '.'
|
66
|
-
repo = Rugged::Repository.new(repo_dir)
|
67
|
-
index = repo.index
|
68
68
|
files.each do |file|
|
69
|
-
|
70
|
-
#puts "Adding: #{file}"
|
71
|
-
`git add '#{file}'`
|
72
|
-
end
|
69
|
+
`git add '#{file}'`
|
73
70
|
end
|
74
71
|
end
|
75
72
|
|
76
73
|
def repo_remove_files(files)
|
77
|
-
repo_dir = '.'
|
78
|
-
repo = Rugged::Repository.new(repo_dir)
|
79
|
-
index = repo.index
|
80
74
|
files.each do |file|
|
81
|
-
if index.get_entry(file)
|
82
|
-
#puts "Removing: #{file}"
|
83
75
|
`git rm --cached '#{file}'`
|
84
|
-
end
|
85
76
|
end
|
86
77
|
end
|
87
78
|
|
@@ -107,6 +98,7 @@ def repo_gitignore_add_files(files)
|
|
107
98
|
|
108
99
|
puts "added to .gitignore:"
|
109
100
|
puts new_ignored
|
101
|
+
repo_add_files [".gitignore"]
|
110
102
|
|
111
103
|
end
|
112
104
|
|
@@ -128,15 +120,15 @@ module XcodeYamlizer
|
|
128
120
|
formats = to_xcode ? YAML_FORMATS : XCODE_FORMATS
|
129
121
|
|
130
122
|
Find.find(dir) do |path|
|
131
|
-
name = File.basename(path)
|
132
123
|
if FileTest.directory?(path)
|
133
|
-
if ignore_paths.include?(
|
124
|
+
if ignore_paths.include?(path) or ignore_paths.include? path.gsub(/^\.\//,"")
|
125
|
+
puts "Ignored in submodule: #{path}" if verbose
|
134
126
|
Find.prune
|
135
127
|
else
|
136
128
|
next
|
137
129
|
end
|
138
130
|
else
|
139
|
-
files += [path] if formats.include_filename?
|
131
|
+
files += [path] if formats.include_filename? path
|
140
132
|
end
|
141
133
|
end
|
142
134
|
|
@@ -153,6 +145,7 @@ module XcodeYamlizer
|
|
153
145
|
result = nil
|
154
146
|
if YAML_FORMATS.include_filename? input
|
155
147
|
output = input.chomp(File.extname(input))
|
148
|
+
FileUtils.cp output, "#{output}~"
|
156
149
|
elsif XCODE_FORMATS.include_filename? input
|
157
150
|
output = "#{input}.yaml"
|
158
151
|
|
@@ -191,7 +184,7 @@ module XcodeYamlizer
|
|
191
184
|
|
192
185
|
files_remove, files_add = convert_directory('./', \
|
193
186
|
false, \
|
194
|
-
|
187
|
+
true, \
|
195
188
|
paths_to_ignore)
|
196
189
|
files_remove = make_filepaths_non_relative files_remove
|
197
190
|
files_add = make_filepaths_non_relative files_add
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'osx/plist'
|
2
2
|
require 'cobravsmongoose'
|
3
|
-
require 'ya2yaml'
|
4
3
|
require 'json'
|
5
4
|
require 'yaml'
|
5
|
+
YAML::ENGINE.yamler='syck'
|
6
6
|
|
7
7
|
class Dumper
|
8
8
|
def initialize(filename)
|
@@ -30,7 +30,6 @@ class YamlDumper < Dumper
|
|
30
30
|
if result
|
31
31
|
File.open(@filename, 'w') do |f|
|
32
32
|
f.write(result)
|
33
|
-
#f.write(object.ya2yaml(:syck_compatible => false))
|
34
33
|
end
|
35
34
|
end
|
36
35
|
end
|
data/xcode-yamlizer.gemspec
CHANGED
@@ -18,7 +18,6 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.add_runtime_dependency "args_parser"
|
19
19
|
gem.add_runtime_dependency 'kballard-osx-plist'
|
20
20
|
gem.add_runtime_dependency 'cobravsmongoose'
|
21
|
-
gem.add_runtime_dependency 'ya2yaml'
|
22
21
|
gem.add_runtime_dependency 'json'
|
23
22
|
gem.add_runtime_dependency 'rugged'
|
24
23
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xcode-yamlizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: args_parser
|
@@ -59,22 +59,6 @@ dependencies:
|
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: ya2yaml
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
|
-
requirements:
|
67
|
-
- - ! '>='
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '0'
|
70
|
-
type: :runtime
|
71
|
-
prerelease: false
|
72
|
-
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
|
-
requirements:
|
75
|
-
- - ! '>='
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: '0'
|
78
62
|
- !ruby/object:Gem::Dependency
|
79
63
|
name: json
|
80
64
|
requirement: !ruby/object:Gem::Requirement
|