tagutils 0.2.1 → 0.2.2
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/Manifest.txt +1 -0
- data/lib/tagutils.rb +0 -11
- data/lib/tagutils/categories/schema.rb +3 -5
- data/lib/tagutils/tags.rb +1 -0
- data/lib/tagutils/tags/models/tag.rb +1 -2
- data/lib/tagutils/tags/patterns.rb +37 -0
- data/lib/tagutils/tags/schema.rb +3 -5
- data/lib/tagutils/version.rb +2 -1
- metadata +16 -13
    
        data/Manifest.txt
    CHANGED
    
    | @@ -14,6 +14,7 @@ lib/tagutils/tags/active_record.rb | |
| 14 14 | 
             
            lib/tagutils/tags/models/tag.rb
         | 
| 15 15 | 
             
            lib/tagutils/tags/models/tag_comp.rb
         | 
| 16 16 | 
             
            lib/tagutils/tags/models/tagging.rb
         | 
| 17 | 
            +
            lib/tagutils/tags/patterns.rb
         | 
| 17 18 | 
             
            lib/tagutils/tags/readers/tag.rb
         | 
| 18 19 | 
             
            lib/tagutils/tags/schema.rb
         | 
| 19 20 | 
             
            lib/tagutils/version.rb
         | 
    
        data/lib/tagutils.rb
    CHANGED
    
    | @@ -13,17 +13,6 @@ require 'textutils' | |
| 13 13 | 
             
            #   move props/db  - Props.create_from_fixture! to textutils/db
         | 
| 14 14 | 
             
            #    require 'textutils/db'
         | 
| 15 15 |  | 
| 16 | 
            -
            #######################
         | 
| 17 | 
            -
            # fix/remove once removed from HashReaderV2
         | 
| 18 | 
            -
             | 
| 19 | 
            -
            module WorldDb
         | 
| 20 | 
            -
              module Model
         | 
| 21 | 
            -
                Prop = ConfDb::Model::Prop
         | 
| 22 | 
            -
              end
         | 
| 23 | 
            -
              Models = Model
         | 
| 24 | 
            -
            end
         | 
| 25 | 
            -
             | 
| 26 | 
            -
             | 
| 27 16 |  | 
| 28 17 | 
             
            # our own code
         | 
| 29 18 |  | 
| @@ -2,9 +2,10 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            module CategoryDb
         | 
| 4 4 |  | 
| 5 | 
            -
            class CreateDb | 
| 5 | 
            +
            class CreateDb
         | 
| 6 6 |  | 
| 7 7 | 
             
              def up
         | 
| 8 | 
            +
            ActiveRecord::Schema.define do
         | 
| 8 9 |  | 
| 9 10 | 
             
            create_table :categories do |t|
         | 
| 10 11 | 
             
              t.string     :key,   null: false
         | 
| @@ -33,13 +34,10 @@ add_index :categorizations, :category_id, name: 'categorizations_cats_idx' | |
| 33 34 | 
             
            add_index :categorizations, [:categorizable_id, :categorizable_type], name: 'categorizations_idx'
         | 
| 34 35 | 
             
            add_index :categorizations, [:categorizable_id, :categorizable_type, :category_id], unique: true, name: 'categorizations_unique_idx'
         | 
| 35 36 |  | 
| 37 | 
            +
            end # Schema.define
         | 
| 36 38 | 
             
              end # method up
         | 
| 37 39 |  | 
| 38 40 |  | 
| 39 | 
            -
              def down
         | 
| 40 | 
            -
                raise ActiveRecord::IrreversibleMigration
         | 
| 41 | 
            -
              end
         | 
| 42 | 
            -
             | 
| 43 41 | 
             
            end  # class CreateDb
         | 
| 44 42 |  | 
| 45 43 | 
             
            end # module CategoryDb
         | 
    
        data/lib/tagutils/tags.rb
    CHANGED
    
    
| @@ -9,8 +9,7 @@ class Tag < ActiveRecord::Base | |
| 9 9 |  | 
| 10 10 | 
             
                ## nb: only allow spaces and underscore inbetween;
         | 
| 11 11 | 
             
                ##  do NOT allow digit as first char for now
         | 
| 12 | 
            -
                validates :key, | 
| 13 | 
            -
                                              :message => 'expected one or more lowercase letters a-z or 0-9 digits or space or underscore' }
         | 
| 12 | 
            +
                validates :key, format: { with: /#{TAG_KEY_PATTERN}/, message: TAG_KEY_PATTERN_MESSAGE }
         | 
| 14 13 |  | 
| 15 14 | 
             
                scope :by_key,   -> { order( 'key desc' )  }
         | 
| 16 15 | 
             
                scope :by_name,  -> { order( 'name desc' ) }
         | 
| @@ -0,0 +1,37 @@ | |
| 1 | 
            +
            # encoding: utf-8
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module TagDb
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            # collection of regex patterns for reuse (TagDb specific)
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            ### todo: add a patterns.md page to  github ??
         | 
| 8 | 
            +
            ##  - add regexper pics??
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            ############
         | 
| 11 | 
            +
            # about ruby regexps
         | 
| 12 | 
            +
            #
         | 
| 13 | 
            +
            # try the rubular - Ruby regular expression editor and tester
         | 
| 14 | 
            +
            #  -> http://rubular.com
         | 
| 15 | 
            +
            #   code -> ??  by ??
         | 
| 16 | 
            +
            #
         | 
| 17 | 
            +
            #
         | 
| 18 | 
            +
            # Jeff Avallone's Regexper - Shows State-Automata Diagrams
         | 
| 19 | 
            +
            #  try -> http://regexper.com
         | 
| 20 | 
            +
            #    code -> https://github.com/javallone/regexper
         | 
| 21 | 
            +
            #
         | 
| 22 | 
            +
            #
         | 
| 23 | 
            +
            #  Regular Expressions | The Bastards Book of Ruby by Dan Nguyen
         | 
| 24 | 
            +
            # http://ruby.bastardsbook.com/chapters/regexes/
         | 
| 25 | 
            +
            #
         | 
| 26 | 
            +
            # move to notes  regex|patterns on  geraldb.github.io ??
         | 
| 27 | 
            +
            #
         | 
| 28 | 
            +
             | 
| 29 | 
            +
             | 
| 30 | 
            +
              ## nb: only allow spaces and underscore inbetween;
         | 
| 31 | 
            +
              ##  do NOT allow digit as first char for now
         | 
| 32 | 
            +
              TAG_KEY_PATTERN = '\A(?:[a-z]|[a-z][a-z0-9_ ]*[a-z0-9])\z'
         | 
| 33 | 
            +
              TAG_KEY_PATTERN_MESSAGE = "expected one or more lowercase letters a-z or 0-9 digits or space or underscore /#{TAG_KEY_PATTERN}/"
         | 
| 34 | 
            +
             | 
| 35 | 
            +
             | 
| 36 | 
            +
            end # module TagDb
         | 
| 37 | 
            +
             | 
    
        data/lib/tagutils/tags/schema.rb
    CHANGED
    
    | @@ -2,9 +2,10 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            module TagDb
         | 
| 4 4 |  | 
| 5 | 
            -
            class CreateDb | 
| 5 | 
            +
            class CreateDb
         | 
| 6 6 |  | 
| 7 7 | 
             
              def up
         | 
| 8 | 
            +
            ActiveRecord::Schema.define do
         | 
| 8 9 |  | 
| 9 10 | 
             
            create_table :tags do |t|
         | 
| 10 11 | 
             
              t.string  :key,   null: false
         | 
| @@ -33,13 +34,10 @@ add_index :taggings, :tag_id | |
| 33 34 | 
             
            add_index :taggings, [:taggable_id, :taggable_type]
         | 
| 34 35 | 
             
            add_index :taggings, [:taggable_id, :taggable_type, :tag_id], unique: true
         | 
| 35 36 |  | 
| 37 | 
            +
            end # Schema.define
         | 
| 36 38 | 
             
              end # method up
         | 
| 37 39 |  | 
| 38 40 |  | 
| 39 | 
            -
              def down
         | 
| 40 | 
            -
                raise ActiveRecord::IrreversibleMigration
         | 
| 41 | 
            -
              end
         | 
| 42 | 
            -
             | 
| 43 41 | 
             
            end  # class CreateDb
         | 
| 44 42 |  | 
| 45 43 | 
             
            end # module TagDb
         | 
    
        data/lib/tagutils/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: tagutils
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.2. | 
| 4 | 
            +
              version: 0.2.2
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -9,11 +9,11 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2014- | 
| 12 | 
            +
            date: 2014-04-14 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: activerecord
         | 
| 16 | 
            -
              requirement: & | 
| 16 | 
            +
              requirement: &75986000 !ruby/object:Gem::Requirement
         | 
| 17 17 | 
             
                none: false
         | 
| 18 18 | 
             
                requirements:
         | 
| 19 19 | 
             
                - - ! '>='
         | 
| @@ -21,10 +21,10 @@ dependencies: | |
| 21 21 | 
             
                    version: '0'
         | 
| 22 22 | 
             
              type: :runtime
         | 
| 23 23 | 
             
              prerelease: false
         | 
| 24 | 
            -
              version_requirements: * | 
| 24 | 
            +
              version_requirements: *75986000
         | 
| 25 25 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 26 26 | 
             
              name: logutils
         | 
| 27 | 
            -
              requirement: & | 
| 27 | 
            +
              requirement: &75985420 !ruby/object:Gem::Requirement
         | 
| 28 28 | 
             
                none: false
         | 
| 29 29 | 
             
                requirements:
         | 
| 30 30 | 
             
                - - ! '>='
         | 
| @@ -32,35 +32,37 @@ dependencies: | |
| 32 32 | 
             
                    version: '0.6'
         | 
| 33 33 | 
             
              type: :runtime
         | 
| 34 34 | 
             
              prerelease: false
         | 
| 35 | 
            -
              version_requirements: * | 
| 35 | 
            +
              version_requirements: *75985420
         | 
| 36 36 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 37 37 | 
             
              name: rdoc
         | 
| 38 | 
            -
              requirement: & | 
| 38 | 
            +
              requirement: &75984750 !ruby/object:Gem::Requirement
         | 
| 39 39 | 
             
                none: false
         | 
| 40 40 | 
             
                requirements:
         | 
| 41 41 | 
             
                - - ~>
         | 
| 42 42 | 
             
                  - !ruby/object:Gem::Version
         | 
| 43 | 
            -
                    version: ' | 
| 43 | 
            +
                    version: '4.0'
         | 
| 44 44 | 
             
              type: :development
         | 
| 45 45 | 
             
              prerelease: false
         | 
| 46 | 
            -
              version_requirements: * | 
| 46 | 
            +
              version_requirements: *75984750
         | 
| 47 47 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 48 48 | 
             
              name: hoe
         | 
| 49 | 
            -
              requirement: & | 
| 49 | 
            +
              requirement: &75984290 !ruby/object:Gem::Requirement
         | 
| 50 50 | 
             
                none: false
         | 
| 51 51 | 
             
                requirements:
         | 
| 52 52 | 
             
                - - ~>
         | 
| 53 53 | 
             
                  - !ruby/object:Gem::Version
         | 
| 54 | 
            -
                    version: '3. | 
| 54 | 
            +
                    version: '3.11'
         | 
| 55 55 | 
             
              type: :development
         | 
| 56 56 | 
             
              prerelease: false
         | 
| 57 | 
            -
              version_requirements: * | 
| 57 | 
            +
              version_requirements: *75984290
         | 
| 58 58 | 
             
            description: tagutils - tag utilities (tag, taggings, tag list, etc.)
         | 
| 59 59 | 
             
            email: openmundi@googlegroups.com
         | 
| 60 60 | 
             
            executables: []
         | 
| 61 61 | 
             
            extensions: []
         | 
| 62 62 | 
             
            extra_rdoc_files:
         | 
| 63 | 
            +
            - HISTORY.md
         | 
| 63 64 | 
             
            - Manifest.txt
         | 
| 65 | 
            +
            - README.md
         | 
| 64 66 | 
             
            files:
         | 
| 65 67 | 
             
            - HISTORY.md
         | 
| 66 68 | 
             
            - Manifest.txt
         | 
| @@ -78,6 +80,7 @@ files: | |
| 78 80 | 
             
            - lib/tagutils/tags/models/tag.rb
         | 
| 79 81 | 
             
            - lib/tagutils/tags/models/tag_comp.rb
         | 
| 80 82 | 
             
            - lib/tagutils/tags/models/tagging.rb
         | 
| 83 | 
            +
            - lib/tagutils/tags/patterns.rb
         | 
| 81 84 | 
             
            - lib/tagutils/tags/readers/tag.rb
         | 
| 82 85 | 
             
            - lib/tagutils/tags/schema.rb
         | 
| 83 86 | 
             
            - lib/tagutils/version.rb
         | 
| @@ -108,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 108 111 | 
             
                - !ruby/object:Gem::Version
         | 
| 109 112 | 
             
                  version: '0'
         | 
| 110 113 | 
             
            requirements: []
         | 
| 111 | 
            -
            rubyforge_project:  | 
| 114 | 
            +
            rubyforge_project: 
         | 
| 112 115 | 
             
            rubygems_version: 1.8.17
         | 
| 113 116 | 
             
            signing_key: 
         | 
| 114 117 | 
             
            specification_version: 3
         |