git_en_masse 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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0b61da421f569c349289c3db86a857f6b6d3720f
4
+ data.tar.gz: 398dd5582754f84bb4d981d11cba0526f6db3ace
5
+ SHA512:
6
+ metadata.gz: dc7d43603621c1f1365f35b5f7667a170385699a675008bfb3b4190d425b33ded8a9b90bbae2d2576542cd12dd40c72783ee60c6b7724c398a1821b8eae95088
7
+ data.tar.gz: b3df0eeda1ea31b6d67847e7ef97e838911a1e45b17648fd346737307dd41538a68d81b824e0709ae3378f25f3d456c82bb557da36d8111e93aa69ef745846dc
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ *.gem
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/bin/git_en_masse ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: UTF-8
3
+ lib = File.expand_path(File.dirname(__FILE__) + '/../lib')
4
+ $LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)
5
+
6
+ require 'git_en_masse'
7
+ require 'optparse'
8
+
9
+ command = "git pull origin"
10
+ primary_options = OptionParser.new do |opt|
11
+ opt.on("-c", "--command [CMD]", "Set git command to run") do |cmd|
12
+ command = cmd
13
+ end
14
+ end
15
+
16
+ ssh = GR::Run.new(command)
17
+ ssh.go
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "git_en_masse/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "git_en_masse"
8
+ spec.version = GR::VERSION
9
+ spec.authors = ["Charles Marshall"]
10
+ spec.email = ["cm56marshall@gmail.com"]
11
+ spec.summary = %q{ Runs a git pull on all git repos under the directory being called from }
12
+ spec.description = %q{ Runs a git pull on all git repos under the directory being called from }
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_dependency "colorize", "~> 0.7"
21
+ spec.add_dependency "bundler", "~> 1.5"
22
+ spec.add_dependency "json", "~> 1.8"
23
+
24
+ spec.post_install_message = "thanks."
25
+
26
+ end
@@ -0,0 +1,20 @@
1
+
2
+ module GR
3
+ class Dirs
4
+
5
+ def self.current
6
+ return Dir.pwd
7
+ end
8
+
9
+ def self.listing(path)
10
+ Dir.entries(path).select {|entry| File.directory?(File.join(path,entry)) && !(entry.to_s =='.' || entry.to_s == '..') && GR::Dirs.git?(path, entry.to_s) }
11
+
12
+ end
13
+
14
+ def self.git?(path, entry)
15
+ file = File.join(path, entry).to_s
16
+ return File.exists?("#{file}/.git/config")
17
+ end
18
+
19
+ end
20
+ end
@@ -0,0 +1,5 @@
1
+ module GR
2
+ FORMAT_OK = "\e[0;32m%#-30s\t%5s\e[0m\n"
3
+ FORMAT_ERROR = "\e[33;40m%#-30s\t%5s\e[0m\n"
4
+ FORMAT_FATAL = "\e[0;31m%#-30s\t%5s\e[0m\n"
5
+ end
@@ -0,0 +1,33 @@
1
+ require "colorize"
2
+ module GR
3
+ class Run
4
+
5
+ def initialize(cmd)
6
+ @command = cmd
7
+ end
8
+
9
+ def cmd(path)
10
+ `cd #{path} 2>&1 ; #{@command} > /dev/null 2>&1`
11
+ code = $?
12
+ return code.to_i
13
+ end
14
+
15
+
16
+ def go
17
+ path = GR::Dirs.current
18
+ puts "\nStarting in #{path}\n".colorize(:green)
19
+ puts "Will run #{@command}\n".colorize(:green)
20
+
21
+ GR::Dirs.listing(path).each do |dir|
22
+ result = self.cmd("#{path}/#{dir}")
23
+ if result == 0
24
+ printf(GR::FORMAT_OK, "#{dir}", "\u2713")
25
+ else
26
+ printf(GR::FORMAT_FATAL, "#{dir}", "\u2620")
27
+ end
28
+ end
29
+
30
+ end
31
+
32
+ end
33
+ end
@@ -0,0 +1,3 @@
1
+ module GR
2
+ VERSION="0.0.1"
3
+ end
@@ -0,0 +1,7 @@
1
+ require "git_en_masse/version"
2
+
3
+ module GR
4
+ require "git_en_masse/dirs"
5
+ require "git_en_masse/printf_formats"
6
+ require "git_en_masse/runner"
7
+ end
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: git_en_masse
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Charles Marshall
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-10-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: colorize
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.7'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.5'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.5'
41
+ - !ruby/object:Gem::Dependency
42
+ name: json
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.8'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.8'
55
+ description: " Runs a git pull on all git repos under the directory being called from
56
+ \ "
57
+ email:
58
+ - cm56marshall@gmail.com
59
+ executables:
60
+ - git_en_masse
61
+ extensions: []
62
+ extra_rdoc_files: []
63
+ files:
64
+ - ".gitignore"
65
+ - Gemfile
66
+ - bin/git_en_masse
67
+ - git_en_masse.gemspec
68
+ - lib/git_en_masse.rb
69
+ - lib/git_en_masse/dirs.rb
70
+ - lib/git_en_masse/printf_formats.rb
71
+ - lib/git_en_masse/runner.rb
72
+ - lib/git_en_masse/version.rb
73
+ homepage: ''
74
+ licenses:
75
+ - MIT
76
+ metadata: {}
77
+ post_install_message: thanks.
78
+ rdoc_options: []
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ requirements: []
92
+ rubyforge_project:
93
+ rubygems_version: 2.2.2
94
+ signing_key:
95
+ specification_version: 4
96
+ summary: Runs a git pull on all git repos under the directory being called from
97
+ test_files: []