ext 1.1.1 → 1.1.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/CHANGELOG +5 -0
- data/lib/externals/ext.rb +1 -1
- data/lib/externals/scms/git_project.rb +11 -4
- data/lib/externals/scms/svn_project.rb +16 -8
- data/test/test_checkout_with_subprojects_svn.rb +68 -31
- data/test/test_freeze_to_revision.rb +2 -2
- data/test/test_svn_branches.rb +3 -1
- metadata +4 -4
    
        data/CHANGELOG
    CHANGED
    
    | @@ -1,3 +1,8 @@ | |
| 1 | 
            +
            January 13, 2012 Version 1.1.2 released
         | 
| 2 | 
            +
            - Fixes export problem with newer versions of git.
         | 
| 3 | 
            +
            - Fixes build on Windows, along with a bug that can prevent svn branches from
         | 
| 4 | 
            +
              working.
         | 
| 5 | 
            +
             | 
| 1 6 | 
             
            January 1, 2012 Version 1.1.1 released
         | 
| 2 7 | 
             
            - Fixes a bug preventing proper rails 3 project detection
         | 
| 3 8 |  | 
    
        data/lib/externals/ext.rb
    CHANGED
    
    | @@ -9,7 +9,7 @@ Dir.entries(File.join(File.dirname(__FILE__), 'extensions')).each do |extension| | |
| 9 9 | 
             
            end
         | 
| 10 10 |  | 
| 11 11 | 
             
            module Externals
         | 
| 12 | 
            -
              VERSION = '1.1. | 
| 12 | 
            +
              VERSION = '1.1.2'
         | 
| 13 13 | 
             
              PROJECT_TYPES_DIRECTORY = File.join(File.dirname(__FILE__), '..', 'externals','project_types')
         | 
| 14 14 |  | 
| 15 15 | 
             
              # Full commands operate on the main project as well as the externals
         | 
| @@ -136,10 +136,17 @@ module Externals | |
| 136 136 | 
             
                end
         | 
| 137 137 |  | 
| 138 138 | 
             
                def ex *args
         | 
| 139 | 
            -
                   | 
| 140 | 
            -
             | 
| 141 | 
            -
             | 
| 142 | 
            -
             | 
| 139 | 
            +
                  if revision
         | 
| 140 | 
            +
                    # No clean reliable way to clone something that's not a branch or tag.
         | 
| 141 | 
            +
                    # just call up instead.
         | 
| 142 | 
            +
                    up *args
         | 
| 143 | 
            +
                  else
         | 
| 144 | 
            +
                    clone_opts = "--depth 1"
         | 
| 145 | 
            +
                    if branch
         | 
| 146 | 
            +
                      clone_opts << " -b #{branch}"
         | 
| 147 | 
            +
                    end
         | 
| 148 | 
            +
                    do_clone "ex", clone_opts
         | 
| 149 | 
            +
                  end
         | 
| 143 150 | 
             
                end
         | 
| 144 151 |  | 
| 145 152 | 
             
                def up *args
         | 
| @@ -8,10 +8,14 @@ module Externals | |
| 8 8 |  | 
| 9 9 | 
             
                public
         | 
| 10 10 | 
             
                def co *args
         | 
| 11 | 
            -
                  # delete path if  | 
| 12 | 
            -
                  rmdir_ie path
         | 
| 11 | 
            +
                  # delete path if empty
         | 
| 12 | 
            +
                  rmdir_ie path unless path == "."
         | 
| 13 13 |  | 
| 14 | 
            -
                   | 
| 14 | 
            +
                  dest = path
         | 
| 15 | 
            +
                  dest = '' if dest == '.'
         | 
| 16 | 
            +
                  dest = "\"#{dest}\"" if dest && !dest.empty?
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                  if File.exists? dest
         | 
| 15 19 | 
             
                    up
         | 
| 16 20 | 
             
                  else
         | 
| 17 21 | 
             
                    opts = resolve_opts "co"
         | 
| @@ -23,7 +27,7 @@ module Externals | |
| 23 27 | 
             
                      url = [url, branch].join("/")
         | 
| 24 28 | 
             
                    end
         | 
| 25 29 |  | 
| 26 | 
            -
                    puts(svncocmd = "svn #{opts} co #{url} #{ | 
| 30 | 
            +
                    puts(svncocmd = "svn #{opts} co #{url} #{dest}")
         | 
| 27 31 | 
             
                    puts `#{svncocmd}`
         | 
| 28 32 | 
             
                    unless $? == 0
         | 
| 29 33 | 
             
                      raise
         | 
| @@ -45,8 +49,12 @@ module Externals | |
| 45 49 | 
             
                end
         | 
| 46 50 |  | 
| 47 51 | 
             
                def ex *args
         | 
| 48 | 
            -
                  # delete path if | 
| 49 | 
            -
                  rmdir_ie path
         | 
| 52 | 
            +
                  # delete path if  empty
         | 
| 53 | 
            +
                  rmdir_ie path unless path == "."
         | 
| 54 | 
            +
             | 
| 55 | 
            +
                  dest = path
         | 
| 56 | 
            +
                  dest = '' if dest == '.'
         | 
| 57 | 
            +
                  dest = "\"#{dest}\"" if dest && !dest.empty?
         | 
| 50 58 |  | 
| 51 59 | 
             
                  url = repository
         | 
| 52 60 |  | 
| @@ -59,7 +67,7 @@ module Externals | |
| 59 67 | 
             
                    url += "@#{revision}"
         | 
| 60 68 | 
             
                  end
         | 
| 61 69 |  | 
| 62 | 
            -
                  puts(svncocmd = "svn #{scm_opts_ex} export #{url} #{ | 
| 70 | 
            +
                  puts(svncocmd = "svn #{scm_opts_ex} export #{url} #{dest}")
         | 
| 63 71 | 
             
                  puts `#{svncocmd}`
         | 
| 64 72 | 
             
                end
         | 
| 65 73 |  | 
| @@ -152,7 +160,7 @@ module Externals | |
| 152 160 | 
             
                def current_branch
         | 
| 153 161 | 
             
                  require_repository
         | 
| 154 162 |  | 
| 155 | 
            -
                  branch = info_url.gsub(/\/+/, "/").gsub(repository.gsub(/\/+/, "/"), "")
         | 
| 163 | 
            +
                  branch = info_url.downcase.gsub(/\/+/, "/").gsub(repository.downcase.gsub(/\/+/, "/"), "")
         | 
| 156 164 | 
             
                  if branch == repository
         | 
| 157 165 | 
             
                    raise "Could not determine branch from URL #{info_url}.
         | 
| 158 166 | 
             
                Does not appear have a substring of #{repository}"
         | 
| @@ -1,4 +1,5 @@ | |
| 1 1 | 
             
            $:.unshift File.join(File.dirname(__FILE__), '..', 'lib') if $0 == __FILE__
         | 
| 2 | 
            +
            $:.unshift File.join(File.dirname(__FILE__), 'support') if $0 == __FILE__
         | 
| 2 3 |  | 
| 3 4 | 
             
            require 'ext_test_case'
         | 
| 4 5 | 
             
            require 'externals/ext'
         | 
| @@ -292,51 +293,87 @@ module Externals | |
| 292 293 | 
             
                        end
         | 
| 293 294 |  | 
| 294 295 | 
             
                        assert File.exists?(File.join('vendor', 'rails', 'activerecord', 'lib'))
         | 
| 296 | 
            +
             | 
| 297 | 
            +
                        # Check that engines subproject has content expected for edge branch
         | 
| 298 | 
            +
                        ext = Ext.new
         | 
| 299 | 
            +
             | 
| 300 | 
            +
                        assert_equal(ext.configuration["vendor/plugins/some_subproject_with_edge"]["branch"], "edge")
         | 
| 301 | 
            +
                        assert_equal(ext.configuration["vendor/plugins/some_subproject_with_edge"]["revision"], nil)
         | 
| 302 | 
            +
             | 
| 303 | 
            +
                        Dir.chdir File.join("vendor", "plugins", "some_subproject_with_edge") do
         | 
| 304 | 
            +
                          assert(File.read(File.join("lib", "somelib.rb")) =~ /living on the edge/)
         | 
| 305 | 
            +
                        end
         | 
| 295 306 | 
             
                      end
         | 
| 296 307 | 
             
                    end
         | 
| 297 308 | 
             
                  end
         | 
| 298 309 |  | 
| 299 | 
            -
                  def  | 
| 300 | 
            -
                     | 
| 301 | 
            -
                     | 
| 302 | 
            -
             | 
| 303 | 
            -
             | 
| 304 | 
            -
                        Dir.chdir 'checkout' do
         | 
| 305 | 
            -
                          #source = File.join(root_dir, 'test', 'workdir', 'rails_app')
         | 
| 306 | 
            -
                          source = repository_dir('svn')
         | 
| 307 | 
            -
             | 
| 308 | 
            -
                          if windows?
         | 
| 309 | 
            -
                            source = source.gsub(/\\/, "/")
         | 
| 310 | 
            -
                            #source.gsub!(/^[A-Z]:[\/\\]/, "")
         | 
| 311 | 
            -
                          end
         | 
| 312 | 
            -
                          source = "file:///#{source}"
         | 
| 310 | 
            +
                  def test_export_with_subproject_by_revision
         | 
| 311 | 
            +
                    # figure out the revision to set it to.
         | 
| 312 | 
            +
                    sub_project_revision = nil
         | 
| 313 | 
            +
                    sub_repository = SomeSubprojectWithEdge.new
         | 
| 314 | 
            +
                    sub_repository.prepare
         | 
| 313 315 |  | 
| 314 | 
            -
             | 
| 315 | 
            -
             | 
| 316 | 
            +
                    workdir = File.join(root_dir, 'test', "tmp", "workdir", "export")
         | 
| 317 | 
            +
                    rm_rf_ie workdir
         | 
| 318 | 
            +
                    mkdir_p workdir
         | 
| 316 319 |  | 
| 317 | 
            -
             | 
| 318 | 
            -
             | 
| 320 | 
            +
                    Dir.chdir workdir do
         | 
| 321 | 
            +
                      `git clone #{sub_repository.clean_dir}`
         | 
| 322 | 
            +
                      raise unless $? == 0
         | 
| 323 | 
            +
             | 
| 324 | 
            +
                      Dir.chdir sub_repository.name do
         | 
| 325 | 
            +
                        git_show = `git show origin/master`
         | 
| 326 | 
            +
                        raise unless $? == 0
         | 
| 327 | 
            +
             | 
| 328 | 
            +
                        sub_project_revision = /^commit:?\s*([a-f\d]+)$/.match(git_show)[1]
         | 
| 329 | 
            +
                        assert(sub_project_revision =~ /^[a-f\d]+$/)
         | 
| 330 | 
            +
                      end
         | 
| 331 | 
            +
                    end
         | 
| 332 | 
            +
             | 
| 333 | 
            +
                    # Change the project to use a revision instead of a branch
         | 
| 334 | 
            +
                    repository = RailsAppSvnRepository.new
         | 
| 335 | 
            +
                    repository.prepare
         | 
| 336 | 
            +
                    repository.mark_dirty
         | 
| 319 337 |  | 
| 320 | 
            -
             | 
| 321 | 
            -
             | 
| 322 | 
            -
                            projs_ni = []
         | 
| 338 | 
            +
                    rm_rf_ie workdir
         | 
| 339 | 
            +
                    mkdir_p workdir
         | 
| 323 340 |  | 
| 324 | 
            -
             | 
| 325 | 
            -
             | 
| 341 | 
            +
                    Dir.chdir workdir do
         | 
| 342 | 
            +
                      Ext.run "checkout", "--svn", repository.clean_url
         | 
| 343 | 
            +
             | 
| 344 | 
            +
                      Dir.chdir repository.name do
         | 
| 345 | 
            +
                        assert(sub_project_revision)
         | 
| 346 | 
            +
                        Ext.run "freeze", "some_subproject_with_edge", sub_project_revision
         | 
| 347 | 
            +
                        ext = Ext.new
         | 
| 348 | 
            +
                        ext.configuration["vendor/plugins/some_subproject_with_edge"].rm_setting("branch")
         | 
| 349 | 
            +
                        ext.configuration.write
         | 
| 350 | 
            +
             | 
| 351 | 
            +
                        SvnProject.add_all
         | 
| 352 | 
            +
                        `svn commit -m "changed some_subproject_with_edge to use a revision instead"`
         | 
| 353 | 
            +
                        raise unless $? == 0
         | 
| 354 | 
            +
                      end
         | 
| 355 | 
            +
                    end
         | 
| 326 356 |  | 
| 327 | 
            -
             | 
| 357 | 
            +
                    rm_rf_ie workdir
         | 
| 358 | 
            +
                    mkdir_p workdir
         | 
| 359 | 
            +
                    Dir.chdir workdir do
         | 
| 360 | 
            +
                      source = repository.clean_url
         | 
| 328 361 |  | 
| 329 | 
            -
             | 
| 362 | 
            +
                      puts "About to export #{source}"
         | 
| 363 | 
            +
                      Ext.run "export", "--svn", source, 'rails_app'
         | 
| 330 364 |  | 
| 331 | 
            -
             | 
| 365 | 
            +
                      Dir.chdir 'rails_app' do
         | 
| 366 | 
            +
                        assert !File.exists?('.svn')
         | 
| 332 367 |  | 
| 333 | 
            -
             | 
| 368 | 
            +
                        # Check that engines subproject has content expected for sub_project_revision
         | 
| 369 | 
            +
                        ext = Ext.new
         | 
| 334 370 |  | 
| 335 | 
            -
             | 
| 336 | 
            -
             | 
| 371 | 
            +
                        assert_equal(ext.configuration["vendor/plugins/some_subproject_with_edge"]["branch"], nil)
         | 
| 372 | 
            +
                        assert_equal(ext.configuration["vendor/plugins/some_subproject_with_edge"]["revision"], sub_project_revision)
         | 
| 337 373 |  | 
| 338 | 
            -
             | 
| 339 | 
            -
                           | 
| 374 | 
            +
                        Dir.chdir File.join("vendor", "plugins", "some_subproject_with_edge") do
         | 
| 375 | 
            +
                          assert(File.read(File.join("lib", "somelib.rb")) !~ /living on the edge/)
         | 
| 376 | 
            +
                          assert(File.read(File.join("lib", "somelib.rb")) =~ /'double lulz!'/)
         | 
| 340 377 | 
             
                        end
         | 
| 341 378 | 
             
                      end
         | 
| 342 379 | 
             
                    end
         | 
| @@ -112,7 +112,7 @@ module Externals | |
| 112 112 |  | 
| 113 113 | 
             
                        repository.mark_dirty
         | 
| 114 114 |  | 
| 115 | 
            -
                        `git commit -m  | 
| 115 | 
            +
                        `git commit -m "froze modules to revision 3"`
         | 
| 116 116 | 
             
                        raise unless $? == 0
         | 
| 117 117 | 
             
                        `git push`
         | 
| 118 118 | 
             
                        raise unless $? == 0
         | 
| @@ -144,7 +144,7 @@ module Externals | |
| 144 144 | 
             
                        # Check it in to make sure it sticks
         | 
| 145 145 | 
             
                        `git add .externals`
         | 
| 146 146 | 
             
                        raise unless $? == 0
         | 
| 147 | 
            -
                        `git commit -m  | 
| 147 | 
            +
                        `git commit -m "unfreezing modules"`
         | 
| 148 148 | 
             
                        raise unless $? == 0
         | 
| 149 149 | 
             
                        `git push`
         | 
| 150 150 | 
             
                        raise unless $? == 0
         | 
    
        data/test/test_svn_branches.rb
    CHANGED
    
    | @@ -1,4 +1,5 @@ | |
| 1 1 | 
             
            $:.unshift File.join(File.dirname(__FILE__), '..', 'lib') if $0 == __FILE__
         | 
| 2 | 
            +
            $:.unshift File.join(File.dirname(__FILE__), 'support') if $0 == __FILE__
         | 
| 2 3 | 
             
            require 'ext_test_case'
         | 
| 3 4 | 
             
            require 'externals/ext'
         | 
| 4 5 | 
             
            require 'rails_app_svn_branches'
         | 
| @@ -257,6 +258,7 @@ module Externals | |
| 257 258 | 
             
                    assert File.exists?(File.join(repository.clean_dir, "db"))
         | 
| 258 259 |  | 
| 259 260 | 
             
                    workdir = File.join(root_dir, 'test', "tmp", "workdir", mode, "svn", "branch_test")
         | 
| 261 | 
            +
                    rm_rf workdir
         | 
| 260 262 | 
             
                    mkdir_p workdir
         | 
| 261 263 |  | 
| 262 264 | 
             
                    if File.exists?(File.join(workdir,"rails_app"))
         | 
| @@ -276,7 +278,7 @@ module Externals | |
| 276 278 | 
             
                        assert !File.exists?('.svn')
         | 
| 277 279 |  | 
| 278 280 | 
             
                        %w(redhillonrails_core).each do |proj|
         | 
| 279 | 
            -
                          assert !File.exists?(File.join('vendor', 'plugins',proj, '.svn'))
         | 
| 281 | 
            +
                          assert !File.exists?(File.join('vendor', 'plugins', proj, '.svn'))
         | 
| 280 282 | 
             
                        end
         | 
| 281 283 |  | 
| 282 284 | 
             
                        %w(redhillonrails_core acts_as_list engines).each do |proj|
         | 
    
        metadata
    CHANGED
    
    | @@ -1,13 +1,13 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: ext
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              hash:  | 
| 4 | 
            +
              hash: 23
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
              segments: 
         | 
| 7 7 | 
             
              - 1
         | 
| 8 8 | 
             
              - 1
         | 
| 9 | 
            -
              -  | 
| 10 | 
            -
              version: 1.1. | 
| 9 | 
            +
              - 2
         | 
| 10 | 
            +
              version: 1.1.2
         | 
| 11 11 | 
             
            platform: ruby
         | 
| 12 12 | 
             
            authors: 
         | 
| 13 13 | 
             
            - Miles Georgi
         | 
| @@ -15,7 +15,7 @@ autorequire: | |
| 15 15 | 
             
            bindir: bin
         | 
| 16 16 | 
             
            cert_chain: []
         | 
| 17 17 |  | 
| 18 | 
            -
            date:  | 
| 18 | 
            +
            date: 2013-01-13 00:00:00 Z
         | 
| 19 19 | 
             
            dependencies: []
         | 
| 20 20 |  | 
| 21 21 | 
             
            description: |-
         |