Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

fix loading files when running executable from gem install

  • Loading branch information...
commit 4ca13fefb43867eb93d96e695ea0717edb5ca467 1 parent f41e64f
Dan Ryan authored
2  .gitignore
... ... @@ -1,2 +1,4 @@
1 1 log/*.log
2 2 pkg
  3 +.yardoc
  4 +doc
8 Gemfile
@@ -14,6 +14,7 @@ gem 'sinatra', '>= 1.2.6'
14 14 gem 'sinatra-logger', '>= 0.1.1', :require => 'sinatra/logger'
15 15 gem 'activesupport', '>= 3.0.9', :require => 'active_support/all'
16 16 gem 'gli', '>= 1.3.2'
  17 +
17 18 group :development, :test do
18 19 gem 'rspec', '>= 2.6.0'
19 20 gem 'rack-test', '>= 0.6.0', :require => 'rack/test'
@@ -23,3 +24,10 @@ group :development, :test do
23 24 gem 'json_spec', '>= 0.5.0'
24 25 gem "timecop", ">= 0.3.5"
25 26 end
  27 +
  28 +
  29 +group :doc do
  30 + gem 'yard'
  31 + # gem 'rdiscount'
  32 + gem 'yard-dm', '>= 0'
  33 +end
4 Gemfile.lock
@@ -72,6 +72,8 @@ GEM
72 72 uuidtools (2.1.2)
73 73 watchr (0.7)
74 74 yajl-ruby (0.8.2)
  75 + yard (0.7.2)
  76 + yard-dm (0.1.1)
75 77
76 78 PLATFORMS
77 79 ruby
@@ -98,3 +100,5 @@ DEPENDENCIES
98 100 timecop (>= 0.3.5)
99 101 watchr (>= 0.7)
100 102 yajl-ruby (>= 0.8.2)
  103 + yard
  104 + yard-dm
25 README.md
Source Rendered
... ... @@ -1,5 +1,26 @@
1   -## TODO
  1 +
  2 +
  3 +
  4 +## Features
  5 +
  6 +### Resources
  7 +
  8 +One of the biggest differences
  9 +### Snapshots
  10 +
  11 +When a snapshot is recorded, it's socked away in its raw form so you can come back at a later time and review the exact state of a given resource without having to piece individual metrics together.
  12 +
  13 +### Metrics
  14 +
  15 +Snapshots are also broken up and saved as individual attribute/value pairs, which enables you to track a particular attribute over a given period of time.
  16 +
  17 +
  18 +## Roadmap
2 19
3 20 * Documentation. Like, seriously.
4   -* Have log output go to STDOUT like a proper service
  21 +* Log to STDOUT like a proper service.
  22 +* Callbacks! Decide what happens after data gets collected.
  23 +* Taggable resources and snapshots
  24 +## TODO
  25 +
5 26 * Let config file be, er, configurable
7 Rakefile
@@ -25,6 +25,13 @@ task :spork do
25 25 sh %{bundle exec spork}
26 26 end
27 27
  28 +
  29 +Bundler.require(:doc)
  30 +desc "Generate documentation"
  31 +YARD::Rake::YardocTask.new do |t|
  32 + t.files = [ 'lib/**/*.rb' ]
  33 +end
  34 +
28 35 # namespace :resque do
29 36 # task :setup do
30 37 # require 'resque'
14 bin/overwatch-collection
... ... @@ -1,9 +1,13 @@
1 1 #!/usr/bin/env ruby
2 2
3   -$: << File.expand_path(File.dirname(__FILE__) + "/../lib")
  3 +require 'gli'
  4 +
  5 +$: << File.expand_path(File.join(File.dirname(__FILE__), "../lib"))
4 6
5 7 require 'overwatch/collection'
6   -require 'gli'
  8 +
  9 +
  10 +puts $:.inspect
7 11
8 12 include GLI
9 13
@@ -12,17 +16,17 @@ version Overwatch::Collection::VERSION
12 16 desc 'Start overwatch-collection server'
13 17 command :start do |c|
14 18 c.desc 'Port to which to bind'
15   - c.arg_name '[PORT]'
  19 + c.arg_name 'PORT'
16 20 c.default_value '9001'
17 21 c.flag [:p, :port]
18 22
19 23 c.desc 'Host on which to run'
20   - c.arg_name '[HOST]'
  24 + c.arg_name 'HOST'
21 25 c.default_value 'localhost'
22 26 c.flag [:h, :host]
23 27
24 28 c.desc 'Config file'
25   - c.arg_name '[CONFIG]'
  29 + c.arg_name 'CONFIG'
26 30 c.default_value File.expand_path(File.join(File.dirname(__FILE__), "/../config/overwatch.yml"))
27 31 c.flag [:c, :config]
28 32
20 lib/overwatch/collection.rb
... ... @@ -1,15 +1,16 @@
1 1 require 'bundler'
2 2 Bundler.require(:default)
3 3
4   -$: << File.join(File.dirname(__FILE__), ".")
5   -
6   -require 'overwatch/collection/version'
7   -require 'overwatch/collection/attributes'
8   -require 'overwatch/collection/models/resource'
9   -require 'overwatch/collection/models/snapshot'
10   -require 'overwatch/collection/application'
  4 +require File.expand_path(File.join(File.dirname(__FILE__), "collection/attributes"))
  5 +require File.expand_path(File.join(File.dirname(__FILE__), "collection/models/resource"))
  6 +require File.expand_path(File.join(File.dirname(__FILE__), "collection/models/snapshot"))
  7 +require File.expand_path(File.join(File.dirname(__FILE__), "collection/application"))
11 8
12 9 module Overwatch
  10 + module Collection
  11 + VERSION = "0.0.3"
  12 + end
  13 +
13 14 class << self
14 15 def config_path=(path)
15 16 @config_path = path
@@ -24,10 +25,7 @@ def config
24 25 @config.merge!(YAML.load_file(config_path))
25 26 end
26 27 end
27   -
28   - module Collection
29   -
30   - end
  28 +
31 29 end
32 30
33 31 $redis = Redis.new(
4 lib/overwatch/collection/application.rb
@@ -42,5 +42,5 @@ class Application < Sinatra::Base
42 42 end
43 43 end
44 44
45   -require 'overwatch/collection/routes/resource'
46   -require 'overwatch/collection/routes/snapshot'
  45 +require File.expand_path(File.join(File.dirname(__FILE__), "routes/resource"))
  46 +require File.expand_path(File.join(File.dirname(__FILE__), "routes/snapshot"))
2  lib/overwatch/collection/models/snapshot.rb
@@ -4,7 +4,6 @@ class Snapshot
4 4
5 5 property :id, Serial, :index => true
6 6 property :data, Json
7   - # property :raw_data, Json
8 7 property :created_at, DateTime
9 8 property :updated_at, DateTime
10 9 property :created_on, Date
@@ -48,7 +47,6 @@ def schedule_reaper
48 47 end
49 48 end
50 49
51   - # Usage: to_dotted_hash({:one => :two}) # => "one.two"
52 50 def to_dotted_hash(source=self.data,target = {}, namespace = nil)
53 51 prefix = "#{namespace}." if namespace
54 52 case source

0 comments on commit 4ca13fe

Please sign in to comment.
Something went wrong with that request. Please try again.