Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

gemify library

  • Loading branch information...
commit 878dd04d2c780e93670c2e29469b7686d92dcd0e 1 parent 1aead2d
Sean Ho authored
Showing with 116 additions and 35 deletions.
  1. +4 −0 Gemfile
  2. +14 −0 Gemfile.lock
  3. +22 −0 LICENSE
  4. +1 −1  README.md
  5. +12 −6 Rakefile
  6. +0 −27 lib/builders/builder_helpers.rb
  7. +14 −0 lib/simple-view.rb
  8. +29 −0 lib/simple_view/builders/helpers/converters.rb
  9. 0  lib/{builders → simple_view/builders/helpers}/has_background_color.rb
  10. 0  lib/{builders → simple_view/builders/helpers}/has_color.rb
  11. 0  lib/{builders → simple_view/builders/helpers}/has_font.rb
  12. 0  lib/{builders → simple_view/builders/helpers}/has_text_color.rb
  13. 0  lib/{builders → simple_view/builders/helpers}/has_tint_color.rb
  14. 0  lib/{ → simple_view}/builders/ui_activity_indicator_view_builder.rb
  15. 0  lib/{ → simple_view}/builders/ui_button_builder.rb
  16. 0  lib/{ → simple_view}/builders/ui_control_builder.rb
  17. 0  lib/{ → simple_view}/builders/ui_image_view_builder.rb
  18. 0  lib/{ → simple_view}/builders/ui_label_builder.rb
  19. 0  lib/{ → simple_view}/builders/ui_progress_view_builder.rb
  20. 0  lib/{ → simple_view}/builders/ui_search_bar_builder.rb
  21. 0  lib/{ → simple_view}/builders/ui_segmented_control_builder.rb
  22. 0  lib/{ → simple_view}/builders/ui_slider_builder.rb
  23. 0  lib/{ → simple_view}/builders/ui_switch_builder.rb
  24. 0  lib/{ → simple_view}/builders/ui_tab_bar_builder.rb
  25. 0  lib/{ → simple_view}/builders/ui_table_view_builder.rb
  26. 0  lib/{ → simple_view}/builders/ui_table_view_cell_builder.rb
  27. 0  lib/{ → simple_view}/builders/ui_text_field_builder.rb
  28. 0  lib/{ → simple_view}/builders/ui_text_view_builder.rb
  29. 0  lib/{ → simple_view}/builders/ui_toolbar_builder.rb
  30. +1 −1  lib/{ → simple_view}/builders/ui_view_builder.rb
  31. 0  lib/{ → simple_view}/extensions/ui_color.rb
  32. 0  lib/{ → simple_view}/extensions/ui_font.rb
  33. 0  lib/{ → simple_view}/extensions/ui_view.rb
  34. 0  lib/{ → simple_view}/simple_view.rb
  35. +3 −0  lib/simple_view/version.rb
  36. +16 −0 simple_view.gemspec
View
4 Gemfile
@@ -0,0 +1,4 @@
+source 'https://rubygems.org'
+
+# Specify your gem's dependencies in gemspec
+gemspec
View
14 Gemfile.lock
@@ -0,0 +1,14 @@
+PATH
+ remote: .
+ specs:
+ simple-view (0.0.3)
+
+GEM
+ remote: https://rubygems.org/
+ specs:
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ simple-view!
View
22 LICENSE
@@ -0,0 +1,22 @@
+Copyright (c) 2012 Sean Ho
+
+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.
View
2  README.md
@@ -16,7 +16,7 @@ def viewDidLoad
UI::Layouts.setup(view) do
label width: 200, height: 20, text: "Choose your lucky word", color: "#eee"
image_view top: 50, left: 50, right: 50, image: "sample.jpg"
- toolbar anchors[:bottom]
+ toolbar anchors: [:bottom]
end
end
````
View
18 Rakefile
@@ -1,10 +1,16 @@
+#!/usr/bin/env rake
+require "bundler/gem_tasks"
+
$:.unshift("/Library/RubyMotion/lib")
require 'motion/project'
Motion::Project::App.setup do |app|
- app.name = 'SimpleView'
- app.files += Dir.glob(File.join(app.project_dir, 'lib/**/*.rb'))
- app.files_dependencies 'lib/builders/ui_activity_indicator_view_builder.rb' => 'lib/builders/ui_view_builder.rb'
- app.files_dependencies 'lib/builders/ui_control_builder.rb' => 'lib/builders/ui_view_builder.rb'
- app.files_dependencies 'lib/builders/ui_button_builder.rb' => 'lib/builders/ui_control_builder.rb'
-end
+ app.name = 'SimpleViewDemo'
+
+ app.files += Dir.glob(File.join(app.project_dir, 'lib/simple_view/*.rb'))
+ app.files.unshift(Dir.glob(File.join(app.project_dir, 'lib/simple_view/builders/*.rb')))
+ app.files.unshift(File.join(app.project_dir, 'lib/simple_view/builders/ui_control_builder.rb'))
+ app.files.unshift(File.join(app.project_dir, 'lib/simple_view/builders/ui_view_builder.rb'))
+ app.files.unshift(Dir.glob(File.join(app.project_dir, 'lib/simple_view/builders/helpers/*.rb')))
+ app.files.unshift(Dir.glob(File.join(app.project_dir, 'lib/simple_view/extensions/*.rb')))
+end
View
27 lib/builders/builder_helpers.rb
@@ -1,27 +0,0 @@
-module UI
- module BuilderHelpers
- def font_with(font)
- if font.is_a?(String)
- UIFont.parse(font)
- else
- font
- end
- end
-
- def color_with(color)
- if color.is_a?(String)
- UIColor.from_html(color)
- else
- color
- end
- end
-
- def image_with(image)
- if image.is_a?(String)
- UIImage.imageNamed(image)
- else
- image
- end
- end
- end
-end
View
14 lib/simple-view.rb
@@ -0,0 +1,14 @@
+require "simple_view/version"
+
+unless defined?(Motion::Project::Config)
+ raise "This file must be required within a RubyMotion project Rakefile."
+end
+
+Motion::Project::App.setup do |app|
+ app.files += Dir.glob(File.join(File.dirname(__FILE__), 'simple_view/*.rb'))
+ app.files.unshift(Dir.glob(File.join(File.dirname(__FILE__), 'simple_view/builders/*.rb')))
+ app.files.unshift(File.join(File.dirname(__FILE__), 'simple_view/builders/ui_control_builder.rb'))
+ app.files.unshift(File.join(File.dirname(__FILE__), 'simple_view/builders/ui_view_builder.rb'))
+ app.files.unshift(Dir.glob(File.join(File.dirname(__FILE__), 'simple_view/builders/helpers/*.rb')))
+ app.files.unshift(Dir.glob(File.join(File.dirname(__FILE__), 'simple_view/extensions/*.rb')))
+end
View
29 lib/simple_view/builders/helpers/converters.rb
@@ -0,0 +1,29 @@
+module UI
+ module Builders
+ module Converters
+ def font_with(font)
+ if font.is_a?(String)
+ UIFont.parse(font)
+ else
+ font
+ end
+ end
+
+ def color_with(color)
+ if color.is_a?(String)
+ UIColor.from_html(color)
+ else
+ color
+ end
+ end
+
+ def image_with(image)
+ if image.is_a?(String)
+ UIImage.imageNamed(image)
+ else
+ image
+ end
+ end
+ end
+ end
+end
View
0  lib/builders/has_background_color.rb → .../builders/helpers/has_background_color.rb
File renamed without changes
View
0  lib/builders/has_color.rb → ...simple_view/builders/helpers/has_color.rb
File renamed without changes
View
0  lib/builders/has_font.rb → lib/simple_view/builders/helpers/has_font.rb
File renamed without changes
View
0  lib/builders/has_text_color.rb → ...e_view/builders/helpers/has_text_color.rb
File renamed without changes
View
0  lib/builders/has_tint_color.rb → ...e_view/builders/helpers/has_tint_color.rb
File renamed without changes
View
0  ...ers/ui_activity_indicator_view_builder.rb → ...ers/ui_activity_indicator_view_builder.rb
File renamed without changes
View
0  lib/builders/ui_button_builder.rb → ...simple_view/builders/ui_button_builder.rb
File renamed without changes
View
0  lib/builders/ui_control_builder.rb → ...imple_view/builders/ui_control_builder.rb
File renamed without changes
View
0  lib/builders/ui_image_view_builder.rb → ...le_view/builders/ui_image_view_builder.rb
File renamed without changes
View
0  lib/builders/ui_label_builder.rb → lib/simple_view/builders/ui_label_builder.rb
File renamed without changes
View
0  lib/builders/ui_progress_view_builder.rb → ...view/builders/ui_progress_view_builder.rb
File renamed without changes
View
0  lib/builders/ui_search_bar_builder.rb → ...le_view/builders/ui_search_bar_builder.rb
File renamed without changes
View
0  lib/builders/ui_segmented_control_builder.rb → .../builders/ui_segmented_control_builder.rb
File renamed without changes
View
0  lib/builders/ui_slider_builder.rb → ...simple_view/builders/ui_slider_builder.rb
File renamed without changes
View
0  lib/builders/ui_switch_builder.rb → ...simple_view/builders/ui_switch_builder.rb
File renamed without changes
View
0  lib/builders/ui_tab_bar_builder.rb → ...imple_view/builders/ui_tab_bar_builder.rb
File renamed without changes
View
0  lib/builders/ui_table_view_builder.rb → ...le_view/builders/ui_table_view_builder.rb
File renamed without changes
View
0  lib/builders/ui_table_view_cell_builder.rb → ...ew/builders/ui_table_view_cell_builder.rb
File renamed without changes
View
0  lib/builders/ui_text_field_builder.rb → ...le_view/builders/ui_text_field_builder.rb
File renamed without changes
View
0  lib/builders/ui_text_view_builder.rb → ...ple_view/builders/ui_text_view_builder.rb
File renamed without changes
View
0  lib/builders/ui_toolbar_builder.rb → ...imple_view/builders/ui_toolbar_builder.rb
File renamed without changes
View
2  lib/builders/ui_view_builder.rb → lib/simple_view/builders/ui_view_builder.rb
@@ -40,6 +40,6 @@ def setValue(value, forUndefinedKey:key)
end
protected
- include UI::BuilderHelpers
+ include UI::Builders::Converters
end
end
View
0  lib/extensions/ui_color.rb → lib/simple_view/extensions/ui_color.rb
File renamed without changes
View
0  lib/extensions/ui_font.rb → lib/simple_view/extensions/ui_font.rb
File renamed without changes
View
0  lib/extensions/ui_view.rb → lib/simple_view/extensions/ui_view.rb
File renamed without changes
View
0  lib/simple_view.rb → lib/simple_view/simple_view.rb
File renamed without changes
View
3  lib/simple_view/version.rb
@@ -0,0 +1,3 @@
+module SimpleView
+ VERSION = "0.0.3"
+end
View
16 simple_view.gemspec
@@ -0,0 +1,16 @@
+# -*- encoding: utf-8 -*-
+require File.expand_path('../lib/simple_view/version', __FILE__)
+
+Gem::Specification.new do |gem|
+ gem.authors = ["Sean Ho"]
+ gem.email = ["sean.ho@conceptable.net"]
+ gem.description = "A DSL for UIKit for RubyMotion"
+ gem.summary = "A DSL for UIKit for RubyMotion"
+ gem.homepage = "https://github.com/seanho/SimpleView"
+
+ gem.files = `git ls-files`.split($\)
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
+ gem.name = "simple-view"
+ gem.require_paths = ["lib"]
+ gem.version = SimpleView::VERSION
+end
Please sign in to comment.
Something went wrong with that request. Please try again.