git-shove 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +5 -0
  3. data/bin/git-shove +5 -0
  4. data/lib/git-shove.rb +37 -0
  5. metadata +48 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c15020b090d62dc1a71a9c741a197ca3a291acf3
4
+ data.tar.gz: a92bdda89ecab6abd430206c2ad878ccb6657fc7
5
+ SHA512:
6
+ metadata.gz: b19d829c502f2342fb118eb0f3cbfb39e21d9c8f244ae60bd4490dce3ed517166bbd06cc93124993fcb49c41bc93fdadabf517ad0f686a197d29fb6c297f5792
7
+ data.tar.gz: cfb1e532c67cef3eb90bb93cb835cd02ae961a4319e3976c89e7a2f68d9903ac3443f0723b39bb95e9f5e9ed07b80b778c69e0f4002a93808b266d52ec76275c
@@ -0,0 +1,5 @@
1
+ # git-shove
2
+
3
+ For quickly making remote repos of an existing local repo.
4
+
5
+ Nice!
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'git-shove'
4
+
5
+ GitShove::Shover.new().shove(ARGV[0])
@@ -0,0 +1,37 @@
1
+ module GitShove
2
+
3
+ DEFAULT_REPO_DIR = '/var/git'
4
+ DEFAULT_GROUP_NAME = 'instructors'
5
+ DEFAULT_REMOTE_NAME = 'origin'
6
+
7
+ class Shover
8
+
9
+ def shove(hostname)
10
+ repo_name = File.basename(Dir.pwd) + '.git'
11
+ repo_dir = "#{DEFAULT_REPO_DIR}/#{repo_name}"
12
+
13
+ remote_commands = [
14
+ "git init --bare --shared=group #{repo_dir}",
15
+ "chgrp -R #{DEFAULT_GROUP_NAME} #{repo_dir}",
16
+ "chmod -R g+w #{repo_dir}",
17
+ "find #{repo_dir} -type d -print0 | xargs -0 chmod g+s"
18
+ ].join(" && ")
19
+
20
+ try(%Q[ssh #{hostname} "#{remote_commands}"])
21
+
22
+ remote_url = "#{hostname}:#{repo_dir}"
23
+
24
+ try("git remote add #{DEFAULT_REMOTE_NAME} #{remote_url}")
25
+ try("git push -u #{DEFAULT_REMOTE_NAME} master")
26
+ end
27
+
28
+ private
29
+
30
+ def try(cmd)
31
+ puts(cmd)
32
+ puts(%x[#{cmd}])
33
+ end
34
+
35
+ end
36
+
37
+ end
metadata ADDED
@@ -0,0 +1,48 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: git-shove
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Max Cantor
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-08-08 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: |2
14
+ Easily create remote repos from local ones.
15
+ email: max@maxcantor.net
16
+ executables:
17
+ - git-shove
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - README.md
22
+ - bin/git-shove
23
+ - lib/git-shove.rb
24
+ homepage: http://github.com/mcantor/git-shove
25
+ licenses: []
26
+ metadata: {}
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubyforge_project:
43
+ rubygems_version: 2.2.0
44
+ signing_key:
45
+ specification_version: 4
46
+ summary: Feed me.
47
+ test_files: []
48
+ has_rdoc: false