falkorlib 0.2.10 → 0.2.11
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/Gemfile.lock +13 -4
- data/README.md +1 -0
- data/falkorlib.gemspec +1 -0
- data/lib/falkorlib/common.rb +12 -4
- data/lib/falkorlib/git/base.rb +7 -15
- data/lib/falkorlib/tasks/rspec.rake +1 -1
- data/lib/falkorlib/version.rb +1 -1
- data/lib/falkorlib/versioning.rb +2 -2
- data/spec/falkorlib/common_spec.rb +51 -1
- data/spec/falkorlib/versioning_gem_spec.rb +135 -0
- data/spec/falkorlib/versioning_spec.rb +56 -68
- data/spec/spec_helper.rb +3 -0
- metadata +18 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 75815fa5eb90ae587f6e35f4cba78cdd46f10a7f
         | 
| 4 | 
            +
              data.tar.gz: ed4c21f7dd6af1d51a6911143a33e33b4767e27f
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: fa1ef55091c1fdca957795c3aed4968bee2657abbb62206dc2dc6beb6c5ed2b3284027d854d9dad149413e1851ea6e8b7ff7a4353d1c08092403e2685633834b
         | 
| 7 | 
            +
              data.tar.gz: 38911492f3497f87a0b8633f6310c6e79200216ec54a0ba1c3cc295a6615fda09bf3cfe945d26735f0509125592770d2869ed23b1c9b1fe8e534a685066da94d
         | 
    
        data/Gemfile.lock
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            PATH
         | 
| 2 2 | 
             
              remote: .
         | 
| 3 3 | 
             
              specs:
         | 
| 4 | 
            -
                falkorlib (0.2. | 
| 4 | 
            +
                falkorlib (0.2.11)
         | 
| 5 5 | 
             
                  awesome_print (~> 1.2)
         | 
| 6 6 | 
             
                  configatron (~> 3.2)
         | 
| 7 7 | 
             
                  git_remote_branch (~> 0)
         | 
| @@ -15,9 +15,12 @@ GEM | |
| 15 15 | 
             
                addressable (2.3.6)
         | 
| 16 16 | 
             
                awesome_print (1.2.0)
         | 
| 17 17 | 
             
                backports (3.6.0)
         | 
| 18 | 
            +
                codeclimate-test-reporter (0.3.0)
         | 
| 19 | 
            +
                  simplecov (>= 0.7.1, < 1.0.0)
         | 
| 18 20 | 
             
                coderay (1.1.0)
         | 
| 19 21 | 
             
                configatron (3.2.0)
         | 
| 20 22 | 
             
                diff-lcs (1.1.3)
         | 
| 23 | 
            +
                docile (1.1.5)
         | 
| 21 24 | 
             
                ethon (0.7.0)
         | 
| 22 25 | 
             
                  ffi (>= 1.3.0)
         | 
| 23 26 | 
             
                faraday (0.9.0)
         | 
| @@ -62,19 +65,24 @@ GEM | |
| 62 65 | 
             
                rspec-mocks (2.7.0)
         | 
| 63 66 | 
             
                rubygems-tasks (0.2.4)
         | 
| 64 67 | 
             
                safe_yaml (0.9.7)
         | 
| 68 | 
            +
                simplecov (0.8.2)
         | 
| 69 | 
            +
                  docile (~> 1.1.0)
         | 
| 70 | 
            +
                  multi_json
         | 
| 71 | 
            +
                  simplecov-html (~> 0.8.0)
         | 
| 72 | 
            +
                simplecov-html (0.8.0)
         | 
| 65 73 | 
             
                slop (3.5.0)
         | 
| 66 74 | 
             
                term-ansicolor (1.3.0)
         | 
| 67 75 | 
             
                  tins (~> 1.0)
         | 
| 68 76 | 
             
                tins (1.3.0)
         | 
| 69 | 
            -
                travis (1.6. | 
| 77 | 
            +
                travis (1.6.14)
         | 
| 70 78 | 
             
                  addressable (~> 2.3)
         | 
| 71 79 | 
             
                  backports
         | 
| 72 80 | 
             
                  faraday (~> 0.9)
         | 
| 73 | 
            -
                  faraday_middleware (~> 0.9)
         | 
| 81 | 
            +
                  faraday_middleware (~> 0.9, >= 0.9.1)
         | 
| 74 82 | 
             
                  gh (~> 0.13)
         | 
| 75 83 | 
             
                  highline (~> 1.6)
         | 
| 76 84 | 
             
                  launchy (~> 2.1)
         | 
| 77 | 
            -
                  pry (~> 0.9)
         | 
| 85 | 
            +
                  pry (~> 0.9, < 0.10)
         | 
| 78 86 | 
             
                  pusher-client (~> 0.4)
         | 
| 79 87 | 
             
                  typhoeus (~> 0.6, >= 0.6.8)
         | 
| 80 88 | 
             
                travis-lint (1.8.0)
         | 
| @@ -90,6 +98,7 @@ PLATFORMS | |
| 90 98 |  | 
| 91 99 | 
             
            DEPENDENCIES
         | 
| 92 100 | 
             
              bundler (~> 1.0)
         | 
| 101 | 
            +
              codeclimate-test-reporter
         | 
| 93 102 | 
             
              falkorlib!
         | 
| 94 103 | 
             
              pry (~> 0.9)
         | 
| 95 104 | 
             
              rspec (~> 2.7, >= 2.7.0)
         | 
    
        data/README.md
    CHANGED
    
    | @@ -3,6 +3,7 @@ | |
| 3 3 | 
             
            [](http://badge.fury.io/rb/falkorlib)
         | 
| 4 4 | 
             
            [](https://travis-ci.org/Falkor/falkorlib)
         | 
| 5 5 | 
             
            [](https://codeclimate.com/github/Falkor/falkorlib)
         | 
| 6 | 
            +
            [](https://codeclimate.com/github/Falkor/falkorlib)
         | 
| 6 7 | 
             
            [](http://inch-ci.org/github/Falkor/falkorlib)
         | 
| 7 8 | 
             
            [](http://gittip.com/Falkor)
         | 
| 8 9 |  | 
    
        data/falkorlib.gemspec
    CHANGED
    
    | @@ -148,6 +148,7 @@ Gem::Specification.new do |s| | |
| 148 148 | 
             
                s.add_development_dependency("travis",        "~> 1.6")
         | 
| 149 149 | 
             
                s.add_development_dependency("travis-lint",   "~> 1.8")
         | 
| 150 150 |  | 
| 151 | 
            +
            	s.add_development_dependency("codeclimate-test-reporter") #, group: :test, require: nil)
         | 
| 151 152 | 
             
                #s.add_development_dependency("bluecloth",      "~> 2.2.0")
         | 
| 152 153 | 
             
                #s.add_development_dependency("wlang",          "~> 0.10.2")
         | 
| 153 154 |  | 
    
        data/lib/falkorlib/common.rb
    CHANGED
    
    | @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            # -*- encoding: utf-8 -*-
         | 
| 2 2 | 
             
            ################################################################################
         | 
| 3 | 
            -
            # Time-stamp: <Jeu 2014-06- | 
| 3 | 
            +
            # Time-stamp: <Jeu 2014-06-26 23:05 svarrette>
         | 
| 4 4 | 
             
            ################################################################################
         | 
| 5 5 |  | 
| 6 6 | 
             
            require "falkorlib"
         | 
| @@ -118,7 +118,7 @@ module FalkorLib #:nodoc: | |
| 118 118 | 
             
            	        end 
         | 
| 119 119 | 
             
            	        unless stderr.empty?
         | 
| 120 120 | 
             
            		        stderr.each_line do |line|
         | 
| 121 | 
            -
            			        print red("** [err] #{line}")        
         | 
| 121 | 
            +
            			        $stderr.print red("** [err] #{line}")        
         | 
| 122 122 | 
             
            			        $stderr.flush
         | 
| 123 123 | 
             
            		        end		        
         | 
| 124 124 | 
             
            	        end 
         | 
| @@ -132,7 +132,15 @@ module FalkorLib #:nodoc: | |
| 132 132 | 
             
            	        $?
         | 
| 133 133 | 
             
                    end
         | 
| 134 134 |  | 
| 135 | 
            -
                    
         | 
| 135 | 
            +
                    ## Execute in a given directory
         | 
| 136 | 
            +
                    def execute_in_dir(path, cmd)
         | 
| 137 | 
            +
            	        exit_status = 0
         | 
| 138 | 
            +
            	        Dir.chdir(path) do
         | 
| 139 | 
            +
            		        exit_status = run %{ #{cmd} }
         | 
| 140 | 
            +
            	        end 
         | 
| 141 | 
            +
            	        exit_status
         | 
| 142 | 
            +
                    end # execute_in_dir
         | 
| 143 | 
            +
             | 
| 136 144 |  | 
| 137 145 |  | 
| 138 146 | 
             
                    ## Execute a given command - exit if status != 0
         | 
| @@ -141,7 +149,7 @@ module FalkorLib #:nodoc: | |
| 141 149 | 
             
            	        if (status.to_i != 0)
         | 
| 142 150 | 
             
            		        error("The command '#{cmd}' failed with exit status #{status.to_i}")
         | 
| 143 151 | 
             
                        end
         | 
| 144 | 
            -
            	         | 
| 152 | 
            +
            	        status
         | 
| 145 153 | 
             
                    end
         | 
| 146 154 |  | 
| 147 155 | 
             
                    ## "Nice" way to present run commands
         | 
    
        data/lib/falkorlib/git/base.rb
    CHANGED
    
    | @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            # -*- encoding: utf-8 -*-
         | 
| 2 2 | 
             
            ################################################################################
         | 
| 3 | 
            -
            # Time-stamp: < | 
| 3 | 
            +
            # Time-stamp: <Jeu 2014-06-26 12:35 svarrette>
         | 
| 4 4 | 
             
            ################################################################################
         | 
| 5 5 | 
             
            # Interface for the main Git operations
         | 
| 6 6 | 
             
            #
         | 
| @@ -282,27 +282,19 @@ module FalkorLib  #:nodoc: | |
| 282 282 |  | 
| 283 283 | 
             
                    ## Update the Git submodules to the **local** registered version
         | 
| 284 284 | 
             
                    def submodule_update(path = Dir.pwd)
         | 
| 285 | 
            -
             | 
| 286 | 
            -
             | 
| 287 | 
            -
                        Dir.chdir(git_root_dir) do
         | 
| 288 | 
            -
                            exit_status = run %{
         | 
| 285 | 
            +
            	        execute_in_dir(rootdir(path), 
         | 
| 286 | 
            +
            	                       %{
         | 
| 289 287 | 
             
                               git submodule init
         | 
| 290 288 | 
             
                               git submodule update
         | 
| 291 | 
            -
             | 
| 292 | 
            -
                        end
         | 
| 293 | 
            -
                        exit_status
         | 
| 289 | 
            +
                        })
         | 
| 294 290 | 
             
                    end
         | 
| 295 291 |  | 
| 296 292 | 
             
                    ## Upgrade the Git submodules to the latest HEAD version from the remote
         | 
| 297 293 | 
             
                    def submodule_upgrade(path = Dir.pwd)
         | 
| 298 | 
            -
             | 
| 299 | 
            -
             | 
| 300 | 
            -
                        Dir.chdir(git_root_dir) do
         | 
| 301 | 
            -
                            exit_status = run %{
         | 
| 294 | 
            +
            	         execute_in_dir(rootdir(path), 
         | 
| 295 | 
            +
            	                       %{
         | 
| 302 296 | 
             
                               git submodule foreach 'git fetch origin; git checkout $(git rev-parse --abbrev-ref HEAD); git reset --hard origin/$(git rev-parse --abbrev-ref HEAD); git submodule update --recursive; git clean -dfx'
         | 
| 303 | 
            -
             | 
| 304 | 
            -
                        end
         | 
| 305 | 
            -
                        exit_status
         | 
| 297 | 
            +
                         })	        
         | 
| 306 298 | 
             
                    end
         | 
| 307 299 |  | 
| 308 300 |  | 
| @@ -32,7 +32,7 @@ begin | |
| 32 32 | 
             
                # Glob pattern to match files.
         | 
| 33 33 | 
             
                #t.pattern = "spec/**/test_*.rb"
         | 
| 34 34 | 
             
            	#t.pattern = "spec/**/*_spec.rb"
         | 
| 35 | 
            -
            		#t.pattern = "spec/**/ | 
| 35 | 
            +
            		#t.pattern = "spec/**/versioning_*spec.rb"
         | 
| 36 36 |  | 
| 37 37 | 
             
                # Whether or not to fail Rake when an error occurs (typically when
         | 
| 38 38 | 
             
                # examples fail).
         | 
    
        data/lib/falkorlib/version.rb
    CHANGED
    
    
    
        data/lib/falkorlib/versioning.rb
    CHANGED
    
    | @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            # -*- encoding: utf-8 -*-
         | 
| 2 2 | 
             
            ################################################################################
         | 
| 3 | 
            -
            # Time-stamp: < | 
| 3 | 
            +
            # Time-stamp: <Mar 2014-07-01 11:13 svarrette>
         | 
| 4 4 | 
             
            ################################################################################
         | 
| 5 5 | 
             
            # @author Sebastien Varrette <Sebastien.Varrette@uni.lu>
         | 
| 6 6 | 
             
            #
         | 
| @@ -26,7 +26,7 @@ module FalkorLib #:nodoc: | |
| 26 26 | 
             
                                    :filename  => 'lib/falkorlib/version.rb',
         | 
| 27 27 | 
             
                                    :getmethod => 'FalkorLib::Version.to_s',
         | 
| 28 28 | 
             
                                    #:setmethod => 'FalkorLib::Version.set',
         | 
| 29 | 
            -
                                     | 
| 29 | 
            +
                                    #:pattern   => '^(\s*)MAJOR\s*,\s*MINOR,\s*PATCH\s*=\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)'
         | 
| 30 30 | 
             
                                },
         | 
| 31 31 | 
             
                                'tag' => {
         | 
| 32 32 | 
             
                                    :suffix => 'v'
         | 
| @@ -113,7 +113,57 @@ describe FalkorLib::Common do | |
| 113 113 | 
             
                        end
         | 
| 114 114 | 
             
                    end
         | 
| 115 115 | 
             
               end
         | 
| 116 | 
            -
             | 
| 116 | 
            +
             | 
| 117 | 
            +
            	it "#nice_execute -- check stdout output" do
         | 
| 118 | 
            +
            		b = capture(:stdout) {
         | 
| 119 | 
            +
            			nice_execute("echo toto")
         | 
| 120 | 
            +
            		}
         | 
| 121 | 
            +
            		b.split("\n").should include '** [out] toto'
         | 
| 122 | 
            +
            	end
         | 
| 123 | 
            +
             | 
| 124 | 
            +
            	it "#nice_execute -- check stderr output" do
         | 
| 125 | 
            +
            		b = capture(:stderr) {
         | 
| 126 | 
            +
            			nice_execute("echo 'toto' 1>&2")
         | 
| 127 | 
            +
            		}		
         | 
| 128 | 
            +
            		b.should == red("** [err] toto\n")
         | 
| 129 | 
            +
            	end
         | 
| 130 | 
            +
             | 
| 131 | 
            +
            	it "#execute" do
         | 
| 132 | 
            +
            		b = execute("echo toto")
         | 
| 133 | 
            +
            		b.to_i.should == 0
         | 
| 134 | 
            +
            	end
         | 
| 135 | 
            +
             | 
| 136 | 
            +
            	it "#not_implemented" do
         | 
| 137 | 
            +
            		b = capture(:stderr) {
         | 
| 138 | 
            +
            			expect { not_implemented }.to raise_error (SystemExit)
         | 
| 139 | 
            +
            		}
         | 
| 140 | 
            +
            		b.should =~ /NOT YET IMPLEMENTED/ 
         | 
| 141 | 
            +
            	end
         | 
| 142 | 
            +
             | 
| 143 | 
            +
            	it "#exec_or_exit - should exit" do
         | 
| 144 | 
            +
            		expect { exec_or_exit "false" }.to raise_error (SystemExit)
         | 
| 145 | 
            +
            	end
         | 
| 146 | 
            +
            	it "#exec_or_exit - should NOT exit" do
         | 
| 147 | 
            +
            		expect { exec_or_exit "true" }.not_to raise_error (SystemExit)
         | 
| 148 | 
            +
            	end
         | 
| 149 | 
            +
             | 
| 150 | 
            +
            	it "#execute_in_dir -- should execute the command in /tmp" do
         | 
| 151 | 
            +
            		b = execute_in_dir('/tmp', "pwd | grep -Fq '/tmp'")
         | 
| 152 | 
            +
            		b.should == 0
         | 
| 153 | 
            +
            	end
         | 
| 154 | 
            +
             | 
| 155 | 
            +
             | 
| 156 | 
            +
            	it "#run -- exucute successfully multiple commands" do
         | 
| 157 | 
            +
            		b = run %{
         | 
| 158 | 
            +
                        echo toto
         | 
| 159 | 
            +
                        echo tata
         | 
| 160 | 
            +
                    }
         | 
| 161 | 
            +
            		b.to_i.should == 0
         | 
| 162 | 
            +
            	end
         | 
| 163 | 
            +
             | 
| 164 | 
            +
             | 
| 165 | 
            +
             | 
| 166 | 
            +
             | 
| 117 167 | 
             
            	#############################################
         | 
| 118 168 | 
             
                context "Test (common) YAML functions" do
         | 
| 119 169 |  | 
| @@ -0,0 +1,135 @@ | |
| 1 | 
            +
            #!/usr/bin/ruby
         | 
| 2 | 
            +
            #########################################
         | 
| 3 | 
            +
            # gitflow_spec.rb
         | 
| 4 | 
            +
            # @author Sebastien Varrette <Sebastien.Varrette@uni.lu>
         | 
| 5 | 
            +
            # Time-stamp: <Mar 2014-07-01 12:26 svarrette>
         | 
| 6 | 
            +
            #
         | 
| 7 | 
            +
            # @description Check the Git Flow operations -- see https://github.com/nvie/gitflow
         | 
| 8 | 
            +
            #
         | 
| 9 | 
            +
            # Copyright (c) 2013 Sebastien Varrette <Sebastien.Varrette@uni.lu>
         | 
| 10 | 
            +
            # .             http://varrette.gforge.uni.lu
         | 
| 11 | 
            +
            ##############################################################################
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            require 'spec_helper'
         | 
| 14 | 
            +
            require 'tmpdir'
         | 
| 15 | 
            +
             | 
| 16 | 
            +
             | 
| 17 | 
            +
            describe FalkorLib::Versioning do
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                include FalkorLib::Common
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                dir   = Dir.mktmpdir
         | 
| 22 | 
            +
                versionfile      = 'spec_gem_version.rb'
         | 
| 23 | 
            +
                versionfile_path = File.join(dir, versionfile)
         | 
| 24 | 
            +
                default_version  = FalkorLib.config[:versioning][:default]
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                workingversion = {
         | 
| 27 | 
            +
                    :default => '4.5.6',
         | 
| 28 | 
            +
                    :patch   => '4.5.7',
         | 
| 29 | 
            +
                    :minor   => '4.6.0',
         | 
| 30 | 
            +
                    :major   => '5.0.0'
         | 
| 31 | 
            +
                }
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                after :all do
         | 
| 34 | 
            +
                    FileUtils.remove_entry_secure dir
         | 
| 35 | 
            +
            		configatron.temp do
         | 
| 36 | 
            +
            			FalkorLib.config.versioning[:type] = 'file'
         | 
| 37 | 
            +
            		end 
         | 
| 38 | 
            +
                end
         | 
| 39 | 
            +
             | 
| 40 | 
            +
                configatron.temp do
         | 
| 41 | 
            +
                    FalkorLib.config.versioning do |c|
         | 
| 42 | 
            +
                        c[:type] = 'gem'
         | 
| 43 | 
            +
                        c[:source]['gem'][:filename]  = "#{versionfile}"
         | 
| 44 | 
            +
                        c[:source]['gem'][:getmethod] = "::TestGemVersion.version"
         | 
| 45 | 
            +
                    end
         | 
| 46 | 
            +
             | 
| 47 | 
            +
             | 
| 48 | 
            +
                    ###################################################################
         | 
| 49 | 
            +
                    context 'Test GEM versioning operations within temporary directory' do
         | 
| 50 | 
            +
                        it "#get_version -- NameError on non-existing method" do
         | 
| 51 | 
            +
            				if command?('git_flow')
         | 
| 52 | 
            +
                                STDIN.should_receive(:gets).and_return('Yes')
         | 
| 53 | 
            +
                                t = FalkorLib::GitFlow.init(dir)
         | 
| 54 | 
            +
                                t.should == 0
         | 
| 55 | 
            +
                            else
         | 
| 56 | 
            +
                                t = FalkorLib::Git.init(dir)
         | 
| 57 | 
            +
                                t.should be_true
         | 
| 58 | 
            +
                            end
         | 
| 59 | 
            +
                            expect { FalkorLib::Versioning.get_version(dir) }.to raise_error (NameError)
         | 
| 60 | 
            +
                        end
         | 
| 61 | 
            +
             | 
| 62 | 
            +
                        File.open(versionfile_path, 'w') do |f|
         | 
| 63 | 
            +
                            f.puts "module TestGemVersion"
         | 
| 64 | 
            +
                            f.puts "   MAJOR, MINOR, PATCH = 4, 5, 6"
         | 
| 65 | 
            +
                            f.puts "   module_function"
         | 
| 66 | 
            +
                            f.puts "   def version"
         | 
| 67 | 
            +
                            f.puts "      [ MAJOR, MINOR, PATCH ].join('.')"
         | 
| 68 | 
            +
                            f.puts "   end"
         | 
| 69 | 
            +
                            f.puts "end"
         | 
| 70 | 
            +
                        end
         | 
| 71 | 
            +
             | 
| 72 | 
            +
                        it "initializes the Gem version file #{versionfile} " do
         | 
| 73 | 
            +
                            t = File.exists?(versionfile_path)
         | 
| 74 | 
            +
                            t.should be_true
         | 
| 75 | 
            +
                            u = run %{ cat #{versionfile_path} }
         | 
| 76 | 
            +
                            u.to_i.should == 0
         | 
| 77 | 
            +
                        end
         | 
| 78 | 
            +
             | 
| 79 | 
            +
                        it "#get_version -- should get the '#{workingversion[:default]}' version set in the file #{versionfile}" do
         | 
| 80 | 
            +
                            load "#{versionfile_path}"
         | 
| 81 | 
            +
                            v = FalkorLib::Versioning.get_version(dir)
         | 
| 82 | 
            +
                            v.should == workingversion[:default]
         | 
| 83 | 
            +
                        end
         | 
| 84 | 
            +
             | 
| 85 | 
            +
                        it "#major -- should collect the Gem major version" do
         | 
| 86 | 
            +
                            v = FalkorLib::Versioning.get_version(dir)
         | 
| 87 | 
            +
                            m = FalkorLib::Versioning.major(v)
         | 
| 88 | 
            +
                            m.should == '4'
         | 
| 89 | 
            +
                        end
         | 
| 90 | 
            +
                        it "#minor -- should collect the Gem minor version" do
         | 
| 91 | 
            +
                            v = FalkorLib::Versioning.get_version(dir)
         | 
| 92 | 
            +
                            m = FalkorLib::Versioning.minor(v)
         | 
| 93 | 
            +
                            m.should == '5'
         | 
| 94 | 
            +
                        end
         | 
| 95 | 
            +
                        it "#patch -- should collect the Gem patch version" do
         | 
| 96 | 
            +
                            v = FalkorLib::Versioning.get_version(dir)
         | 
| 97 | 
            +
                            m = FalkorLib::Versioning.patch(v)
         | 
| 98 | 
            +
                            m.should == '6'
         | 
| 99 | 
            +
                        end
         | 
| 100 | 
            +
             | 
| 101 | 
            +
                        it "#set_version -- set Gem version #{default_version} in version file #{versionfile}" do
         | 
| 102 | 
            +
                            STDIN.should_receive(:gets).and_return('Yes')
         | 
| 103 | 
            +
                            v = FalkorLib::Versioning.set_version(default_version, dir)
         | 
| 104 | 
            +
                            v.should == 0
         | 
| 105 | 
            +
                            load "#{versionfile_path}"
         | 
| 106 | 
            +
                            v = FalkorLib::Versioning.get_version(dir)
         | 
| 107 | 
            +
                            v.should == default_version
         | 
| 108 | 
            +
                        end
         | 
| 109 | 
            +
             | 
| 110 | 
            +
                        #FalkorLib.config[:versioning][:levels].reverse.each do |level|
         | 
| 111 | 
            +
                        [ :patch, :minor ].each do |level|
         | 
| 112 | 
            +
                            it "#set_version #bump -- #{level} bump Gem version number from #{workingversion[:default]} to #{workingversion[level.to_sym]}" do
         | 
| 113 | 
            +
                                # restore version file
         | 
| 114 | 
            +
                                STDIN.should_receive(:gets).and_return('Yes')
         | 
| 115 | 
            +
                                v = FalkorLib::Versioning.set_version(workingversion[:default], dir)
         | 
| 116 | 
            +
                                v.should == 0
         | 
| 117 | 
            +
                                load "#{versionfile_path}"
         | 
| 118 | 
            +
                                v = FalkorLib::Versioning.get_version(dir)
         | 
| 119 | 
            +
                                v.should == workingversion[:default]
         | 
| 120 | 
            +
                                # Let's bump
         | 
| 121 | 
            +
                                v2 = FalkorLib::Versioning.bump(v, level.to_sym)
         | 
| 122 | 
            +
                                v2.should == workingversion[level.to_sym]
         | 
| 123 | 
            +
                                STDIN.should_receive(:gets).and_return('Yes')
         | 
| 124 | 
            +
                                d = FalkorLib::Versioning.set_version(v2, dir)
         | 
| 125 | 
            +
                                d.should == 0
         | 
| 126 | 
            +
                                load "#{versionfile_path}"
         | 
| 127 | 
            +
                                v3 = FalkorLib::Versioning.get_version(dir)
         | 
| 128 | 
            +
                                v3.should == v2
         | 
| 129 | 
            +
                            end
         | 
| 130 | 
            +
                        end
         | 
| 131 | 
            +
                    end
         | 
| 132 | 
            +
             | 
| 133 | 
            +
                end #configatron.temp
         | 
| 134 | 
            +
             | 
| 135 | 
            +
            end # describe FalkorLib::Versioning
         | 
| @@ -1,10 +1,10 @@ | |
| 1 1 | 
             
            #!/usr/bin/ruby
         | 
| 2 2 | 
             
            #########################################
         | 
| 3 | 
            -
            #  | 
| 3 | 
            +
            # versioning_spec.rb
         | 
| 4 4 | 
             
            # @author Sebastien Varrette <Sebastien.Varrette@uni.lu>
         | 
| 5 | 
            -
            # Time-stamp: < | 
| 5 | 
            +
            # Time-stamp: <Mar 2014-07-01 12:26 svarrette>
         | 
| 6 6 | 
             
            #
         | 
| 7 | 
            -
            # @description Check the  | 
| 7 | 
            +
            # @description Check the versioning operations
         | 
| 8 8 | 
             
            #
         | 
| 9 9 | 
             
            # Copyright (c) 2013 Sebastien Varrette <Sebastien.Varrette@uni.lu>
         | 
| 10 10 | 
             
            # .             http://varrette.gforge.uni.lu
         | 
| @@ -13,6 +13,8 @@ | |
| 13 13 | 
             
            require 'spec_helper'
         | 
| 14 14 | 
             
            require 'tmpdir'
         | 
| 15 15 |  | 
| 16 | 
            +
             | 
| 17 | 
            +
             | 
| 16 18 | 
             
            describe FalkorLib::Versioning do
         | 
| 17 19 |  | 
| 18 20 | 
             
                include FalkorLib::Common
         | 
| @@ -32,82 +34,68 @@ describe FalkorLib::Versioning do | |
| 32 34 | 
             
                    FileUtils.remove_entry_secure dir
         | 
| 33 35 | 
             
                end
         | 
| 34 36 |  | 
| 35 | 
            -
             | 
| 36 37 | 
             
                ###################################################################
         | 
| 37 38 | 
             
                context 'Test versioning operations within temporary directory' do
         | 
| 38 39 |  | 
| 39 40 | 
             
                    it "#get_version -- get default version #{default_version}" do
         | 
| 40 | 
            -
             | 
| 41 | 
            -
             | 
| 42 | 
            -
             | 
| 43 | 
            -
             | 
| 44 | 
            -
             | 
| 45 | 
            -
             | 
| 46 | 
            -
             | 
| 47 | 
            -
             | 
| 48 | 
            -
             | 
| 41 | 
            +
                        if command?('git_flow')
         | 
| 42 | 
            +
                            STDIN.should_receive(:gets).and_return('Yes')
         | 
| 43 | 
            +
                            t = FalkorLib::GitFlow.init(dir)
         | 
| 44 | 
            +
                            t.should == 0
         | 
| 45 | 
            +
                        else
         | 
| 46 | 
            +
                            t = FalkorLib::Git.init(dir)
         | 
| 47 | 
            +
                            t.should be_true
         | 
| 48 | 
            +
                        end
         | 
| 49 | 
            +
                        v = FalkorLib::Versioning.get_version(dir)
         | 
| 49 50 | 
             
                        v.should == default_version
         | 
| 50 51 | 
             
                    end
         | 
| 51 52 |  | 
| 52 | 
            -
                     | 
| 53 | 
            -
             | 
| 54 | 
            -
             | 
| 55 | 
            -
             | 
| 56 | 
            -
                     | 
| 57 | 
            -
             | 
| 58 | 
            -
                    # it "#set_version -- set version #{default_version} in version file #{versionfile}" do
         | 
| 59 | 
            -
                    #     STDIN.should_receive(:gets).and_return('no')
         | 
| 60 | 
            -
                    #     v = FalkorLib::Versioning.set_version(default_version, dir)
         | 
| 61 | 
            -
                    #     v.should == 0
         | 
| 62 | 
            -
                    #     v = FalkorLib::Versioning.get_version(dir)
         | 
| 63 | 
            -
                    #     v.should == default_version
         | 
| 64 | 
            -
                    # end
         | 
| 65 | 
            -
             | 
| 66 | 
            -
                    # FalkorLib.config[:versioning][:levels].reverse.each do |level|
         | 
| 67 | 
            -
                    #     it "#set_version #bump -- #{level} bump version number from #{workingversion[:default]} to #{workingversion[level.to_sym]}" do
         | 
| 68 | 
            -
                    #         # restore version file
         | 
| 69 | 
            -
                    #         execute "echo #{workingversion[:default]} > #{dir}/#{versionfile}"
         | 
| 70 | 
            -
                    #         v  = FalkorLib::Versioning.get_version(dir)
         | 
| 71 | 
            -
                    #         v.should == workingversion[:default]
         | 
| 72 | 
            -
                    #         v2 = FalkorLib::Versioning.bump(v, level.to_sym)
         | 
| 73 | 
            -
                    #         v2.should == workingversion[level.to_sym]
         | 
| 74 | 
            -
                    #         STDIN.should_receive(:gets).and_return('no')
         | 
| 75 | 
            -
                    #         d = FalkorLib::Versioning.set_version(v2, dir)
         | 
| 76 | 
            -
                    #         d.should == 0
         | 
| 77 | 
            -
                    #         v3 = FalkorLib::Versioning.get_version(dir)
         | 
| 78 | 
            -
                    #         v3.should == v2
         | 
| 79 | 
            -
                    #     end
         | 
| 80 | 
            -
                    # end
         | 
| 81 | 
            -
             | 
| 82 | 
            -
                    # it "should do something" do
         | 
| 53 | 
            +
                    it "#get_version -- should get the '#{workingversion[:default]}' version set in the file #{versionfile}" do
         | 
| 54 | 
            +
                        execute "echo #{workingversion[:default]} > #{dir}/#{versionfile}"
         | 
| 55 | 
            +
                        v = FalkorLib::Versioning.get_version(dir)
         | 
| 56 | 
            +
                        v.should == workingversion[:default]
         | 
| 57 | 
            +
                    end
         | 
| 83 58 |  | 
| 84 | 
            -
                    #  | 
| 59 | 
            +
                    it "#major -- should collect the major version" do
         | 
| 60 | 
            +
                        v = FalkorLib::Versioning.get_version(dir)
         | 
| 61 | 
            +
                        m = FalkorLib::Versioning.major(v)
         | 
| 62 | 
            +
                        m.should == '1'
         | 
| 63 | 
            +
                    end
         | 
| 64 | 
            +
                    it "#minor -- should collect the minor version" do
         | 
| 65 | 
            +
                        v = FalkorLib::Versioning.get_version(dir)
         | 
| 66 | 
            +
                        m = FalkorLib::Versioning.minor(v)
         | 
| 67 | 
            +
                        m.should == '2'
         | 
| 68 | 
            +
                    end
         | 
| 69 | 
            +
                    it "#patch -- should collect the patch version" do
         | 
| 70 | 
            +
                        v = FalkorLib::Versioning.get_version(dir)
         | 
| 71 | 
            +
                        m = FalkorLib::Versioning.patch(v)
         | 
| 72 | 
            +
                        m.should == '3'
         | 
| 73 | 
            +
                    end
         | 
| 85 74 |  | 
| 86 75 |  | 
| 87 | 
            -
                     | 
| 88 | 
            -
             | 
| 89 | 
            -
             | 
| 90 | 
            -
             | 
| 91 | 
            -
             | 
| 76 | 
            +
                    it "#set_version -- set version #{default_version} in version file #{versionfile}" do
         | 
| 77 | 
            +
                        STDIN.should_receive(:gets).and_return('no')
         | 
| 78 | 
            +
                        v = FalkorLib::Versioning.set_version(default_version, dir)
         | 
| 79 | 
            +
                        v.should == 0
         | 
| 80 | 
            +
                        v = FalkorLib::Versioning.get_version(dir)
         | 
| 81 | 
            +
                        v.should == default_version
         | 
| 82 | 
            +
                    end
         | 
| 92 83 |  | 
| 93 | 
            -
                     | 
| 94 | 
            -
             | 
| 95 | 
            -
             | 
| 96 | 
            -
             | 
| 97 | 
            -
             | 
| 98 | 
            -
             | 
| 99 | 
            -
             | 
| 100 | 
            -
             | 
| 101 | 
            -
             | 
| 102 | 
            -
             | 
| 103 | 
            -
             | 
| 104 | 
            -
             | 
| 105 | 
            -
             | 
| 106 | 
            -
             | 
| 107 | 
            -
                     | 
| 108 | 
            -
                    #         v3.should == v2
         | 
| 109 | 
            -
                    #     end
         | 
| 110 | 
            -
                    # end
         | 
| 84 | 
            +
                    FalkorLib.config[:versioning][:levels].reverse.each do |level|
         | 
| 85 | 
            +
                        it "#set_version #bump -- #{level} bump version number from #{workingversion[:default]} to #{workingversion[level.to_sym]}" do
         | 
| 86 | 
            +
                            # restore version file
         | 
| 87 | 
            +
                            execute "echo #{workingversion[:default]} > #{dir}/#{versionfile}"
         | 
| 88 | 
            +
                            v  = FalkorLib::Versioning.get_version(dir)
         | 
| 89 | 
            +
                            v.should == workingversion[:default]
         | 
| 90 | 
            +
                            v2 = FalkorLib::Versioning.bump(v, level.to_sym)
         | 
| 91 | 
            +
                            v2.should == workingversion[level.to_sym]
         | 
| 92 | 
            +
                            STDIN.should_receive(:gets).and_return('no')
         | 
| 93 | 
            +
                            d = FalkorLib::Versioning.set_version(v2, dir)
         | 
| 94 | 
            +
                            d.should == 0
         | 
| 95 | 
            +
                            v3 = FalkorLib::Versioning.get_version(dir)
         | 
| 96 | 
            +
                            v3.should == v2
         | 
| 97 | 
            +
                        end
         | 
| 98 | 
            +
                    end
         | 
| 111 99 |  | 
| 112 100 | 
             
                end
         | 
| 113 101 | 
             
            end
         | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: falkorlib
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.2. | 
| 4 | 
            +
              version: 0.2.11
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Sebastien Varrette
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2014- | 
| 11 | 
            +
            date: 2014-07-01 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rake
         | 
| @@ -204,6 +204,20 @@ dependencies: | |
| 204 204 | 
             
                - - "~>"
         | 
| 205 205 | 
             
                  - !ruby/object:Gem::Version
         | 
| 206 206 | 
             
                    version: '1.8'
         | 
| 207 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 208 | 
            +
              name: codeclimate-test-reporter
         | 
| 209 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 210 | 
            +
                requirements:
         | 
| 211 | 
            +
                - - ">="
         | 
| 212 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 213 | 
            +
                    version: '0'
         | 
| 214 | 
            +
              type: :development
         | 
| 215 | 
            +
              prerelease: false
         | 
| 216 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 217 | 
            +
                requirements:
         | 
| 218 | 
            +
                - - ">="
         | 
| 219 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 220 | 
            +
                    version: '0'
         | 
| 207 221 | 
             
            description: "This is my personal library I use to share the Ruby tidbits, Rake and
         | 
| 208 222 | 
             
              Capistrano tasks I made for my various projects. \nThis is also my first gem so
         | 
| 209 223 | 
             
              any comments on the code/organization are welcome, I'm a newbie in this domain.
         | 
| @@ -248,6 +262,7 @@ files: | |
| 248 262 | 
             
            - spec/falkorlib/common_spec.rb
         | 
| 249 263 | 
             
            - spec/falkorlib/git_spec.rb
         | 
| 250 264 | 
             
            - spec/falkorlib/gitflow_spec.rb
         | 
| 265 | 
            +
            - spec/falkorlib/versioning_gem_spec.rb
         | 
| 251 266 | 
             
            - spec/falkorlib/versioning_spec.rb
         | 
| 252 267 | 
             
            - spec/falkorlib_spec.rb
         | 
| 253 268 | 
             
            - spec/spec_helper.rb
         | 
| @@ -281,6 +296,7 @@ test_files: | |
| 281 296 | 
             
            - spec/falkorlib/common_spec.rb
         | 
| 282 297 | 
             
            - spec/falkorlib/git_spec.rb
         | 
| 283 298 | 
             
            - spec/falkorlib/gitflow_spec.rb
         | 
| 299 | 
            +
            - spec/falkorlib/versioning_gem_spec.rb
         | 
| 284 300 | 
             
            - spec/falkorlib/versioning_spec.rb
         | 
| 285 301 | 
             
            - spec/falkorlib_spec.rb
         | 
| 286 302 | 
             
            - spec/spec_helper.rb
         |