git-make_mirror 1.0.2 → 1.1.0
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/lib/git/make_mirror.rb +24 -3
 - data/lib/git/make_mirror/version.rb +1 -1
 - metadata +2 -3
 - data/.travis.yml +0 -5
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: ea0d5f1842e9455d45abedffbf0073babf4f83c1
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 2d263428306c0efed187a480cef026ef4e7017ed
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 110bafd84407cb517ae09370a5dc2408b313282016aed7cd0c18c761b98f1eaae510bf7e233a6b2282721bf302639d8115dcc32a1d15f89de0d3231540b205c1
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 6495868c7a39934d115a03327fbdcb7a51803da31e21f98f426b2216ebad69a598ce84eb65f98e8188b88f54694eb51e3adcaeeaa2baeb72fc995c650bb18585
         
     | 
    
        data/lib/git/make_mirror.rb
    CHANGED
    
    | 
         @@ -9,11 +9,17 @@ module Git 
     | 
|
| 
       9 
9 
     | 
    
         
             
            				opts = Trollop::options do
         
     | 
| 
       10 
10 
     | 
    
         
             
            					version "git-make-mirror #{Git::MakeMirror::VERSION} (c) 2017 @reednj (reednj@gmail.com)"
         
     | 
| 
       11 
11 
     | 
    
         
             
            					banner "Usage: git make-mirror [options] [remote]"
         
     | 
| 
       12 
     | 
    
         
            -
            					opt :remote, "create a remote in the local repository", :type => :string
         
     | 
| 
      
 12 
     | 
    
         
            +
            					opt :remote, "create a remote with the given name in the local repository", :type => :string
         
     | 
| 
      
 13 
     | 
    
         
            +
            					opt :local, "configure a local repository to receive pushes", :default => false
         
     | 
| 
       13 
14 
     | 
    
         
             
            					opt :push, "push to the newly created mirror"
         
     | 
| 
       14 
15 
     | 
    
         
             
            				end
         
     | 
| 
       15 
16 
     | 
    
         | 
| 
       16 
     | 
    
         
            -
            				Trollop::educate if remote_url.nil? || remote_url == ''
         
     | 
| 
      
 17 
     | 
    
         
            +
            				Trollop::educate if (remote_url.nil? || remote_url == '') && !opts[:local]
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            				if opts[:local]
         
     | 
| 
      
 20 
     | 
    
         
            +
            					configure_repository_local
         
     | 
| 
      
 21 
     | 
    
         
            +
            					return
         
     | 
| 
      
 22 
     | 
    
         
            +
            				end
         
     | 
| 
       17 
23 
     | 
    
         | 
| 
       18 
24 
     | 
    
         
             
            				git_remote_name = nil
         
     | 
| 
       19 
25 
     | 
    
         | 
| 
         @@ -43,6 +49,10 @@ module Git 
     | 
|
| 
       43 
49 
     | 
    
         
             
            				@hooks_dir ||= File.join(File.dirname(__FILE__), 'hooks')
         
     | 
| 
       44 
50 
     | 
    
         
             
            			end
         
     | 
| 
       45 
51 
     | 
    
         | 
| 
      
 52 
     | 
    
         
            +
            			def local_hook_file
         
     | 
| 
      
 53 
     | 
    
         
            +
            				@local_hook_file ||= File.join(local_hooks_dir, 'post-receive.rb')
         
     | 
| 
      
 54 
     | 
    
         
            +
            			end
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
       46 
56 
     | 
    
         
             
            			def remote_url
         
     | 
| 
       47 
57 
     | 
    
         
             
            				(ARGV.last || '').strip
         
     | 
| 
       48 
58 
     | 
    
         
             
            			end
         
     | 
| 
         @@ -69,12 +79,23 @@ module Git 
     | 
|
| 
       69 
79 
     | 
    
         
             
            				]
         
     | 
| 
       70 
80 
     | 
    
         
             
            			end
         
     | 
| 
       71 
81 
     | 
    
         | 
| 
      
 82 
     | 
    
         
            +
            			def configure_repository_local
         
     | 
| 
      
 83 
     | 
    
         
            +
            				hook_file = '.git/hooks/post-receive'
         
     | 
| 
      
 84 
     | 
    
         
            +
            				sh 'git config receive.denyCurrentBranch ignore'
         
     | 
| 
      
 85 
     | 
    
         
            +
            				FileUtils.cp local_hook_file, hook_file
         
     | 
| 
      
 86 
     | 
    
         
            +
            				sh "chmod 775 #{hook_file}"
         
     | 
| 
      
 87 
     | 
    
         
            +
            			end
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
       72 
89 
     | 
    
         
             
            			def copy_hook
         
     | 
| 
       73 
     | 
    
         
            -
            				local_hook_file = File.join local_hooks_dir, 'post-receive.rb'
         
     | 
| 
       74 
90 
     | 
    
         
             
            				remote_hook_file = File.join remote[:path], '.git/hooks/post-receive'
         
     | 
| 
       75 
91 
     | 
    
         
             
            				server.scp local_hook_file, remote_hook_file
         
     | 
| 
       76 
92 
     | 
    
         
             
            				server.exec "chmod 775 #{remote_hook_file}"
         
     | 
| 
       77 
93 
     | 
    
         
             
            			end
         
     | 
| 
      
 94 
     | 
    
         
            +
             
     | 
| 
      
 95 
     | 
    
         
            +
            			def sh(cmd)
         
     | 
| 
      
 96 
     | 
    
         
            +
            				$stderr.puts cmd
         
     | 
| 
      
 97 
     | 
    
         
            +
            				system cmd
         
     | 
| 
      
 98 
     | 
    
         
            +
            			end
         
     | 
| 
       78 
99 
     | 
    
         
             
            		end
         
     | 
| 
       79 
100 
     | 
    
         | 
| 
       80 
101 
     | 
    
         
             
            	end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: git-make_mirror
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.0 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.1.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Nathan Reed
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2017- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2017-06-14 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     | 
| 
         @@ -61,7 +61,6 @@ extensions: [] 
     | 
|
| 
       61 
61 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       62 
62 
     | 
    
         
             
            files:
         
     | 
| 
       63 
63 
     | 
    
         
             
            - ".gitignore"
         
     | 
| 
       64 
     | 
    
         
            -
            - ".travis.yml"
         
     | 
| 
       65 
64 
     | 
    
         
             
            - Gemfile
         
     | 
| 
       66 
65 
     | 
    
         
             
            - LICENSE.txt
         
     | 
| 
       67 
66 
     | 
    
         
             
            - README.md
         
     |