arel 2.2.0 → 2.2.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.
- data/.travis.yml +13 -0
 - data/History.txt +9 -1
 - data/Manifest.txt +1 -0
 - data/lib/arel.rb +1 -1
 - data/lib/arel/select_manager.rb +8 -0
 - data/lib/arel/update_manager.rb +4 -0
 - data/test/test_select_manager.rb +17 -0
 - data/test/test_update_manager.rb +16 -0
 - metadata +4 -3
 
    
        data/.travis.yml
    ADDED
    
    
    
        data/History.txt
    CHANGED
    
    | 
         @@ -1,3 +1,11 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            == 2.2.1 / 2011-09-15
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            * Enhancements
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
              * Added UpdateManager#key to access the key value
         
     | 
| 
      
 6 
     | 
    
         
            +
              * Added SelectManager#projections= to override any existing projections
         
     | 
| 
      
 7 
     | 
    
         
            +
              * Added SelectManager#source to get the source of the last select core in the AST
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
       1 
9 
     | 
    
         
             
            == 2.2.0 / 2011-08-09
         
     | 
| 
       2 
10 
     | 
    
         | 
| 
       3 
11 
     | 
    
         
             
            * Bug Fixes
         
     | 
| 
         @@ -166,7 +174,7 @@ 
     | 
|
| 
       166 
174 
     | 
    
         | 
| 
       167 
175 
     | 
    
         
             
            == 2.0.0 / 2010-08-01
         
     | 
| 
       168 
176 
     | 
    
         
             
            * Enhancements
         
     | 
| 
       169 
     | 
    
         
            -
             
     | 
| 
      
 177 
     | 
    
         
            +
             
     | 
| 
       170 
178 
     | 
    
         
             
              * Recreate library using the Visitor pattern.
         
     | 
| 
       171 
179 
     | 
    
         
             
                http://en.wikipedia.org/wiki/Visitor_pattern
         
     | 
| 
       172 
180 
     | 
    
         | 
    
        data/Manifest.txt
    CHANGED
    
    
    
        data/lib/arel.rb
    CHANGED
    
    
    
        data/lib/arel/select_manager.rb
    CHANGED
    
    | 
         @@ -135,6 +135,10 @@ module Arel 
     | 
|
| 
       135 
135 
     | 
    
         
             
                  self
         
     | 
| 
       136 
136 
     | 
    
         
             
                end
         
     | 
| 
       137 
137 
     | 
    
         | 
| 
      
 138 
     | 
    
         
            +
                def projections= projections
         
     | 
| 
      
 139 
     | 
    
         
            +
                  @ctx.projections = projections
         
     | 
| 
      
 140 
     | 
    
         
            +
                end
         
     | 
| 
      
 141 
     | 
    
         
            +
             
     | 
| 
       138 
142 
     | 
    
         
             
                def order *expr
         
     | 
| 
       139 
143 
     | 
    
         
             
                  # FIXME: We SHOULD NOT be converting these to SqlLiteral automatically
         
     | 
| 
       140 
144 
     | 
    
         
             
                  @ast.orders.concat expr.map { |x|
         
     | 
| 
         @@ -220,6 +224,10 @@ module Arel 
     | 
|
| 
       220 
224 
     | 
    
         
             
                  @ctx.source.right
         
     | 
| 
       221 
225 
     | 
    
         
             
                end
         
     | 
| 
       222 
226 
     | 
    
         | 
| 
      
 227 
     | 
    
         
            +
                def source
         
     | 
| 
      
 228 
     | 
    
         
            +
                  @ctx.source
         
     | 
| 
      
 229 
     | 
    
         
            +
                end
         
     | 
| 
      
 230 
     | 
    
         
            +
             
     | 
| 
       223 
231 
     | 
    
         
             
                def joins manager
         
     | 
| 
       224 
232 
     | 
    
         
             
                  if $VERBOSE
         
     | 
| 
       225 
233 
     | 
    
         
             
                    warn "joins is deprecated and will be removed in 3.0.0"
         
     | 
    
        data/lib/arel/update_manager.rb
    CHANGED
    
    
    
        data/test/test_select_manager.rb
    CHANGED
    
    | 
         @@ -860,6 +860,15 @@ module Arel 
     | 
|
| 
       860 
860 
     | 
    
         
             
                  end
         
     | 
| 
       861 
861 
     | 
    
         
             
                end
         
     | 
| 
       862 
862 
     | 
    
         | 
| 
      
 863 
     | 
    
         
            +
                describe 'projections=' do
         
     | 
| 
      
 864 
     | 
    
         
            +
                  it 'overwrites projections' do
         
     | 
| 
      
 865 
     | 
    
         
            +
                    manager = Arel::SelectManager.new Table.engine
         
     | 
| 
      
 866 
     | 
    
         
            +
                    manager.project Arel.sql('foo')
         
     | 
| 
      
 867 
     | 
    
         
            +
                    manager.projections = [Arel.sql('bar')]
         
     | 
| 
      
 868 
     | 
    
         
            +
                    manager.to_sql.must_be_like %{ SELECT bar }
         
     | 
| 
      
 869 
     | 
    
         
            +
                  end
         
     | 
| 
      
 870 
     | 
    
         
            +
                end
         
     | 
| 
      
 871 
     | 
    
         
            +
             
     | 
| 
       863 
872 
     | 
    
         
             
                describe 'take' do
         
     | 
| 
       864 
873 
     | 
    
         
             
                  it "knows take" do
         
     | 
| 
       865 
874 
     | 
    
         
             
                    table   = Table.new :users
         
     | 
| 
         @@ -947,5 +956,13 @@ module Arel 
     | 
|
| 
       947 
956 
     | 
    
         
             
                    manager.to_sql.must_be_like 'SELECT "users"."id" FROM "users"'
         
     | 
| 
       948 
957 
     | 
    
         
             
                  end
         
     | 
| 
       949 
958 
     | 
    
         
             
                end
         
     | 
| 
      
 959 
     | 
    
         
            +
             
     | 
| 
      
 960 
     | 
    
         
            +
                describe 'source' do
         
     | 
| 
      
 961 
     | 
    
         
            +
                  it 'returns the join source of the select core' do
         
     | 
| 
      
 962 
     | 
    
         
            +
                    table   = Table.new :users
         
     | 
| 
      
 963 
     | 
    
         
            +
                    manager = Arel::SelectManager.new Table.engine
         
     | 
| 
      
 964 
     | 
    
         
            +
                    manager.source.must_equal manager.ast.cores.last.source
         
     | 
| 
      
 965 
     | 
    
         
            +
                  end
         
     | 
| 
      
 966 
     | 
    
         
            +
                end
         
     | 
| 
       950 
967 
     | 
    
         
             
              end
         
     | 
| 
       951 
968 
     | 
    
         
             
            end
         
     | 
    
        data/test/test_update_manager.rb
    CHANGED
    
    | 
         @@ -95,5 +95,21 @@ module Arel 
     | 
|
| 
       95 
95 
     | 
    
         
             
                    um.where(table[:id].eq(1)).must_equal um
         
     | 
| 
       96 
96 
     | 
    
         
             
                  end
         
     | 
| 
       97 
97 
     | 
    
         
             
                end
         
     | 
| 
      
 98 
     | 
    
         
            +
             
     | 
| 
      
 99 
     | 
    
         
            +
                describe 'key' do
         
     | 
| 
      
 100 
     | 
    
         
            +
                  before do
         
     | 
| 
      
 101 
     | 
    
         
            +
                    @table = Table.new :users
         
     | 
| 
      
 102 
     | 
    
         
            +
                    @um = Arel::UpdateManager.new Table.engine
         
     | 
| 
      
 103 
     | 
    
         
            +
                    @um.key = @table[:foo]
         
     | 
| 
      
 104 
     | 
    
         
            +
                  end
         
     | 
| 
      
 105 
     | 
    
         
            +
             
     | 
| 
      
 106 
     | 
    
         
            +
                  it 'can be set' do
         
     | 
| 
      
 107 
     | 
    
         
            +
                    @um.ast.key.must_equal @table[:foo]
         
     | 
| 
      
 108 
     | 
    
         
            +
                  end
         
     | 
| 
      
 109 
     | 
    
         
            +
             
     | 
| 
      
 110 
     | 
    
         
            +
                  it 'can be accessed' do
         
     | 
| 
      
 111 
     | 
    
         
            +
                    @um.key.must_equal @table[:foo]
         
     | 
| 
      
 112 
     | 
    
         
            +
                  end
         
     | 
| 
      
 113 
     | 
    
         
            +
                end
         
     | 
| 
       98 
114 
     | 
    
         
             
              end
         
     | 
| 
       99 
115 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version 
     | 
|
| 
       5 
5 
     | 
    
         
             
              segments: 
         
     | 
| 
       6 
6 
     | 
    
         
             
              - 2
         
     | 
| 
       7 
7 
     | 
    
         
             
              - 2
         
     | 
| 
       8 
     | 
    
         
            -
              -  
     | 
| 
       9 
     | 
    
         
            -
              version: 2.2. 
     | 
| 
      
 8 
     | 
    
         
            +
              - 1
         
     | 
| 
      
 9 
     | 
    
         
            +
              version: 2.2.1
         
     | 
| 
       10 
10 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       11 
11 
     | 
    
         
             
            authors: 
         
     | 
| 
       12 
12 
     | 
    
         
             
            - Aaron Patterson
         
     | 
| 
         @@ -17,7 +17,7 @@ autorequire: 
     | 
|
| 
       17 
17 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       18 
18 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
     | 
    
         
            -
            date: 2011-08- 
     | 
| 
      
 20 
     | 
    
         
            +
            date: 2011-08-15 00:00:00 -07:00
         
     | 
| 
       21 
21 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       22 
22 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       23 
23 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
         @@ -72,6 +72,7 @@ extra_rdoc_files: 
     | 
|
| 
       72 
72 
     | 
    
         
             
            files: 
         
     | 
| 
       73 
73 
     | 
    
         
             
            - .autotest
         
     | 
| 
       74 
74 
     | 
    
         
             
            - .gemtest
         
     | 
| 
      
 75 
     | 
    
         
            +
            - .travis.yml
         
     | 
| 
       75 
76 
     | 
    
         
             
            - Gemfile
         
     | 
| 
       76 
77 
     | 
    
         
             
            - History.txt
         
     | 
| 
       77 
78 
     | 
    
         
             
            - MIT-LICENSE.txt
         
     |