org_tp 0.0.5 → 0.0.6
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/examples/0130_mongoid.rb +5 -5
- data/lib/org_tp/railtie.rb +1 -1
- data/lib/org_tp/version.rb +1 -1
- data/org_tp.gemspec +14 -14
- data/spec/active_record_spec.rb +4 -4
- data/spec/org_tp_spec.rb +19 -19
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 1a86d8ba338efcb40e6028d7f44aaf3566c78698
         | 
| 4 | 
            +
              data.tar.gz: db53b23f2bc3f6368e633aff05ff7b289e3adb64
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: d416f1a7625484a816e546f22107b3ab683b3df75510ec009d9d2bccd8afedb9cb94fbba9273ba96f51a413e936291988111ef4fe99e640a353b6b0fd75b08dc
         | 
| 7 | 
            +
              data.tar.gz: a05a86c3cb9fbf63cfa746b87e5133e19060239eb9ff609a1f298b83b3da14a41affa2ad2e96dfc4d574b85ae8cf46dc2dc62d3b2d4a1718e93aa1f87f034e56
         | 
    
        data/examples/0130_mongoid.rb
    CHANGED
    
    | @@ -20,16 +20,16 @@ tp User.limit(1) | |
| 20 20 | 
             
            # >> |--------------------------+-------|
         | 
| 21 21 | 
             
            # >> | _id                      | name  |
         | 
| 22 22 | 
             
            # >> |--------------------------+-------|
         | 
| 23 | 
            -
            # >> |  | 
| 24 | 
            -
            # >> |  | 
| 25 | 
            -
            # >> |  | 
| 23 | 
            +
            # >> | 598d9d05f6453f404a7a4c74 | alice |
         | 
| 24 | 
            +
            # >> | 598d9d06f6453f404a7a4c75 | bob   |
         | 
| 25 | 
            +
            # >> | 598d9d06f6453f404a7a4c76 | carol |
         | 
| 26 26 | 
             
            # >> |--------------------------+-------|
         | 
| 27 27 | 
             
            # >> |------+--------------------------|
         | 
| 28 | 
            -
            # >> | _id  |  | 
| 28 | 
            +
            # >> | _id  | 598d9d05f6453f404a7a4c74 |
         | 
| 29 29 | 
             
            # >> | name | alice                    |
         | 
| 30 30 | 
             
            # >> |------+--------------------------|
         | 
| 31 31 | 
             
            # >> |--------------------------+-------|
         | 
| 32 32 | 
             
            # >> | _id                      | name  |
         | 
| 33 33 | 
             
            # >> |--------------------------+-------|
         | 
| 34 | 
            -
            # >> |  | 
| 34 | 
            +
            # >> | 598d9d05f6453f404a7a4c74 | alice |
         | 
| 35 35 | 
             
            # >> |--------------------------+-------|
         | 
    
        data/lib/org_tp/railtie.rb
    CHANGED
    
    
    
        data/lib/org_tp/version.rb
    CHANGED
    
    
    
        data/org_tp.gemspec
    CHANGED
    
    | @@ -4,27 +4,27 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) | |
| 4 4 | 
             
            require 'org_tp/version'
         | 
| 5 5 |  | 
| 6 6 | 
             
            Gem::Specification.new do |spec|
         | 
| 7 | 
            -
              spec.name         =  | 
| 7 | 
            +
              spec.name         = 'org_tp'
         | 
| 8 8 | 
             
              spec.version      = OrgTp::VERSION
         | 
| 9 | 
            -
              spec.author       =  | 
| 10 | 
            -
              spec.email        =  | 
| 11 | 
            -
              spec.homepage     =  | 
| 12 | 
            -
              spec.summary      =  | 
| 13 | 
            -
              spec.description  =  | 
| 9 | 
            +
              spec.author       = 'akicho8'
         | 
| 10 | 
            +
              spec.email        = 'akicho8@gmail.com'
         | 
| 11 | 
            +
              spec.homepage     = 'https://github.com/akicho8/org_tp'
         | 
| 12 | 
            +
              spec.summary      = 'OrgTp shows text table like emacs org-table for easy reading.'
         | 
| 13 | 
            +
              spec.description  = 'OrgTp shows text table like emacs org-table for easy reading.'
         | 
| 14 14 | 
             
              spec.platform     = Gem::Platform::RUBY
         | 
| 15 15 |  | 
| 16 16 | 
             
              spec.files         = `git ls-files`.split($/)
         | 
| 17 17 | 
             
              spec.executables   = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
         | 
| 18 18 | 
             
              spec.test_files    = spec.files.grep(%r{^(test|spec|features)/})
         | 
| 19 | 
            -
              spec.require_paths = [ | 
| 20 | 
            -
              spec.rdoc_options  = [ | 
| 19 | 
            +
              spec.require_paths = ['lib']
         | 
| 20 | 
            +
              spec.rdoc_options  = ['--line-numbers', '--inline-source', '--charset=UTF-8', '--diagram', '--image-format=jpg']
         | 
| 21 21 |  | 
| 22 | 
            -
              spec.add_dependency  | 
| 22 | 
            +
              spec.add_dependency 'activesupport'
         | 
| 23 23 |  | 
| 24 | 
            -
              spec.add_development_dependency  | 
| 25 | 
            -
              spec.add_development_dependency  | 
| 26 | 
            -
              spec.add_development_dependency  | 
| 24 | 
            +
              spec.add_development_dependency 'bundler', '~> 1.3'
         | 
| 25 | 
            +
              spec.add_development_dependency 'rake'
         | 
| 26 | 
            +
              spec.add_development_dependency 'rspec'
         | 
| 27 27 |  | 
| 28 | 
            -
              spec.add_development_dependency  | 
| 29 | 
            -
              spec.add_development_dependency  | 
| 28 | 
            +
              spec.add_development_dependency 'activerecord'
         | 
| 29 | 
            +
              spec.add_development_dependency 'sqlite3'
         | 
| 30 30 | 
             
            end
         | 
    
        data/spec/active_record_spec.rb
    CHANGED
    
    | @@ -1,8 +1,8 @@ | |
| 1 | 
            -
            require_relative  | 
| 2 | 
            -
            require  | 
| 1 | 
            +
            require_relative 'spec_helper'
         | 
| 2 | 
            +
            require 'active_record'
         | 
| 3 3 |  | 
| 4 4 | 
             
            ActiveRecord::Base.send(:include, OrgTp::ActiveRecord)
         | 
| 5 | 
            -
            ActiveRecord::Base.establish_connection(:adapter =>  | 
| 5 | 
            +
            ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => ':memory:')
         | 
| 6 6 | 
             
            ActiveRecord::Migration.verbose = false
         | 
| 7 7 |  | 
| 8 8 | 
             
            ActiveRecord::Schema.define do
         | 
| @@ -35,7 +35,7 @@ EOT | |
| 35 35 | 
             
            |------+---|
         | 
| 36 36 | 
             
            EOT
         | 
| 37 37 |  | 
| 38 | 
            -
                ActiveRecord::Base.connection.select_all( | 
| 38 | 
            +
                ActiveRecord::Base.connection.select_all('select * from users').to_t.should == <<~EOT
         | 
| 39 39 | 
             
            |----+------|
         | 
| 40 40 | 
             
            | id | name |
         | 
| 41 41 | 
             
            |----+------|
         | 
    
        data/spec/org_tp_spec.rb
    CHANGED
    
    | @@ -1,19 +1,19 @@ | |
| 1 | 
            -
            require_relative  | 
| 1 | 
            +
            require_relative 'spec_helper'
         | 
| 2 2 |  | 
| 3 3 | 
             
            describe OrgTp do
         | 
| 4 4 | 
             
              before do
         | 
| 5 5 | 
             
                @rows = [
         | 
| 6 | 
            -
                  {id: 1, name:  | 
| 7 | 
            -
                  {id: 2, name:  | 
| 8 | 
            -
                  {id: 3, name:  | 
| 6 | 
            +
                  {id: 1, name: 'alice', description: '0123456789'},
         | 
| 7 | 
            +
                  {id: 2, name: 'bob',   description: 'あいうえお'},
         | 
| 8 | 
            +
                  {id: 3, name: 'bob'},
         | 
| 9 9 | 
             
                ]
         | 
| 10 10 | 
             
              end
         | 
| 11 11 |  | 
| 12 | 
            -
              it  | 
| 13 | 
            -
                OrgTp.generate([]).should ==  | 
| 12 | 
            +
              it 'empty array' do
         | 
| 13 | 
            +
                OrgTp.generate([]).should == ''
         | 
| 14 14 | 
             
              end
         | 
| 15 15 |  | 
| 16 | 
            -
              it  | 
| 16 | 
            +
              it 'フォーマット指定なし' do
         | 
| 17 17 | 
             
                OrgTp.generate(@rows).should == <<~EOT
         | 
| 18 18 | 
             
            |----+-------+-------------|
         | 
| 19 19 | 
             
            | id | name  | description |
         | 
| @@ -25,7 +25,7 @@ describe OrgTp do | |
| 25 25 | 
             
            EOT
         | 
| 26 26 | 
             
              end
         | 
| 27 27 |  | 
| 28 | 
            -
              it  | 
| 28 | 
            +
              it 'header: false' do
         | 
| 29 29 | 
             
                OrgTp.generate(@rows, header: false).should == <<~EOT
         | 
| 30 30 | 
             
            |---+-------+------------|
         | 
| 31 31 | 
             
            | 1 | alice | 0123456789 |
         | 
| @@ -35,8 +35,8 @@ EOT | |
| 35 35 | 
             
            EOT
         | 
| 36 36 | 
             
              end
         | 
| 37 37 |  | 
| 38 | 
            -
              it  | 
| 39 | 
            -
                OrgTp.generate(@rows, padding:  | 
| 38 | 
            +
              it 'padding disable' do
         | 
| 39 | 
            +
                OrgTp.generate(@rows, padding: '').should == <<~EOT
         | 
| 40 40 | 
             
            |--+-----+-----------|
         | 
| 41 41 | 
             
            |id|name |description|
         | 
| 42 42 | 
             
            |--+-----+-----------|
         | 
| @@ -47,8 +47,8 @@ EOT | |
| 47 47 | 
             
            EOT
         | 
| 48 48 | 
             
              end
         | 
| 49 49 |  | 
| 50 | 
            -
              describe  | 
| 51 | 
            -
                it  | 
| 50 | 
            +
              describe 'various to_t' do
         | 
| 51 | 
            +
                it 'hash array' do
         | 
| 52 52 | 
             
                  [{a: 1}].to_t.should == <<~EOT
         | 
| 53 53 | 
             
            |---|
         | 
| 54 54 | 
             
            | a |
         | 
| @@ -58,7 +58,7 @@ EOT | |
| 58 58 | 
             
            EOT
         | 
| 59 59 | 
             
                end
         | 
| 60 60 |  | 
| 61 | 
            -
                it  | 
| 61 | 
            +
                it 'Hash' do
         | 
| 62 62 | 
             
                  {a: 1}.to_t.should == <<~EOT
         | 
| 63 63 | 
             
            |---+---|
         | 
| 64 64 | 
             
            | a | 1 |
         | 
| @@ -66,8 +66,8 @@ EOT | |
| 66 66 | 
             
            EOT
         | 
| 67 67 | 
             
                end
         | 
| 68 68 |  | 
| 69 | 
            -
                it  | 
| 70 | 
            -
                  [ | 
| 69 | 
            +
                it 'String Array' do
         | 
| 70 | 
            +
                  ['a', 'b'].to_t.should == <<~EOT
         | 
| 71 71 | 
             
            |---|
         | 
| 72 72 | 
             
            | a |
         | 
| 73 73 | 
             
            | b |
         | 
| @@ -75,9 +75,9 @@ EOT | |
| 75 75 | 
             
            EOT
         | 
| 76 76 | 
             
                end
         | 
| 77 77 |  | 
| 78 | 
            -
                it  | 
| 78 | 
            +
                it 'Others' do
         | 
| 79 79 | 
             
                  1.to_t.should be_present
         | 
| 80 | 
            -
                   | 
| 80 | 
            +
                  '1'.to_t.should be_present
         | 
| 81 81 | 
             
                  Module.new.should be_present
         | 
| 82 82 | 
             
                  {[:a] => []}.to_t.should == <<~EOT
         | 
| 83 83 | 
             
            |------+----|
         | 
| @@ -86,8 +86,8 @@ EOT | |
| 86 86 | 
             
            EOT
         | 
| 87 87 | 
             
                end
         | 
| 88 88 |  | 
| 89 | 
            -
                it  | 
| 90 | 
            -
                  OrgTp.generate([{ | 
| 89 | 
            +
                it 'Array of hashes and width is correct even when value is array' do
         | 
| 90 | 
            +
                  OrgTp.generate([{'a' => ['a']}]).should == <<~EOT
         | 
| 91 91 | 
             
            |-------|
         | 
| 92 92 | 
             
            | a     |
         | 
| 93 93 | 
             
            |-------|
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: org_tp
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.6
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - akicho8
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2017-08- | 
| 11 | 
            +
            date: 2017-08-14 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: activesupport
         |