bohne 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 87bc9fbca48b7429458e4510cfa98c306bfde3be
4
+ data.tar.gz: 5a0e633ad7f9e7adb98d91e57dbb2274fb2369c1
5
+ SHA512:
6
+ metadata.gz: 441ced909d6d4d90c5c4979e3b19b4191e40295dbc58ece0869ac048a7e7906b8e3577dcb570051cab811b1554efca213b11e152c5f6a73537c18030b6bacb7f
7
+ data.tar.gz: 151f2adbcb27963e2b31481be1842f7de03876150c7a2deaf2318de7d526187bdd06127d9686c2e0696c05fe1c7b8b76cb87b726644de73e4ae91fc39d05dae3
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ before_install: gem install bundler -v 1.10.6
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem 'bacon'
7
+ gem 'mocha-on-bacon'
8
+ gem 'mocha', '~> 0.11.4'
9
+ gem 'prettybacon'
10
+ gem 'coveralls', require: false
11
+ end
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Boris Bügling
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,19 @@
1
+ # Bohne
2
+
3
+ This gem will convert your iOS NIBs to tvOS ones.
4
+
5
+ ## Usage
6
+
7
+ ```shell
8
+ $ bohne iOS.xib tvOS.xib
9
+ ```
10
+
11
+ ## Installation
12
+
13
+ Install it yourself as:
14
+
15
+ $ gem install bohne
16
+
17
+ ## License
18
+
19
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -0,0 +1,12 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ def specs(dir)
4
+ FileList["spec/#{dir}/*_spec.rb"].shuffle.join(' ')
5
+ end
6
+
7
+ desc 'Runs all the specs'
8
+ task :spec do
9
+ sh "bundle exec bacon #{specs('**')}"
10
+ end
11
+
12
+ task default: :spec
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ if $PROGRAM_NAME == __FILE__
4
+ ENV['BUNDLE_GEMFILE'] = File.expand_path('../../Gemfile', __FILE__)
5
+ require 'rubygems'
6
+ require 'bundler/setup'
7
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
8
+ end
9
+
10
+ require 'bohne'
11
+
12
+ unless ARGV.count >= 2
13
+ puts 'Usage: bohne [source] [destination]'
14
+ exit(1)
15
+ end
16
+
17
+ Bohne::Bohne.convert(ARGV[0], ARGV[1])
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'bohne/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "bohne"
8
+ spec.version = Bohne::VERSION
9
+ spec.authors = ["Boris Bügling"]
10
+ spec.email = ["boris@icculus.org"]
11
+
12
+ spec.summary = %q{This gem will convert your iOS NIBs to tvOS ones.}
13
+ spec.homepage = "https://github.com/neonichu/bohne"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = "bin"
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.10"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ end
@@ -0,0 +1,45 @@
1
+ require "bohne/version"
2
+ require "rexml/document"
3
+
4
+ module Bohne
5
+ class Bohne
6
+ def self.convert(source, destination)
7
+ input = Bohne.new(source)
8
+ input.write(destination)
9
+ end
10
+
11
+ def initialize(path)
12
+ @doc = doc = REXML::Document.new(File.new(path))
13
+
14
+ document = doc.elements['document']
15
+
16
+ document.attributes['targetRuntime'] = 'AppleTV'
17
+ document.attributes['type'] = 'com.apple.InterfaceBuilder.AppleTV.XIB'
18
+ document.attributes['useTraitCollections'] = nil
19
+
20
+ document.elements['dependencies'].elements['deployment'].remove
21
+
22
+ rootView = document.elements['objects'].elements['view']
23
+ rootViewRect = rootView.elements['rect']
24
+ rootViewRect.attributes['width'] = '1920'
25
+ rootViewRect.attributes['height'] = '1080'
26
+ end
27
+
28
+ def to_s
29
+ formatter = REXML::Formatters::Pretty.new(2)
30
+ formatter.compact = false
31
+ out = ''
32
+ formatter.write(@doc, out)
33
+ out.gsub!("<?xml version='1.0' encoding='UTF-8'?>", '<?xml version="1.0" encoding="UTF-8"?>')
34
+ out.gsub!("'", '"')
35
+ out << "\n"
36
+ out
37
+ end
38
+
39
+ def write(path)
40
+ File.open(path, 'w') do |f|
41
+ f.write(to_s)
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,3 @@
1
+ module Bohne
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bohne
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Boris Bügling
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-11-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description:
42
+ email:
43
+ - boris@icculus.org
44
+ executables:
45
+ - bohne
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - ".gitignore"
50
+ - ".travis.yml"
51
+ - Gemfile
52
+ - LICENSE.txt
53
+ - README.md
54
+ - Rakefile
55
+ - bin/bohne
56
+ - bohne.gemspec
57
+ - lib/bohne.rb
58
+ - lib/bohne/version.rb
59
+ homepage: https://github.com/neonichu/bohne
60
+ licenses:
61
+ - MIT
62
+ metadata: {}
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ requirements: []
78
+ rubyforge_project:
79
+ rubygems_version: 2.0.14
80
+ signing_key:
81
+ specification_version: 4
82
+ summary: This gem will convert your iOS NIBs to tvOS ones.
83
+ test_files: []
84
+ has_rdoc: