Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

its been a while, refactor some parts

  • Loading branch information...
commit cdaadb91978d514b8ef640e456748542f8e6111c 1 parent d7d71d5
@sosedoff sosedoff authored
View
41 .gitignore
@@ -0,0 +1,41 @@
+!.gitignore
+*.gem
+*.rbc
+*.sw[a-p]
+*.tmproj
+*.tmproject
+*.un~
+*~
+.DS_Store
+.Spotlight-V100
+.Trashes
+._*
+.bundle
+.config
+.directory
+.elc
+.redcar
+.yardoc
+/.emacs.desktop
+/.emacs.desktop.lock
+Desktop.ini
+Gemfile.lock
+Icon?
+InstalledFiles
+Session.vim
+Thumbs.db
+\#*\#
+_yardoc
+auto-save-list
+coverage
+doc/
+lib/bundler/man
+pkg
+pkg/*
+rdoc
+spec/reports
+test/tmp
+test/version_tmp
+tmp
+tmtags
+tramp
View
3  lib/munin-ruby.rb
@@ -1,6 +1,3 @@
-require 'socket'
-
-require 'munin-ruby/munin-ruby'
require 'munin-ruby/version'
require 'munin-ruby/stat'
require 'munin-ruby/node'
View
5 lib/munin-ruby/munin-ruby.rb
@@ -1,5 +0,0 @@
-module Munin
- class SessionError < Exception ; end
- class NoSuchService < Exception ; end
- class AccessDenied < Exception ; end
-end
View
16 lib/munin-ruby/node.rb
@@ -1,14 +1,22 @@
+require 'socket'
+
module Munin
+ class SessionError < StandardError ; end
+ class NoSuchService < StandardError ; end
+ class AccessDenied < StandardError ; end
+
class Node
attr_reader :host, :port
attr_reader :version, :services
attr_reader :timestamp
- # Setup a new node
+ # Initialize a new Munin::Node object
+ #
# host - Server hostname or IP address
- # opts - Options
- # :port => Node server port (default to 4949)
- # :fetch => String or Array of service names ONLY to fetch
+ # opts - Additional options.
+ # :port - Node server port (default to 4949)
+ # :fetch - String or Array of service names ONLY to fetch
+ #
def initialize(host, opts={})
@host = host
@port = opts[:port] || 4949
View
15 lib/munin-ruby/stat.rb
@@ -2,19 +2,20 @@ module Munin
class Stat
attr_reader :name, :params
- def initialize(name, rows=[])
+ # Initialize a new Munin::Stat object
+ #
+ # name - Attribute name
+ # rows - Array of parameters
+ #
+ def initialize(name, rows=[])
@name = name
@params = {}
unless rows.empty?
rows.each do |r|
- name = r.first.scan(/^([a-z\d\_\-]{1,}).value/i).to_s
- @params[name] = r.last
+ key = r.first.split('.value').first
+ @params[key] = r.last
end
end
end
-
- def to_s
- "Munin::Stat<#{@name}>"
- end
end
end
View
20 munin-ruby.gemspec
@@ -1,21 +1,17 @@
-require 'lib/munin-ruby/version'
+# -*- encoding: utf-8 -*-
+require File.expand_path('../lib/munin/version', __FILE__)
Gem::Specification.new do |s|
s.name = "munin-ruby"
s.version = Munin::VERSION
- s.date = Time.now.strftime("%Y-%m-%d")
- s.description = "munin-node ruby client"
+ s.description = "Munin Node client"
s.summary = "Ruby client library to communicate with munin-node servers"
s.authors = ["Dan Sosedoff"]
s.email = "dan.sosedoff@gmail.com"
s.homepage = "http://github.com/sosedoff/munin-ruby"
-
- s.files = %w[
- README.rdoc
- lib/munin-ruby.rb
- lib/munin-ruby/version.rb
- lib/munin-ruby/node.rb
- lib/munin-ruby/stat.rb
- lib/munin-ruby/munin-ruby.rb
- ]
+
+ gem.files = `git ls-files`.split("\n")
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{|f| File.basename(f)}
+ gem.require_paths = ['lib']
end
Please sign in to comment.
Something went wrong with that request. Please try again.