lowrpm 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.
@@ -0,0 +1,6 @@
1
+ .*.swp
2
+ .rvmrc
3
+ .bundle
4
+ *.gem
5
+ Gemfile.lock
6
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in lowrpm.gemspec
4
+ gemspec
@@ -0,0 +1,6 @@
1
+ === 1.0.0 / 2011-03-07
2
+
3
+ * Initial release
4
+
5
+ * FIXME
6
+
@@ -0,0 +1,8 @@
1
+ .autotest
2
+ History.txt
3
+ Manifest.txt
4
+ README.txt
5
+ Rakefile
6
+ bin/lowrpm
7
+ lib/lowrpm.rb
8
+ test/test_lowrpm.rb
@@ -0,0 +1,60 @@
1
+ = lowrpm
2
+
3
+ * FIX (url)
4
+
5
+ == DESCRIPTION:
6
+
7
+ FIX (describe your package)
8
+
9
+ == FEATURES/PROBLEMS:
10
+
11
+ * FIX (list of features or problems)
12
+
13
+ == SYNOPSIS:
14
+
15
+ FIX (code sample of usage)
16
+
17
+ == REQUIREMENTS:
18
+
19
+ * gems
20
+ * new_relic_api (https://github.com/newrelic/newrelic_api)
21
+ * activeresource
22
+ * rdoc
23
+
24
+ == INSTALL:
25
+
26
+ * FIX (sudo gem install, anything else)
27
+
28
+ == DEVELOPERS:
29
+
30
+ After checking out the source, run:
31
+
32
+ $ rake newb
33
+
34
+ This task will install any missing dependencies, run the tests/specs,
35
+ and generate the RDoc.
36
+
37
+ == LICENSE:
38
+
39
+ (The MIT License)
40
+
41
+ Copyright (c) 2011 David Taylor (david@cloudartisan.com)
42
+
43
+ Permission is hereby granted, free of charge, to any person obtaining
44
+ a copy of this software and associated documentation files (the
45
+ 'Software'), to deal in the Software without restriction, including
46
+ without limitation the rights to use, copy, modify, merge, publish,
47
+ distribute, sublicense, and/or sell copies of the Software, and to
48
+ permit persons to whom the Software is furnished to do so, subject to
49
+ the following conditions:
50
+
51
+ The above copyright notice and this permission notice shall be
52
+ included in all copies or substantial portions of the Software.
53
+
54
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
55
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
56
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
57
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
58
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
59
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
60
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,5 @@
1
+ # -*- ruby -*-
2
+
3
+ require "bundler/gem_tasks"
4
+
5
+ # vim: syntax=ruby
@@ -0,0 +1,121 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # == Synopsis
4
+ # This is a sample description of the application.
5
+ # Blah blah blah.
6
+ #
7
+ # == Examples
8
+ # This command does blah blah blah.
9
+ # ruby_cl_skeleton foo.txt
10
+ #
11
+ # Other examples:
12
+ # ruby_cl_skeleton -q bar.doc
13
+ # ruby_cl_skeleton --verbose foo.html
14
+ #
15
+ # == Usage
16
+ # ruby_cl_skeleton [options] source_file
17
+ #
18
+ # For help use: ruby_cl_skeleton -h
19
+ #
20
+ # == Options
21
+ # -h, --help Displays help message
22
+ # -V, --version Display the version, then exit
23
+ # -q, --quiet Output as little as possible, overrides verbose
24
+ # -v, --verbose Verbose output
25
+ # TO DO - add additional options
26
+ #
27
+ # == Author
28
+ # YourName
29
+ #
30
+ # == Copyright
31
+ # Copyright (c) 2007 YourName. Licensed under the MIT License:
32
+ # http://www.opensource.org/licenses/mit-license.php
33
+
34
+
35
+ # TO DO - replace all ruby_cl_skeleton with your app name
36
+ # TO DO - replace all YourName with your actual name
37
+ # TO DO - update Synopsis, Examples, etc
38
+ # TO DO - change license if necessary
39
+
40
+
41
+ require 'optparse'
42
+ require 'ostruct'
43
+ require 'date'
44
+ require '../lib/lowrpm.rb'
45
+
46
+
47
+ class LowRpmApp
48
+
49
+ attr_reader :options
50
+
51
+ def initialize(arguments, input)
52
+ @arguments = arguments
53
+ @input = input
54
+
55
+ @options = OpenStruct.new
56
+ @options.verbose = false
57
+ @options.quiet = false
58
+ end
59
+
60
+ # Parse options, check arguments, then process the command
61
+ def run
62
+ if parsed_options? && arguments_valid?
63
+ show_options if @options.verbose
64
+ process_arguments
65
+ process_input
66
+ else
67
+ # FIXME
68
+ end
69
+ end
70
+
71
+ protected
72
+ def parsed_options?
73
+ @opts = OptionParser.new
74
+ @opts.on('-h', '--help') { puts @opts ; exit 0 }
75
+ @opts.on('-v', '--verbose') { @options.verbose = true }
76
+ @opts.on('-V', '--version') { version ; exit 0 }
77
+ @opts.on('-q', '--quiet') { @options.quiet = true }
78
+
79
+ @opts.parse!(@arguments) rescue return false
80
+
81
+ process_options
82
+ true
83
+ end
84
+
85
+ def process_options
86
+ @options.verbose = false if @options.quiet
87
+ end
88
+
89
+ def show_options
90
+ puts "Options:"
91
+ @options.marshal_dump.each do |name, val|
92
+ puts " #{name} = #{val}"
93
+ end
94
+ end
95
+
96
+ def arguments_valid?
97
+ true if @arguments.length == 2
98
+ end
99
+
100
+ def process_arguments
101
+ @license_key = ARGV[0]
102
+ @application_name = ARGV[1]
103
+ end
104
+
105
+ def version
106
+ puts "#{File.basename(__FILE__)} version #{LowRpm::VERSION}"
107
+ end
108
+
109
+ def process_input
110
+ #lowrpm = LowRpm.new(@license_key, @application_name)
111
+ input = @input.read
112
+ @input.each do |line|
113
+ datetime = DateTime.parse(input)
114
+ puts datetime
115
+ end
116
+ end
117
+ end
118
+
119
+
120
+ lowrpm_app = LowRpmApp.new(ARGV, STDIN)
121
+ lowrpm_app.run
@@ -0,0 +1,13 @@
1
+ require 'active_resource'
2
+ require 'new_relic_api'
3
+ require 'lowrpm/version'
4
+
5
+
6
+ module LowRpm
7
+
8
+ def initialize(api_key, application_name)
9
+ NewRelicApi.api_key = api_key
10
+ NewRelicApi.reset!
11
+ NewRelicApi::Account.find(:first).applications(:params => {:conditions => {:name => application_name}})
12
+ end
13
+ end
@@ -0,0 +1,3 @@
1
+ module Lowrpm
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "lowrpm/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "lowrpm"
7
+ s.version = Lowrpm::VERSION
8
+ s.authors = ["David Taylor"]
9
+ s.email = ["david@cloudartisan.com"]
10
+ s.homepage = "http://lowrpm.github.com"
11
+ s.summary = %q{Inspect your application performance}
12
+ s.description = %q{Use lowrpm and New Relic to profile your application}
13
+
14
+ s.rubyforge_project = "lowrpm"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_dependency "newrelic_rpm", ">= 3.2.0"
22
+ s.add_development_dependency "rspec", ">= 2.7.0"
23
+ end
@@ -0,0 +1 @@
1
+ require 'new_relic_api'
@@ -0,0 +1,8 @@
1
+ require "test/unit"
2
+ require "lowrpm"
3
+
4
+ class TestLowrpm < Test::Unit::TestCase
5
+ def test_sanity
6
+ flunk "write tests or I will kneecap you"
7
+ end
8
+ end
metadata ADDED
@@ -0,0 +1,81 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lowrpm
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - David Taylor
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-10-31 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: newrelic_rpm
16
+ requirement: &2152314300 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 3.2.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *2152314300
25
+ - !ruby/object:Gem::Dependency
26
+ name: rspec
27
+ requirement: &2152313800 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: 2.7.0
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *2152313800
36
+ description: Use lowrpm and New Relic to profile your application
37
+ email:
38
+ - david@cloudartisan.com
39
+ executables:
40
+ - lowrpm
41
+ extensions: []
42
+ extra_rdoc_files: []
43
+ files:
44
+ - .gitignore
45
+ - Gemfile
46
+ - History.txt
47
+ - Manifest.txt
48
+ - README.txt
49
+ - Rakefile
50
+ - bin/lowrpm
51
+ - lib/lowrpm.rb
52
+ - lib/lowrpm/version.rb
53
+ - lowrpm.gemspec
54
+ - lowrpm.rb
55
+ - test/test_lowrpm.rb
56
+ homepage: http://lowrpm.github.com
57
+ licenses: []
58
+ post_install_message:
59
+ rdoc_options: []
60
+ require_paths:
61
+ - lib
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ! '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ! '>='
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ requirements: []
75
+ rubyforge_project: lowrpm
76
+ rubygems_version: 1.8.10
77
+ signing_key:
78
+ specification_version: 3
79
+ summary: Inspect your application performance
80
+ test_files:
81
+ - test/test_lowrpm.rb