dev_git 0.0.1 → 0.0.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/lib/dev_git.rb +3 -3
- data/lib/git.rb +45 -45
- data/spec/dev_git_spec.rb +6 -6
- data/spec/git_spec.rb +10 -10
- metadata +19 -14
- checksums.yaml +0 -7
    
        data/lib/dev_git.rb
    CHANGED
    
    | @@ -1,4 +1,4 @@ | |
| 1 | 
            -
            require_relative 'git.rb'
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            class DevGit
         | 
| 1 | 
            +
            require_relative 'git.rb'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            class DevGit
         | 
| 4 4 | 
             
            end
         | 
    
        data/lib/git.rb
    CHANGED
    
    | @@ -1,46 +1,46 @@ | |
| 1 | 
            -
            class Git
         | 
| 2 | 
            -
            	def self.branch
         | 
| 3 | 
            -
            		begin
         | 
| 4 | 
            -
            		  `git branch`.scan(/\* ([.\w-]+)/)[0][0]
         | 
| 5 | 
            -
            	    rescue
         | 
| 6 | 
            -
            	    	''
         | 
| 7 | 
            -
            	    end
         | 
| 8 | 
            -
                end
         | 
| 9 | 
            -
             | 
| 10 | 
            -
                def self.remote_origin directory=''
         | 
| 11 | 
            -
                	url=''
         | 
| 12 | 
            -
                	directory=Dir.pwd if directory.length == 0
         | 
| 13 | 
            -
                	Dir.chdir(directory) do
         | 
| 14 | 
            -
                		begin
         | 
| 15 | 
            -
                			url=`git remote show origin`.scan(/Fetch URL: ([\.\-:\/\w\d]+)/)[0][0]
         | 
| 16 | 
            -
                		rescue
         | 
| 17 | 
            -
                			url=''
         | 
| 18 | 
            -
                		end
         | 
| 19 | 
            -
                	end
         | 
| 20 | 
            -
                	url
         | 
| 21 | 
            -
                end
         | 
| 22 | 
            -
             | 
| 23 | 
            -
                def self.has_changes? directory=''
         | 
| 24 | 
            -
                    directory=Dir.pwd if directory.length==0
         | 
| 25 | 
            -
                    Dir.chdir(directory) do
         | 
| 26 | 
            -
                        if(File.exists?('.git'))
         | 
| 27 | 
            -
                            return true if `git status`.include?('modified:')
         | 
| 28 | 
            -
                        end
         | 
| 29 | 
            -
                    end
         | 
| 30 | 
            -
                    false
         | 
| 31 | 
            -
                    # $ git status
         | 
| 32 | 
            -
                    # On branch master
         | 
| 33 | 
            -
                    # nothing to commit, working directory clean
         | 
| 34 | 
            -
             | 
| 35 | 
            -
                    # $ git status
         | 
| 36 | 
            -
                    # On branch master
         | 
| 37 | 
            -
                    # Changes not staged for commit:
         | 
| 38 | 
            -
                    #   (use "git add <file>..." to update what will be committed)
         | 
| 39 | 
            -
                    #   (use "git checkout -- <file>..." to discard changes in working directory)
         | 
| 40 | 
            -
                    #
         | 
| 41 | 
            -
                    #   modified:   lib/git.rb
         | 
| 42 | 
            -
                    #
         | 
| 43 | 
            -
                    # no changes added to commit (use "git add" and/or "git commit -a")
         | 
| 44 | 
            -
             | 
| 45 | 
            -
                end
         | 
| 1 | 
            +
            class Git
         | 
| 2 | 
            +
            	def self.branch
         | 
| 3 | 
            +
            		begin
         | 
| 4 | 
            +
            		  `git branch`.scan(/\* ([.\w-]+)/)[0][0] if(File.exists?('.git'))
         | 
| 5 | 
            +
            	    rescue
         | 
| 6 | 
            +
            	    	''
         | 
| 7 | 
            +
            	    end
         | 
| 8 | 
            +
                end
         | 
| 9 | 
            +
             | 
| 10 | 
            +
                def self.remote_origin directory=''
         | 
| 11 | 
            +
                	url=''
         | 
| 12 | 
            +
                	directory=Dir.pwd if directory.length == 0
         | 
| 13 | 
            +
                	Dir.chdir(directory) do
         | 
| 14 | 
            +
                		begin
         | 
| 15 | 
            +
                			url=`git remote show origin`.scan(/Fetch URL: ([\.\-:\/\w\d]+)/)[0][0] if(File.exists?('.git'))
         | 
| 16 | 
            +
                		rescue
         | 
| 17 | 
            +
                			url=''
         | 
| 18 | 
            +
                		end
         | 
| 19 | 
            +
                	end
         | 
| 20 | 
            +
                	url
         | 
| 21 | 
            +
                end
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                def self.has_changes? directory=''
         | 
| 24 | 
            +
                    directory=Dir.pwd if directory.length==0
         | 
| 25 | 
            +
                    Dir.chdir(directory) do
         | 
| 26 | 
            +
                        if(File.exists?('.git'))
         | 
| 27 | 
            +
                            return true if `git status`.include?('modified:')
         | 
| 28 | 
            +
                        end
         | 
| 29 | 
            +
                    end
         | 
| 30 | 
            +
                    false
         | 
| 31 | 
            +
                    # $ git status
         | 
| 32 | 
            +
                    # On branch master
         | 
| 33 | 
            +
                    # nothing to commit, working directory clean
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                    # $ git status
         | 
| 36 | 
            +
                    # On branch master
         | 
| 37 | 
            +
                    # Changes not staged for commit:
         | 
| 38 | 
            +
                    #   (use "git add <file>..." to update what will be committed)
         | 
| 39 | 
            +
                    #   (use "git checkout -- <file>..." to discard changes in working directory)
         | 
| 40 | 
            +
                    #
         | 
| 41 | 
            +
                    #   modified:   lib/git.rb
         | 
| 42 | 
            +
                    #
         | 
| 43 | 
            +
                    # no changes added to commit (use "git add" and/or "git commit -a")
         | 
| 44 | 
            +
             | 
| 45 | 
            +
                end
         | 
| 46 46 | 
             
            end
         | 
    
        data/spec/dev_git_spec.rb
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 | 
            -
            require_relative '../lib/dev_git.rb'
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            describe DevGit do
         | 
| 4 | 
            -
            	#it "should fail tests" do
         | 
| 5 | 
            -
            	#	expect(true).to eq(false)
         | 
| 6 | 
            -
            	#end
         | 
| 1 | 
            +
            require_relative '../lib/dev_git.rb'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            describe DevGit do
         | 
| 4 | 
            +
            	#it "should fail tests" do
         | 
| 5 | 
            +
            	#	expect(true).to eq(false)
         | 
| 6 | 
            +
            	#end
         | 
| 7 7 | 
             
            end
         | 
    
        data/spec/git_spec.rb
    CHANGED
    
    | @@ -1,11 +1,11 @@ | |
| 1 | 
            -
            require_relative '../lib/git.rb'
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            describe Git do
         | 
| 4 | 
            -
            	it "should be able to get the remote origin" do
         | 
| 5 | 
            -
            		expect(Git.remote_origin).to eq('https://github.com/lou-parslow/dev_git.gem.git')
         | 
| 6 | 
            -
            	end
         | 
| 7 | 
            -
             | 
| 8 | 
            -
            	it "should be able to get the current branch" do
         | 
| 9 | 
            -
            		expect(Git.branch).not_to eq('')
         | 
| 10 | 
            -
            	end
         | 
| 1 | 
            +
            require_relative '../lib/git.rb'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            describe Git do
         | 
| 4 | 
            +
            	it "should be able to get the remote origin" do
         | 
| 5 | 
            +
            		expect(Git.remote_origin).to eq('https://github.com/lou-parslow/dev_git.gem.git')
         | 
| 6 | 
            +
            	end
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            	it "should be able to get the current branch" do
         | 
| 9 | 
            +
            		expect(Git.branch).not_to eq('')
         | 
| 10 | 
            +
            	end
         | 
| 11 11 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,41 +1,46 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: dev_git
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.2
         | 
| 5 | 
            +
              prerelease: 
         | 
| 5 6 | 
             
            platform: ruby
         | 
| 6 7 | 
             
            authors:
         | 
| 7 8 | 
             
            - Lou Parslow
         | 
| 8 9 | 
             
            autorequire: 
         | 
| 9 10 | 
             
            bindir: bin
         | 
| 10 11 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2015-01- | 
| 12 | 
            +
            date: 2015-01-19 00:00:00.000000000 Z
         | 
| 12 13 | 
             
            dependencies:
         | 
| 13 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 15 | 
             
              name: rake
         | 
| 15 16 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 17 | 
            +
                none: false
         | 
| 16 18 | 
             
                requirements:
         | 
| 17 | 
            -
                - -  | 
| 19 | 
            +
                - - ~>
         | 
| 18 20 | 
             
                  - !ruby/object:Gem::Version
         | 
| 19 21 | 
             
                    version: '10.0'
         | 
| 20 22 | 
             
              type: :development
         | 
| 21 23 | 
             
              prerelease: false
         | 
| 22 24 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 25 | 
            +
                none: false
         | 
| 23 26 | 
             
                requirements:
         | 
| 24 | 
            -
                - -  | 
| 27 | 
            +
                - - ~>
         | 
| 25 28 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 29 | 
             
                    version: '10.0'
         | 
| 27 30 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 31 | 
             
              name: rspec
         | 
| 29 32 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 33 | 
            +
                none: false
         | 
| 30 34 | 
             
                requirements:
         | 
| 31 | 
            -
                - -  | 
| 35 | 
            +
                - - ~>
         | 
| 32 36 | 
             
                  - !ruby/object:Gem::Version
         | 
| 33 37 | 
             
                    version: '3.0'
         | 
| 34 38 | 
             
              type: :development
         | 
| 35 39 | 
             
              prerelease: false
         | 
| 36 40 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 41 | 
            +
                none: false
         | 
| 37 42 | 
             
                requirements:
         | 
| 38 | 
            -
                - -  | 
| 43 | 
            +
                - - ~>
         | 
| 39 44 | 
             
                  - !ruby/object:Gem::Version
         | 
| 40 45 | 
             
                    version: '3.0'
         | 
| 41 46 | 
             
            description: execution of git operations
         | 
| @@ -44,35 +49,35 @@ executables: [] | |
| 44 49 | 
             
            extensions: []
         | 
| 45 50 | 
             
            extra_rdoc_files: []
         | 
| 46 51 | 
             
            files:
         | 
| 47 | 
            -
            - LICENSE
         | 
| 48 | 
            -
            - README.md
         | 
| 49 52 | 
             
            - lib/dev_git.rb
         | 
| 50 53 | 
             
            - lib/git.rb
         | 
| 51 54 | 
             
            - spec/dev_git_spec.rb
         | 
| 52 55 | 
             
            - spec/git_spec.rb
         | 
| 56 | 
            +
            - LICENSE
         | 
| 57 | 
            +
            - README.md
         | 
| 53 58 | 
             
            homepage: http://github.com/lou-parslow/dev_git.gem
         | 
| 54 59 | 
             
            licenses:
         | 
| 55 60 | 
             
            - Apache 2.0
         | 
| 56 | 
            -
            metadata: {}
         | 
| 57 61 | 
             
            post_install_message: 
         | 
| 58 62 | 
             
            rdoc_options: []
         | 
| 59 63 | 
             
            require_paths:
         | 
| 60 64 | 
             
            - lib
         | 
| 61 65 | 
             
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 66 | 
            +
              none: false
         | 
| 62 67 | 
             
              requirements:
         | 
| 63 | 
            -
              - -  | 
| 68 | 
            +
              - - ! '>='
         | 
| 64 69 | 
             
                - !ruby/object:Gem::Version
         | 
| 65 70 | 
             
                  version: '0'
         | 
| 66 71 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 72 | 
            +
              none: false
         | 
| 67 73 | 
             
              requirements:
         | 
| 68 | 
            -
              - -  | 
| 74 | 
            +
              - - ! '>='
         | 
| 69 75 | 
             
                - !ruby/object:Gem::Version
         | 
| 70 76 | 
             
                  version: '0'
         | 
| 71 77 | 
             
            requirements: []
         | 
| 72 78 | 
             
            rubyforge_project: 
         | 
| 73 | 
            -
            rubygems_version:  | 
| 79 | 
            +
            rubygems_version: 1.8.24
         | 
| 74 80 | 
             
            signing_key: 
         | 
| 75 | 
            -
            specification_version:  | 
| 81 | 
            +
            specification_version: 3
         | 
| 76 82 | 
             
            summary: gem to assist with git operations
         | 
| 77 83 | 
             
            test_files: []
         | 
| 78 | 
            -
            has_rdoc: 
         | 
    
        checksums.yaml
    DELETED
    
    | @@ -1,7 +0,0 @@ | |
| 1 | 
            -
            ---
         | 
| 2 | 
            -
            SHA1:
         | 
| 3 | 
            -
              metadata.gz: 7bb250c0996f50c47a9dd25e8dfae91ddb8ac285
         | 
| 4 | 
            -
              data.tar.gz: 0f973dbabd5b22139e5aed5cb35c24e8f338224a
         | 
| 5 | 
            -
            SHA512:
         | 
| 6 | 
            -
              metadata.gz: 21360dfb65d82af2c67865fdb7fbc1785229b9cf50e1a3fb63cbd43922a9d5cc9a4f2161d646b8abad9ac4795611cc62ca9ccffa9dd1295f82aeb3e9111816d2
         | 
| 7 | 
            -
              data.tar.gz: 130d0c2404ede542523ecc58dfb4ce5584b3142f32fade5cb92d1c7834f6efdf68a3165c0897f369beebb18a925cc1945958f4cfba7def2cf0f5b62a52927ce3
         |