wutbranch 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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 543db864df7e20577ef91dad7d8e14bd825cef2e
4
+ data.tar.gz: 3d15dfdeab7a05499d9f1e67d7b0409feb0aed03
5
+ SHA512:
6
+ metadata.gz: 61a0f421c718a616be206d2ebc98e1ba83bd54080257c17049b3ee15260a64848024ee70cce698454546d1beb9e7e46730d0e83e5aa1d0afa3aac835e033b063
7
+ data.tar.gz: cb7f416d9f9cd873c721c39780e2a52de676f4069f3e88c214b050a4d6252cb8669fccd2e98d77e9c6c56593633462a299102dcd21e980c2f1daa4d05fe5c877
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'net-ssh'
4
+ gem 'yaml'
data/bin/wutbranch ADDED
@@ -0,0 +1,5 @@
1
+ #!/bin/bash
2
+
3
+ BASEDIR=$(dirname $0)
4
+
5
+ ruby $BASEDIR/../lib/wutbranch.rb $*
@@ -0,0 +1,31 @@
1
+ servers:
2
+ -
3
+ name: "Staging Server"
4
+ group: "staging"
5
+ host: "staging.domain.com"
6
+ user: "user"
7
+ key: "/path/to/key.pem"
8
+ repos:
9
+ "Web App #1": "/var/www/staging/an-app"
10
+ "Web App #2": "/var/www/staging/another-app"
11
+ is_disabled: false
12
+
13
+ -
14
+ name: "Staging Server #2"
15
+ group: "staging"
16
+ host: "staging-2.domain.com"
17
+ user: "user"
18
+ key: "/path/to/key.pem"
19
+ repos:
20
+ "Web App #1": "/var/www/staging/an-app"
21
+ "Web App #2": "/var/www/staging/another-app"
22
+
23
+ -
24
+ name: "Dev Server"
25
+ group: "dev"
26
+ host: "dev.domain.com"
27
+ user: "user"
28
+ key: "/path/to/key.pem"
29
+ repos:
30
+ "Web App #1": "/var/www/staging/an-app"
31
+ "Web App #2": "/var/www/staging/another-app"
data/lib/wutbranch.rb ADDED
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'net/ssh'
4
+ require 'optparse'
5
+ require 'yaml'
6
+
7
+ options = { }
8
+
9
+ OptionParser.new do |opts|
10
+ opts.banner = "wutbranch"
11
+
12
+ opts.on("-g", "--group [Group name]", String, "Show branch status for servers in this group") do |v|
13
+ options[:group] = v
14
+ end
15
+
16
+ opts.on("-s", "--silent", String, "Hide messages") do |v|
17
+ options[:silent] = v
18
+ end
19
+ end.parse!
20
+
21
+ config = YAML.load(File.read(File.dirname(__FILE__) + "/../config.yaml"))
22
+
23
+ servers = config['servers']
24
+
25
+ if options[:group]
26
+ servers = servers.reject {|key, value| key['group'] != options[:group] }
27
+ end
28
+
29
+ servers.each do |server|
30
+ if server['is_disabled']
31
+ next
32
+ end
33
+
34
+ puts server['name']
35
+ puts "-----------------"
36
+
37
+ Net::SSH.start(server['host'], server['user'], :keys => [ server['key'] ]) do |ssh|
38
+ server['repos'].each do |name, path|
39
+ cmd = "cd \"#{path}\"; git rev-parse --abbrev-ref HEAD;"
40
+ branch = ssh.exec!(cmd)
41
+ branch.gsub!("\n", '').gsub!("\r", '')
42
+ cmd = "cd \"#{path}\"; git log --format=\"%aN @ %cr -- \\\"%s\\\"\" -n 1"
43
+ commit = ssh.exec!(cmd)
44
+ puts "#{name} on '#{branch}' last commit by #{commit}"
45
+ end
46
+ end
47
+
48
+ puts "\n"
49
+ end
metadata ADDED
@@ -0,0 +1,47 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wutbranch
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - John Himmelman
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-02-04 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Console utility to display the current branch on remote servers.
14
+ email: john2496@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - Gemfile
20
+ - bin/wutbranch
21
+ - config.yaml.example
22
+ - lib/wutbranch.rb
23
+ homepage: http://rubygems.org/gems/wutbranch
24
+ licenses:
25
+ - MIT
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.1
44
+ signing_key:
45
+ specification_version: 4
46
+ summary: Console utility to display the current branch on remote servers.
47
+ test_files: []