Permalink
Browse files

Add license, generate a very, very simple plist

  • Loading branch information...
1 parent 352c832 commit a941aa9c9a7289fa0f97d10c53e5de01376087f9 @qrush committed Sep 9, 2012
Showing with 38 additions and 122 deletions.
  1. +22 −22 LICENSE
  2. +3 −0 lib/motion/settings.rb
  3. +7 −97 lib/motion/settings/generator.rb
  4. +6 −3 motion-settings.gemspec
View
@@ -1,22 +1,22 @@
-Copyright (c) 2012 Nick Quaranto
-
-MIT License
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+Copyright (c) 2012, Nick Quaranto
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
@@ -3,6 +3,9 @@
end
require "fileutils"
+
+require "plist"
+
require "motion/settings/generator"
require "motion/settings/version"
@@ -26,103 +26,13 @@ def generate
plist_file_path = File.join(@root_path, "Root.plist")
file plist_file_path do |file|
- file.write <<-EOF
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>Title</key>
- <string>Settings</string>
- <key>StringsTable</key>
- <string>Root</string>
- <key>PreferenceSpecifiers</key>
- <array>
- <dict>
- <key>Type</key>
- <string>PSTextFieldSpecifier</string>
- <key>Title</key>
- <string>Text Entry</string>
- <key>Key</key>
- <string>textEntry_key</string>
- <key>DefaultValue</key>
- <string>Simple Text</string>
- <key>IsSecure</key>
- <false/>
- <key>KeyboardType</key>
- <string>Alphabet</string>
- <key>AutoCapitalizationType</key>
- <string>Sentences</string>
- <key>AutocorrectionType</key>
- <string>Default</string>
- </dict>
- <dict>
- <key>Title</key>
- <string>Read Only</string>
- <key>Key</key>
- <string>readOnly_key</string>
- <key>DefaultValue</key>
- <string>Read Only Value</string>
- <key>Type</key>
- <string>PSTitleValueSpecifier</string>
- </dict>
- <dict>
- <key>Type</key>
- <string>PSToggleSwitchSpecifier</string>
- <key>Title</key>
- <string>Toogle</string>
- <key>Key</key>
- <string>toogle_key</string>
- <key>DefaultValue</key>
- <string>YES</string>
- <key>TrueValue</key>
- <string>YES</string>
- <key>FalseValue</key>
- <string>YES</string>
- </dict>
- <dict>
- <key>Type</key>
- <string>PSSliderSpecifier</string>
- <key>Key</key>
- <string>slider_key</string>
- <key>DefaultValue</key>
- <integer>1</integer>
- <key>MinimumValue</key>
- <integer>1</integer>
- <key>MaximumValue</key>
- <integer>100</integer>
- </dict>
- <dict>
- <key>Type</key>
- <string>PSGroupSpecifier</string>
- <key>Title</key>
- <string>Group2</string>
- </dict>
- <dict>
- <key>Type</key>
- <string>PSMultiValueSpecifier</string>
- <key>Title</key>
- <string>Colors</string>
- <key>Key</key>
- <string>colors_key</string>
- <key>DefaultValue</key>
- <string>1</string>
- <key>Values</key>
- <array>
- <string>1</string>
- <string>2</string>
- <string>3</string>
- </array>
- <key>Titles</key>
- <array>
- <string>Blue</string>
- <string>Red</string>
- <string>Green</string>
- </array>
- </dict>
- </array>
-</dict>
-</plist>
-EOF
+ file.write({
+ "Title" => "Settings",
+ "StringsTable" => "Root",
+ "PreferenceSpecifiers" => [
+ {"Title" => "Read Only", "Key" => "readonlykey", "DefaultValue" => "Read Only Duh", "Type" => "PSTitleValueSpecifier"}
+ ]
+ }.to_plist)
end
end
@@ -4,14 +4,17 @@ require File.expand_path('../lib/motion/settings/version', __FILE__)
Gem::Specification.new do |gem|
gem.authors = ["Nick Quaranto"]
gem.email = ["nick@quaran.to"]
- gem.description = %q{TODO: Write a gem description}
- gem.summary = %q{TODO: Write a gem summary}
- gem.homepage = ""
+ gem.summary = gem.description =
+ %{Create a Settings.bundle for your RubyMotion app. This allows your app to have a "global" settings entry in the Settings app.}
+ gem.homepage = "https://github.com/qrush/motion-settings"
gem.files = `git ls-files`.split($\)
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.name = "motion-settings"
gem.require_paths = ["lib"]
gem.version = Motion::Settings::VERSION
+
+ gem.add_dependency 'plist', '~> 3.1.0'
+ gem.add_development_dependency 'rake'
end

0 comments on commit a941aa9

Please sign in to comment.