jaspion-miya 0.1.0 → 0.1.1
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.
- checksums.yaml +4 -4
- data/jaspion-miya.gemspec +3 -0
- data/lib/jaspion/miya.rb +0 -1
- data/lib/jaspion/miya/android/button.rb +19 -0
- data/lib/jaspion/miya/android/document.rb +18 -0
- data/lib/jaspion/miya/android/framelayout.rb +19 -0
- data/lib/jaspion/miya/android/linearlayout.rb +19 -0
- data/lib/jaspion/miya/document.rb +47 -0
- data/lib/jaspion/miya/object.rb +1 -1
- data/lib/jaspion/miya/objectivec.rb +1 -1
- data/lib/jaspion/miya/objectivec/document.rb +38 -0
- data/lib/jaspion/miya/objectivec/uicollectionview.rb +12 -0
- data/lib/jaspion/miya/objectivec/uilabel.rb +12 -0
- data/lib/jaspion/miya/objectivec/uiview.rb +12 -0
- data/lib/jaspion/miya/version.rb +1 -1
- metadata +39 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: dc2eca4df5e8b5a8c49587dcf3a19a8e4c6e69e6
         | 
| 4 | 
            +
              data.tar.gz: c192d142b44442a318358f3a7a1137c998c3c3ec
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 149a4dabd8b585e2d8c5f9122eff70e9183fca8267c13ad6e040a1647d91436706a549cfcc8fb1168ab2d80391ea86ef2f9e2c8a33f840fbdc71ea7817e92f0a
         | 
| 7 | 
            +
              data.tar.gz: a8889c486a6a54c54208048760eac6dea4e0c8db030ea4cd79ff4eda49e6c31de256ba06f64363deda698843ad8fda0c94e94f21f88e3f85ef1bbe12cb65e3aa
         | 
    
        data/jaspion-miya.gemspec
    CHANGED
    
    | @@ -33,6 +33,9 @@ Gem::Specification.new do |spec| | |
| 33 33 | 
             
              spec.add_development_dependency 'rake'
         | 
| 34 34 | 
             
              spec.add_development_dependency 'rspec'
         | 
| 35 35 | 
             
              spec.add_development_dependency 'byebug'
         | 
| 36 | 
            +
              spec.add_development_dependency 'coveralls'
         | 
| 36 37 |  | 
| 37 38 | 
             
              spec.add_dependency 'erubis'
         | 
| 39 | 
            +
              spec.add_dependency 'nokogiri'
         | 
| 40 | 
            +
             | 
| 38 41 | 
             
            end
         | 
    
        data/lib/jaspion/miya.rb
    CHANGED
    
    
| @@ -0,0 +1,19 @@ | |
| 1 | 
            +
            # Author:: Toshiro Sugii
         | 
| 2 | 
            +
            # Copyright:: Copyright (c) 2016 Toshiro Sugii
         | 
| 3 | 
            +
            # License::   Distributes under the same terms as Ruby
         | 
| 4 | 
            +
            module Jaspion
         | 
| 5 | 
            +
              module Miya
         | 
| 6 | 
            +
                class Android
         | 
| 7 | 
            +
                  # Represents an Android Button template
         | 
| 8 | 
            +
                  class Button < Miya::Android
         | 
| 9 | 
            +
                    def imports
         | 
| 10 | 
            +
                      %(import android.widget.Button;)
         | 
| 11 | 
            +
                    end
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                    def templates
         | 
| 14 | 
            +
                      nil
         | 
| 15 | 
            +
                    end
         | 
| 16 | 
            +
                  end
         | 
| 17 | 
            +
                end
         | 
| 18 | 
            +
              end
         | 
| 19 | 
            +
            end
         | 
| @@ -0,0 +1,18 @@ | |
| 1 | 
            +
            require 'jaspion/miya/document'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module Jaspion
         | 
| 4 | 
            +
              module Miya
         | 
| 5 | 
            +
                class Android
         | 
| 6 | 
            +
                  # Represents a UI xml layout
         | 
| 7 | 
            +
                  class Document < Jaspion::Miya::Document
         | 
| 8 | 
            +
                    # Nokogiri method specific for Android layout
         | 
| 9 | 
            +
                    def start_element_namespace(name, _attrs = nil, _prefix = nil, _uri = nil, _ns = nil)
         | 
| 10 | 
            +
                      unless name.nil?
         | 
| 11 | 
            +
                        clazz = Jaspion::Miya::Android.const_get(name)
         | 
| 12 | 
            +
                        @objects.push(clazz.new unless clazz.nil?
         | 
| 13 | 
            +
                      end
         | 
| 14 | 
            +
                    end
         | 
| 15 | 
            +
                  end
         | 
| 16 | 
            +
                end
         | 
| 17 | 
            +
              end
         | 
| 18 | 
            +
            end
         | 
| @@ -0,0 +1,19 @@ | |
| 1 | 
            +
            # Author:: Toshiro Sugii
         | 
| 2 | 
            +
            # Copyright:: Copyright (c) 2016 Toshiro Sugii
         | 
| 3 | 
            +
            # License::   Distributes under the same terms as Ruby
         | 
| 4 | 
            +
            module Jaspion
         | 
| 5 | 
            +
              module Miya
         | 
| 6 | 
            +
                class Android
         | 
| 7 | 
            +
                  # Represents an Android TextView template
         | 
| 8 | 
            +
                  class FrameLayout < Miya::Android
         | 
| 9 | 
            +
                    def imports
         | 
| 10 | 
            +
                      %(import android.widget.FrameLayout;)
         | 
| 11 | 
            +
                    end
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                    def templates
         | 
| 14 | 
            +
                      nil
         | 
| 15 | 
            +
                    end
         | 
| 16 | 
            +
                  end
         | 
| 17 | 
            +
                end
         | 
| 18 | 
            +
              end
         | 
| 19 | 
            +
            end
         | 
| @@ -0,0 +1,19 @@ | |
| 1 | 
            +
            # Author:: Toshiro Sugii
         | 
| 2 | 
            +
            # Copyright:: Copyright (c) 2016 Toshiro Sugii
         | 
| 3 | 
            +
            # License::   Distributes under the same terms as Ruby
         | 
| 4 | 
            +
            module Jaspion
         | 
| 5 | 
            +
              module Miya
         | 
| 6 | 
            +
                class Android
         | 
| 7 | 
            +
                  # Represents an Android TextView template
         | 
| 8 | 
            +
                  class LinearLayout < Miya::Android
         | 
| 9 | 
            +
                    def imports
         | 
| 10 | 
            +
                      %(import android.widget.LinearLayout;)
         | 
| 11 | 
            +
                    end
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                    def templates
         | 
| 14 | 
            +
                      nil
         | 
| 15 | 
            +
                    end
         | 
| 16 | 
            +
                  end
         | 
| 17 | 
            +
                end
         | 
| 18 | 
            +
              end
         | 
| 19 | 
            +
            end
         | 
| @@ -0,0 +1,47 @@ | |
| 1 | 
            +
            require 'nokogiri'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module Jaspion
         | 
| 4 | 
            +
              module Miya
         | 
| 5 | 
            +
                class Document < Nokogiri::XML::SAX::Document
         | 
| 6 | 
            +
                  FLAT = 0
         | 
| 7 | 
            +
                  TREE = 1
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                  # Array with Miya::Object objects
         | 
| 10 | 
            +
                  attr_accessor :objects
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                  # Indicates if the elements should be a flat array or hierarchy
         | 
| 13 | 
            +
                  attr_accessor :structure
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                  # Initializes a Document object and parses the xml argument if present
         | 
| 16 | 
            +
                  def initialize(xml = nil, structure = TREE)
         | 
| 17 | 
            +
                    @objects = []
         | 
| 18 | 
            +
                    @structure = structure
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                    return if xml.nil?
         | 
| 21 | 
            +
                    parse(xml)
         | 
| 22 | 
            +
                  end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                  # Replaces the current @objects variable
         | 
| 25 | 
            +
                  def parse(xml)
         | 
| 26 | 
            +
                    @objects = []
         | 
| 27 | 
            +
                    parser = Nokogiri::XML::SAX::Parser.new(self)
         | 
| 28 | 
            +
                    parser.parse(xml)
         | 
| 29 | 
            +
                    raise 'Document cannot have more than one root element' if @objects.length > 1
         | 
| 30 | 
            +
                  end
         | 
| 31 | 
            +
             | 
| 32 | 
            +
                  # Nokogiri Document method
         | 
| 33 | 
            +
                  def start_element_namespace(name, attrs = [], prefix = nil, uri = nil, ns = [])
         | 
| 34 | 
            +
                  end
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                  # Nokogiri Document method
         | 
| 37 | 
            +
                  def end_element_namespace(name, prefix = nil, uri = nil)
         | 
| 38 | 
            +
                    return if name.nil?
         | 
| 39 | 
            +
                    return if @structure == FLAT
         | 
| 40 | 
            +
                    return if @objects.length <= 1
         | 
| 41 | 
            +
             | 
| 42 | 
            +
                    last = @objects.delete(@objects.last)
         | 
| 43 | 
            +
                    @objects.last.push_child(last)
         | 
| 44 | 
            +
                  end
         | 
| 45 | 
            +
                end
         | 
| 46 | 
            +
              end
         | 
| 47 | 
            +
            end
         | 
    
        data/lib/jaspion/miya/object.rb
    CHANGED
    
    
| @@ -0,0 +1,38 @@ | |
| 1 | 
            +
            require 'jaspion/miya/document'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module Jaspion
         | 
| 4 | 
            +
              module Miya
         | 
| 5 | 
            +
                class Objectivec
         | 
| 6 | 
            +
                  # Represents a UI xml layout
         | 
| 7 | 
            +
                  class Document < Jaspion::Miya::Document
         | 
| 8 | 
            +
                    # Translate the XIB view name into UI Cocoa pattern
         | 
| 9 | 
            +
                    def valid_name?(element_name)
         | 
| 10 | 
            +
                      els = %w(
         | 
| 11 | 
            +
                        actionSheet alertView activityIndicatorView inputView
         | 
| 12 | 
            +
                        navigationBar pickerView popoverBackgroundView progressView
         | 
| 13 | 
            +
                        scrollView searchBar stackView tabBar tableView tableViewCell
         | 
| 14 | 
            +
                        tableViewHeaderCell toolbar visualEffectView webView window
         | 
| 15 | 
            +
                        view label imageView collectionView slider textField datePicker
         | 
| 16 | 
            +
                        pageControl refreshControl
         | 
| 17 | 
            +
                      )
         | 
| 18 | 
            +
                      unless els.index(element_name).nil?
         | 
| 19 | 
            +
                        element_name[0] = element_name[0].capitalize
         | 
| 20 | 
            +
                        return "UI#{element_name}"
         | 
| 21 | 
            +
                      end
         | 
| 22 | 
            +
                      nil
         | 
| 23 | 
            +
                    end
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                    # Nokogiri method specific for Objective-C layout
         | 
| 26 | 
            +
                    def start_element_namespace(name, _ = nil, _p = nil, _u = nil, _n = nil)
         | 
| 27 | 
            +
                      unless name.nil?
         | 
| 28 | 
            +
                        cl_name = valid_name?(name)
         | 
| 29 | 
            +
                        unless cl_name.nil?
         | 
| 30 | 
            +
                          clazz = Jaspion::Miya::Objectivec.const_get(cl_name)
         | 
| 31 | 
            +
                          @objects.push(clazz.new unless clazz.nil?
         | 
| 32 | 
            +
                        end
         | 
| 33 | 
            +
                      end
         | 
| 34 | 
            +
                    end
         | 
| 35 | 
            +
                  end
         | 
| 36 | 
            +
                end
         | 
| 37 | 
            +
              end
         | 
| 38 | 
            +
            end
         | 
| @@ -0,0 +1,12 @@ | |
| 1 | 
            +
            # Author:: Toshiro Sugii
         | 
| 2 | 
            +
            # Copyright:: Copyright (c) 2016 Toshiro Sugii
         | 
| 3 | 
            +
            # License::   Distributes under the same terms as Ruby
         | 
| 4 | 
            +
            module Jaspion
         | 
| 5 | 
            +
              module Miya
         | 
| 6 | 
            +
                class Objectivec
         | 
| 7 | 
            +
                  # Represents an Objective-C UICollectionView template
         | 
| 8 | 
            +
                  class UICollectionView < Miya::Objectivec
         | 
| 9 | 
            +
                  end
         | 
| 10 | 
            +
                end
         | 
| 11 | 
            +
              end
         | 
| 12 | 
            +
            end
         | 
| @@ -0,0 +1,12 @@ | |
| 1 | 
            +
            # Author:: Toshiro Sugii
         | 
| 2 | 
            +
            # Copyright:: Copyright (c) 2016 Toshiro Sugii
         | 
| 3 | 
            +
            # License::   Distributes under the same terms as Ruby
         | 
| 4 | 
            +
            module Jaspion
         | 
| 5 | 
            +
              module Miya
         | 
| 6 | 
            +
                class Objectivec
         | 
| 7 | 
            +
                  # Represents an Objective-C UILabel template
         | 
| 8 | 
            +
                  class UILabel < Miya::Objectivec
         | 
| 9 | 
            +
                  end
         | 
| 10 | 
            +
                end
         | 
| 11 | 
            +
              end
         | 
| 12 | 
            +
            end
         | 
| @@ -0,0 +1,12 @@ | |
| 1 | 
            +
            # Author:: Toshiro Sugii
         | 
| 2 | 
            +
            # Copyright:: Copyright (c) 2016 Toshiro Sugii
         | 
| 3 | 
            +
            # License::   Distributes under the same terms as Ruby
         | 
| 4 | 
            +
            module Jaspion
         | 
| 5 | 
            +
              module Miya
         | 
| 6 | 
            +
                class Objectivec
         | 
| 7 | 
            +
                  # Represents an Objective-C UIView template
         | 
| 8 | 
            +
                  class UIView < Miya::Objectivec
         | 
| 9 | 
            +
                  end
         | 
| 10 | 
            +
                end
         | 
| 11 | 
            +
              end
         | 
| 12 | 
            +
            end
         | 
    
        data/lib/jaspion/miya/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: jaspion-miya
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.1. | 
| 4 | 
            +
              version: 0.1.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - rtoshiro
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2016-07- | 
| 11 | 
            +
            date: 2016-07-28 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         | 
| @@ -66,6 +66,20 @@ dependencies: | |
| 66 66 | 
             
                - - '>='
         | 
| 67 67 | 
             
                  - !ruby/object:Gem::Version
         | 
| 68 68 | 
             
                    version: '0'
         | 
| 69 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 70 | 
            +
              name: coveralls
         | 
| 71 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 72 | 
            +
                requirements:
         | 
| 73 | 
            +
                - - '>='
         | 
| 74 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 75 | 
            +
                    version: '0'
         | 
| 76 | 
            +
              type: :development
         | 
| 77 | 
            +
              prerelease: false
         | 
| 78 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 79 | 
            +
                requirements:
         | 
| 80 | 
            +
                - - '>='
         | 
| 81 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 82 | 
            +
                    version: '0'
         | 
| 69 83 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 70 84 | 
             
              name: erubis
         | 
| 71 85 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -80,6 +94,20 @@ dependencies: | |
| 80 94 | 
             
                - - '>='
         | 
| 81 95 | 
             
                  - !ruby/object:Gem::Version
         | 
| 82 96 | 
             
                    version: '0'
         | 
| 97 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 98 | 
            +
              name: nokogiri
         | 
| 99 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 100 | 
            +
                requirements:
         | 
| 101 | 
            +
                - - '>='
         | 
| 102 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 103 | 
            +
                    version: '0'
         | 
| 104 | 
            +
              type: :runtime
         | 
| 105 | 
            +
              prerelease: false
         | 
| 106 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 107 | 
            +
                requirements:
         | 
| 108 | 
            +
                - - '>='
         | 
| 109 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 110 | 
            +
                    version: '0'
         | 
| 83 111 | 
             
            description: We have a lot of template codes available to easily generate some codes
         | 
| 84 112 | 
             
            email:
         | 
| 85 113 | 
             
            - rtoshiro@printwtf.com
         | 
| @@ -105,14 +133,23 @@ files: | |
| 105 133 | 
             
            - lib/jaspion/miya.rb
         | 
| 106 134 | 
             
            - lib/jaspion/miya/android.rb
         | 
| 107 135 | 
             
            - lib/jaspion/miya/android/activity.rb
         | 
| 136 | 
            +
            - lib/jaspion/miya/android/button.rb
         | 
| 137 | 
            +
            - lib/jaspion/miya/android/document.rb
         | 
| 138 | 
            +
            - lib/jaspion/miya/android/framelayout.rb
         | 
| 139 | 
            +
            - lib/jaspion/miya/android/linearlayout.rb
         | 
| 108 140 | 
             
            - lib/jaspion/miya/android/listview.rb
         | 
| 109 141 | 
             
            - lib/jaspion/miya/android/relativelayout.rb
         | 
| 110 142 | 
             
            - lib/jaspion/miya/android/retrofit.rb
         | 
| 111 143 | 
             
            - lib/jaspion/miya/android/textview.rb
         | 
| 112 144 | 
             
            - lib/jaspion/miya/class.rb
         | 
| 145 | 
            +
            - lib/jaspion/miya/document.rb
         | 
| 113 146 | 
             
            - lib/jaspion/miya/object.rb
         | 
| 114 147 | 
             
            - lib/jaspion/miya/objectivec.rb
         | 
| 148 | 
            +
            - lib/jaspion/miya/objectivec/document.rb
         | 
| 149 | 
            +
            - lib/jaspion/miya/objectivec/uicollectionview.rb
         | 
| 150 | 
            +
            - lib/jaspion/miya/objectivec/uilabel.rb
         | 
| 115 151 | 
             
            - lib/jaspion/miya/objectivec/uitableview.rb
         | 
| 152 | 
            +
            - lib/jaspion/miya/objectivec/uiview.rb
         | 
| 116 153 | 
             
            - lib/jaspion/miya/objectivec/uiviewcontroller.rb
         | 
| 117 154 | 
             
            - lib/jaspion/miya/swift.rb
         | 
| 118 155 | 
             
            - lib/jaspion/miya/swift/uiviewcontroller.rb
         |