kpigen 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +14 -0
- data/Gemfile +5 -0
- data/Rakefile +5 -0
- data/autotest/discover.rb +2 -0
- data/bin/kpigen +9 -0
- data/kpigen.gemspec +40 -0
- data/lib/kpigen.rb +6 -0
- data/lib/kpigen/application.rb +27 -0
- data/lib/kpigen/ci.rake +48 -0
- data/lib/kpigen/message.rb +240 -0
- data/lib/kpigen/version.rb +3 -0
- data/lib/registry/kpigen_registry.rb +32 -0
- data/spec/application_spec.rb +40 -0
- data/spec/kpi_registry_spec.rb +52 -0
- data/spec/message_spec.rb +27 -0
- data/spec/spec_helper.rb +17 -0
- metadata +264 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
data/bin/kpigen
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'rubygems'
|
3
|
+
require "bundler/setup"
|
4
|
+
require File.dirname(__FILE__) + "/../lib/kpigen"
|
5
|
+
|
6
|
+
eve = Eve::Application.new(:display => :stdio, :system_calls_display => { :filename => "./kpigen_system_calls.log" })
|
7
|
+
app = Kpigen::Application.new(eve)
|
8
|
+
Signal.trap("SIGINT") { app.cmd("exit") }
|
9
|
+
app.run(ARGV)
|
data/kpigen.gemspec
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "kpigen/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "kpigen"
|
7
|
+
s.version = Kpigen::VERSION
|
8
|
+
s.authors = ["Andrew Forward"]
|
9
|
+
s.email = ["andrew.forward@cenx.com"]
|
10
|
+
s.homepage = ""
|
11
|
+
s.summary = %q{A command line tool for generating kpigen data based on csv inputs}
|
12
|
+
s.description = %q{A command line tool for generating kpigen data based on csv inputs}
|
13
|
+
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
|
+
s.executables = [ 'kpigen' ]
|
18
|
+
s.require_paths = ["lib"]
|
19
|
+
|
20
|
+
s.add_dependency('evegem','>=0.1.2')
|
21
|
+
s.add_dependency('utest','>=0.0.3')
|
22
|
+
s.add_dependency('watchme','>=0.0.3')
|
23
|
+
s.add_dependency('awesome_print')
|
24
|
+
s.add_dependency('rake','0.9.2')
|
25
|
+
s.add_dependency('rails','>=3.2.1')
|
26
|
+
s.add_dependency('mysql2','0.3.11')
|
27
|
+
s.add_dependency('rack','1.4.1')
|
28
|
+
s.add_dependency('eventmachine','0.12.10')
|
29
|
+
s.add_dependency('net-ssh','2.3.0')
|
30
|
+
s.add_dependency('redis','2.2.0')
|
31
|
+
|
32
|
+
s.add_development_dependency('rspec')
|
33
|
+
s.add_development_dependency('autotest')
|
34
|
+
s.add_development_dependency('autotest-fsevent') if RUBY_PLATFORM =~ /darwin/i
|
35
|
+
s.add_development_dependency('ZenTest')
|
36
|
+
s.add_development_dependency('rb-fsevent') if RUBY_PLATFORM =~ /darwin/i
|
37
|
+
s.add_development_dependency('geminabox')
|
38
|
+
s.add_development_dependency('simplecov')
|
39
|
+
|
40
|
+
end
|
data/lib/kpigen.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
module Kpigen
|
2
|
+
|
3
|
+
class Application
|
4
|
+
|
5
|
+
attr_accessor :eve
|
6
|
+
|
7
|
+
def initialize(eve)
|
8
|
+
@eve = eve
|
9
|
+
end
|
10
|
+
|
11
|
+
def redis
|
12
|
+
@eve.redis
|
13
|
+
end
|
14
|
+
|
15
|
+
def cmd(raw,display_messages = true,external_cmd = false)
|
16
|
+
@eve.cmd(raw,display_messages,external_cmd)
|
17
|
+
end
|
18
|
+
|
19
|
+
def run(args)
|
20
|
+
dir = File.dirname(__FILE__)
|
21
|
+
kpigen_args = ["--register", "Eve::BaseRegistry", "--register", "Kpigen::KpigenRegistry", p("#{dir}/../registry/kpigen_registry.rb") ]
|
22
|
+
@eve.run(args + kpigen_args)
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
data/lib/kpigen/ci.rake
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
namespace :ci do
|
2
|
+
|
3
|
+
desc "Build the project"
|
4
|
+
task :build do
|
5
|
+
begin
|
6
|
+
Rake::Task['ci:local'].invoke
|
7
|
+
Rake::Task['ci:success'].invoke
|
8
|
+
rescue Exception => e
|
9
|
+
Rake::Task['ci:failure'].invoke
|
10
|
+
raise e
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
desc "Run CI from your local machine (will not propagte the success / failure message, or load the config file)"
|
15
|
+
task :local do
|
16
|
+
Rake::Task['ci:rspec'].invoke
|
17
|
+
end
|
18
|
+
|
19
|
+
desc 'Run Rspec'
|
20
|
+
task :rspec do
|
21
|
+
system 'mkdir -p ../public' unless File.exists?("../public")
|
22
|
+
Rake::Task['ci:rspec_run'].invoke
|
23
|
+
end
|
24
|
+
|
25
|
+
RSpec::Core::RakeTask.new(:rspec_run) do |t|
|
26
|
+
t.rspec_opts = ["--format", "html", "--out", "../public/rspec.html"]
|
27
|
+
t.fail_on_error = true
|
28
|
+
end
|
29
|
+
|
30
|
+
desc "The Build Succeeded, so tell our monitoring service"
|
31
|
+
task :success do
|
32
|
+
if File.exists?("/home/deployer/monitor/log")
|
33
|
+
system 'echo "Kpigen succeeded, http://cc.cenx.localnet" > /home/deployer/monitor/log/Kpigen.cc'
|
34
|
+
else
|
35
|
+
print "BUILD SUCCEEDED, but log directory (/home/deployer/monitor/log) does not exist"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
desc "The Build failed, so tell our monitoring service"
|
40
|
+
task :failure do
|
41
|
+
if File.exists?("/home/deployer/monitor/log")
|
42
|
+
system "curl http://cc.cenx.localnet/kpigen > /home/deployer/monitor/log/Kpigen.cc"
|
43
|
+
else
|
44
|
+
raise "BUILD FAILED, but log directory (/home/deployer/monitor/log) does not exist"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
@@ -0,0 +1,240 @@
|
|
1
|
+
module Kpigen
|
2
|
+
|
3
|
+
class Message
|
4
|
+
|
5
|
+
attr_accessor :app, :message
|
6
|
+
|
7
|
+
def initialize(app)
|
8
|
+
@app = app
|
9
|
+
end
|
10
|
+
|
11
|
+
def print_error(msg,e = nil)
|
12
|
+
@app.message.print_error(msg,e)
|
13
|
+
end
|
14
|
+
|
15
|
+
def print_version
|
16
|
+
print "kpigen, version #{Kpigen::VERSION}\n"
|
17
|
+
end
|
18
|
+
|
19
|
+
def print_storage_files(storage,files)
|
20
|
+
if files.empty?
|
21
|
+
print "No files available at #{storage.storage_path}.\n"
|
22
|
+
else
|
23
|
+
msg = "The following files are available at #{storage.storage_path}:\n"
|
24
|
+
files.each { |f| msg += " -- #{f}\n" }
|
25
|
+
print msg
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def print_new_source(source)
|
30
|
+
print "Added #{source.mode} source #{source.storage_path} to be checked every #{source.update_frequency}\n"
|
31
|
+
end
|
32
|
+
|
33
|
+
def print_unable_create_source(input)
|
34
|
+
print "Unable to add source [#{input}]\n"
|
35
|
+
end
|
36
|
+
|
37
|
+
def print_found_source(source,last_accessed,show_password)
|
38
|
+
msg = "The following source was found:\n"
|
39
|
+
msg += " -- #{source.storage_path(show_password)} (#{source.mode}, #{source.update_frequency})#{last_accessed_to_s(last_accessed)}"
|
40
|
+
msg += "\n"
|
41
|
+
print msg
|
42
|
+
end
|
43
|
+
|
44
|
+
def print_sources(sources,all_accesses,show_password)
|
45
|
+
if sources.empty?
|
46
|
+
print_no_sources
|
47
|
+
else
|
48
|
+
msg = sources.size == 1 ? "The following source is available:\n" : "The following #{sources.size} sources are available:\n"
|
49
|
+
msg += sources.each_with_index.collect { |s,i| " -- [#{i}] #{s.storage_path(show_password)} (#{s.mode}, #{s.update_frequency})#{last_accessed_to_s(all_accesses[i])}" }.join("\n")
|
50
|
+
msg += "\n"
|
51
|
+
print msg
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def print_no_sources
|
56
|
+
print "No sources available. For example, 'source add ftp deployer:abc123@mysite.local:/a/b/c 5minutes'\n"
|
57
|
+
end
|
58
|
+
|
59
|
+
def print_no_targets_for_gather
|
60
|
+
print "No targets available -- nowhere to place collected files. For example, 'target add ftp deployer:abc123@mysite.local:/a/b/c'\n"
|
61
|
+
end
|
62
|
+
|
63
|
+
def print_unable_to_process_file(filename,e = nil)
|
64
|
+
msg = "Unable to process #{filename}"
|
65
|
+
e.nil? ? print("#{msg}\n") : print_error(msg,e)
|
66
|
+
end
|
67
|
+
|
68
|
+
def print_nothing_to_gather
|
69
|
+
print "No sources provided -- nothing to gather\nFor example, 'source add ftp deployer:abc123@mysite.local:/a/b/c 5minutes'\n"
|
70
|
+
end
|
71
|
+
|
72
|
+
def print_unable_to_access_data_storage(source,e = nil)
|
73
|
+
msg = "Unable to access #{source.storage_path}"
|
74
|
+
e.nil? ? print("#{msg}\n") : print_error(msg,e)
|
75
|
+
end
|
76
|
+
|
77
|
+
def print_unable_to_download_file(source, source_filename, dest_filename, e = nil)
|
78
|
+
msg = "Unable to download #{source_filename} on #{source.storage_server} to #{dest_filename}"
|
79
|
+
e.nil? ? print("#{msg}\n") : print_error(msg,e)
|
80
|
+
end
|
81
|
+
|
82
|
+
def print_file_not_downloaded(source, source_filename, dest_filename)
|
83
|
+
print "Cannot find downloaded file #{dest_filename} (from #{source_filename} on #{source.storage_server})\n"
|
84
|
+
end
|
85
|
+
|
86
|
+
def print_file_downloaded(source, source_filename, dest_filename)
|
87
|
+
print " -- downloaded #{source_filename} (#{source.storage_server}) => #{dest_filename}\n"
|
88
|
+
end
|
89
|
+
|
90
|
+
def print_no_files_to_download(next_check_time)
|
91
|
+
if next_check_time.nil?
|
92
|
+
print " -- Nothing found.\n"
|
93
|
+
else
|
94
|
+
print " -- Nothing found, will check again at #{next_check_time}.\n"
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def print_unable_to_upload_file(target, source_filename, dest_filename, e = nil)
|
99
|
+
msg = "Unable to upload #{source_filename} on #{target.storage_server} to #{dest_filename}"
|
100
|
+
e.nil? ? print("#{msg}\n") : print_error(msg,e)
|
101
|
+
end
|
102
|
+
|
103
|
+
def print_unable_to_upload_text(target, source_text, dest_filename, e = nil)
|
104
|
+
msg = "Unable to upload '#{source_text}' on #{target.storage_server} to #{dest_filename}"
|
105
|
+
e.nil? ? print("#{msg}\n") : print_error(msg,e)
|
106
|
+
end
|
107
|
+
|
108
|
+
def print_file_not_uploaded(target, source_filename, dest_filename)
|
109
|
+
print "Cannot find uploaded file #{dest_filename} (from #{source_filename} on #{target.storage_server})\n"
|
110
|
+
end
|
111
|
+
|
112
|
+
def print_no_archives
|
113
|
+
print "No archives available. For example, 'archive add /a/b/c'\n"
|
114
|
+
end
|
115
|
+
|
116
|
+
def print_unable_to_clean_file(source,target,e = nil)
|
117
|
+
msg = "Unable to clean #{source} (to be stored at #{target})."
|
118
|
+
e.nil? ? print("#{msg}\n") : print_error(msg,e)
|
119
|
+
end
|
120
|
+
|
121
|
+
def print_no_archives_for_gather
|
122
|
+
print "No archive provided -- nowhere to put collected files\nFor example, 'archive add /a/b/c'\n"
|
123
|
+
end
|
124
|
+
|
125
|
+
def print_new_target(target)
|
126
|
+
print "Added #{target.mode} target #{target.storage_path}\n"
|
127
|
+
end
|
128
|
+
|
129
|
+
def print_unable_create_target(input)
|
130
|
+
print "Unable to add target [#{input}]\n"
|
131
|
+
end
|
132
|
+
|
133
|
+
def print_no_targets
|
134
|
+
print "No targets available. For example, 'target add ftp deployer:abc123@mysite.local:/a/b/c'\n"
|
135
|
+
end
|
136
|
+
|
137
|
+
def print_targets(targets,show_password)
|
138
|
+
if targets.empty?
|
139
|
+
print_no_targets
|
140
|
+
else
|
141
|
+
msg = targets.size == 1 ? "The following target is available:\n" : "The following #{targets.size} targets are available:\n"
|
142
|
+
msg += targets.each_with_index.collect { |s,i| " -- [#{i}] #{s.storage_path(show_password)} (#{s.mode})" }.join("\n")
|
143
|
+
msg += "\n"
|
144
|
+
print msg
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
def print_new_archive(archive)
|
149
|
+
print "Added #{archive.mode} archive #{archive.storage_path}\n"
|
150
|
+
end
|
151
|
+
|
152
|
+
def print_unable_create_archive(input)
|
153
|
+
print "Unable to add archive [#{input}]\n"
|
154
|
+
end
|
155
|
+
|
156
|
+
def print_archives(archives,show_password)
|
157
|
+
if archives.empty?
|
158
|
+
print_no_archives
|
159
|
+
else
|
160
|
+
msg = archives.size == 1 ? "The following archive is available:\n" : "The following #{archives.size} archives are available:\n"
|
161
|
+
msg += archives.each_with_index.collect { |s,i| " -- [#{i}] #{s.storage_path(show_password)} (#{s.mode})" }.join("\n")
|
162
|
+
msg += "\n"
|
163
|
+
print msg
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
def print_set_big_t(big_t)
|
168
|
+
print "Setting Big T to #{big_t}"
|
169
|
+
end
|
170
|
+
|
171
|
+
def print_get_big_t(big_t)
|
172
|
+
print "Big T is #{big_t}"
|
173
|
+
end
|
174
|
+
|
175
|
+
def print_about_to_fetch_source(source)
|
176
|
+
print "Looking for files in: #{source.storage_path}\n"
|
177
|
+
end
|
178
|
+
|
179
|
+
def print_unknown_storage_lookup(cmd, index)
|
180
|
+
print "Invalid index (#{index}), ignoring '#{cmd}' command.\n"
|
181
|
+
end
|
182
|
+
|
183
|
+
def print_source_deleted(source)
|
184
|
+
print "Removed source #{source.storage_path}.\n"
|
185
|
+
end
|
186
|
+
|
187
|
+
def print_target_deleted(target)
|
188
|
+
print "Removed target #{target.storage_path}.\n"
|
189
|
+
end
|
190
|
+
|
191
|
+
def print_archive_deleted(archive)
|
192
|
+
print "Removed archive #{archive.storage_path}.\n"
|
193
|
+
end
|
194
|
+
|
195
|
+
def print_source_touched(source,time)
|
196
|
+
print "Source #{source.storage_path} last checked at #{Eve::Message.friendly_now(time)}.\n"
|
197
|
+
end
|
198
|
+
|
199
|
+
def print_already_accessed_source(source,last_accessed,next_access)
|
200
|
+
print "Last checked #{source.storage_path} at #{last_accessed} will check again after #{next_access}.\n"
|
201
|
+
end
|
202
|
+
|
203
|
+
def print_unable_to_sort_file(filename, e = nil)
|
204
|
+
msg = "Unable to sort #{filename}"
|
205
|
+
e.nil? ? print("#{msg}\n") : print_error(msg,e)
|
206
|
+
end
|
207
|
+
|
208
|
+
def print_sorted_file(index,inputfilename, outputfilename, duration)
|
209
|
+
msg = "Sorted #{inputfilename} (column index #{index}) "
|
210
|
+
msg += "into #{outputfilename} " if inputfilename != outputfilename
|
211
|
+
msg += "in #{duration}\n"
|
212
|
+
print msg
|
213
|
+
end
|
214
|
+
|
215
|
+
def print_no_archive_format(archive,index)
|
216
|
+
print "No format associated with #{archive.storage_path}. To add a format, run 'archive format #{index} <path-to-format-csv>'\n"
|
217
|
+
end
|
218
|
+
|
219
|
+
def print_no_target_format(target,index)
|
220
|
+
print "No format associated with #{target.storage_path}. To add a format, run 'target format #{index} <path-to-format-csv>'\n"
|
221
|
+
end
|
222
|
+
|
223
|
+
def print_unknown_format_file(storage,filename)
|
224
|
+
print "Unable to set format #{filename} to #{storage}.\n"
|
225
|
+
end
|
226
|
+
|
227
|
+
|
228
|
+
private
|
229
|
+
|
230
|
+
def last_accessed_to_s(input)
|
231
|
+
@app.message.send("last_accessed_to_s",input)
|
232
|
+
end
|
233
|
+
|
234
|
+
def print(msg, raw_options = {}, messenger_name = "console")
|
235
|
+
@app.message.send("print",msg,raw_options,messenger_name)
|
236
|
+
end
|
237
|
+
|
238
|
+
end
|
239
|
+
|
240
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Kpigen
|
2
|
+
|
3
|
+
class KpigenRegistry < Eve::Registry
|
4
|
+
|
5
|
+
@@message = nil
|
6
|
+
|
7
|
+
@@cmd_data = {
|
8
|
+
"version" => []
|
9
|
+
}
|
10
|
+
|
11
|
+
def self.available
|
12
|
+
@@cmd_data
|
13
|
+
end
|
14
|
+
|
15
|
+
#------------
|
16
|
+
# CALLER METHODS
|
17
|
+
#------------
|
18
|
+
|
19
|
+
def self.call_version(app,result,external_name,display_messages)
|
20
|
+
result[:data] = Kpigen::VERSION
|
21
|
+
message(app).print_version if display_messages
|
22
|
+
result
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
def self.message(app)
|
27
|
+
@@message ||= Message.new(app)
|
28
|
+
@@message
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Kpigen
|
4
|
+
|
5
|
+
describe Application do
|
6
|
+
|
7
|
+
before(:each) do
|
8
|
+
@redis = Utest::InmemoryRedis.new
|
9
|
+
@eve = Eve::Application.new(:display => :string, :redis => @redis)
|
10
|
+
@app = Application.new(@eve)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should wrap the Eve::Application" do
|
14
|
+
@app.eve.should == @eve
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "#wrapper" do
|
18
|
+
|
19
|
+
it "should expose the redis db" do
|
20
|
+
@app.redis.should == @redis
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should expose the cmd" do
|
24
|
+
@eve.should_receive(:cmd).with("a",true,true)
|
25
|
+
@app.cmd("a",true,true)
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "#run" do
|
31
|
+
|
32
|
+
it "should add extra args" do
|
33
|
+
@eve.should_receive(:run).with([ "a", "--register", "Eve::BaseRegistry", "--register", "Kpigen::KpigenRegistry", p("#{File.dirname(__FILE__)}/../lib/registry/kpigen_registry.rb") ])
|
34
|
+
@app.run(["a"])
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Kpigen
|
4
|
+
|
5
|
+
describe "KpigenRegistry" do
|
6
|
+
|
7
|
+
before(:each) do
|
8
|
+
@now = Time.parse('2010-09-21 23:15:20')
|
9
|
+
@now_plus_four = Time.parse('2010-09-21 23:19:20')
|
10
|
+
@now_plus_six = Time.parse('2010-09-21 23:21:20')
|
11
|
+
Time.stub!(:now).and_return(@now)
|
12
|
+
|
13
|
+
`mkdir -p ./kpigen_registry_test`
|
14
|
+
|
15
|
+
@redis = Utest::InmemoryRedis.new
|
16
|
+
@app = Eve::Application.new(:display => :string, :redis => @redis)
|
17
|
+
@app.cmd("appid mykpigen")
|
18
|
+
@app.cmd("register add-path #{File.dirname(__FILE__)}/../lib/registry")
|
19
|
+
@app.cmd("register add Eve::BaseRegistry")
|
20
|
+
@app.cmd("register add Kpigen::KpigenRegistry")
|
21
|
+
@app.reset
|
22
|
+
end
|
23
|
+
|
24
|
+
after(:each) do
|
25
|
+
`rm -rf ./kpigen_registry_test`
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "#cmd" do
|
29
|
+
|
30
|
+
describe "version" do
|
31
|
+
|
32
|
+
it "should include both Eve and Kpigen" do
|
33
|
+
@app.cmd("version")
|
34
|
+
@app.history.should == [ "eve mykpigen (#{$$}), version 0.1.2\n", "kpigen, version 0.0.1\n" ]
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "help" do
|
40
|
+
|
41
|
+
it "should know about the commands" do
|
42
|
+
@app.cmd("help Kpigen::KpigenRegistry")[:data].should == {
|
43
|
+
"version" => [],
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Kpigen
|
4
|
+
|
5
|
+
describe Message do
|
6
|
+
|
7
|
+
before(:each) do
|
8
|
+
@app = Eve::Application.new(:display => :string, :redis => Utest::InmemoryRedis.new)
|
9
|
+
@msg = Message.new(@app)
|
10
|
+
@console = @app.console
|
11
|
+
@system_calls = @app.system_calls
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "print_*" do
|
15
|
+
|
16
|
+
it "print_version" do
|
17
|
+
@msg.print_version
|
18
|
+
@console.history.should == [ "kpigen, version 0.0.1\n" ]
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rspec'
|
3
|
+
|
4
|
+
if ENV['RUN_COVERAGE'] == "1"
|
5
|
+
require 'simplecov'
|
6
|
+
system "mkdir -p ../public/coverage" unless File.exists?("../public/coverage")
|
7
|
+
SimpleCov.configure do
|
8
|
+
coverage_dir '../public/coverage'
|
9
|
+
end
|
10
|
+
SimpleCov.start
|
11
|
+
end
|
12
|
+
|
13
|
+
require File.dirname(__FILE__) + '/../lib/kpigen'
|
14
|
+
|
15
|
+
RSpec.configure do |config|
|
16
|
+
config.mock_with :rspec
|
17
|
+
end
|
metadata
ADDED
@@ -0,0 +1,264 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kpigen
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Andrew Forward
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-05-07 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: evegem
|
16
|
+
requirement: &70102360911240 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.1.2
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70102360911240
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: utest
|
27
|
+
requirement: &70102360985300 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.0.3
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70102360985300
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: watchme
|
38
|
+
requirement: &70102361058200 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 0.0.3
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70102361058200
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: awesome_print
|
49
|
+
requirement: &70102361149380 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70102361149380
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: rake
|
60
|
+
requirement: &70102361166440 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - =
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 0.9.2
|
66
|
+
type: :runtime
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *70102361166440
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rails
|
71
|
+
requirement: &70102361165920 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 3.2.1
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *70102361165920
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: mysql2
|
82
|
+
requirement: &70102361165440 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - =
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: 0.3.11
|
88
|
+
type: :runtime
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *70102361165440
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: rack
|
93
|
+
requirement: &70102361164980 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - =
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: 1.4.1
|
99
|
+
type: :runtime
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *70102361164980
|
102
|
+
- !ruby/object:Gem::Dependency
|
103
|
+
name: eventmachine
|
104
|
+
requirement: &70102361164500 !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - =
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 0.12.10
|
110
|
+
type: :runtime
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: *70102361164500
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: net-ssh
|
115
|
+
requirement: &70102361164000 !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
117
|
+
requirements:
|
118
|
+
- - =
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: 2.3.0
|
121
|
+
type: :runtime
|
122
|
+
prerelease: false
|
123
|
+
version_requirements: *70102361164000
|
124
|
+
- !ruby/object:Gem::Dependency
|
125
|
+
name: redis
|
126
|
+
requirement: &70102361163520 !ruby/object:Gem::Requirement
|
127
|
+
none: false
|
128
|
+
requirements:
|
129
|
+
- - =
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 2.2.0
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: *70102361163520
|
135
|
+
- !ruby/object:Gem::Dependency
|
136
|
+
name: rspec
|
137
|
+
requirement: &70102361163100 !ruby/object:Gem::Requirement
|
138
|
+
none: false
|
139
|
+
requirements:
|
140
|
+
- - ! '>='
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
type: :development
|
144
|
+
prerelease: false
|
145
|
+
version_requirements: *70102361163100
|
146
|
+
- !ruby/object:Gem::Dependency
|
147
|
+
name: autotest
|
148
|
+
requirement: &70102361162500 !ruby/object:Gem::Requirement
|
149
|
+
none: false
|
150
|
+
requirements:
|
151
|
+
- - ! '>='
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0'
|
154
|
+
type: :development
|
155
|
+
prerelease: false
|
156
|
+
version_requirements: *70102361162500
|
157
|
+
- !ruby/object:Gem::Dependency
|
158
|
+
name: autotest-fsevent
|
159
|
+
requirement: &70102361162000 !ruby/object:Gem::Requirement
|
160
|
+
none: false
|
161
|
+
requirements:
|
162
|
+
- - ! '>='
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: '0'
|
165
|
+
type: :development
|
166
|
+
prerelease: false
|
167
|
+
version_requirements: *70102361162000
|
168
|
+
- !ruby/object:Gem::Dependency
|
169
|
+
name: ZenTest
|
170
|
+
requirement: &70102361161480 !ruby/object:Gem::Requirement
|
171
|
+
none: false
|
172
|
+
requirements:
|
173
|
+
- - ! '>='
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: '0'
|
176
|
+
type: :development
|
177
|
+
prerelease: false
|
178
|
+
version_requirements: *70102361161480
|
179
|
+
- !ruby/object:Gem::Dependency
|
180
|
+
name: rb-fsevent
|
181
|
+
requirement: &70102361156060 !ruby/object:Gem::Requirement
|
182
|
+
none: false
|
183
|
+
requirements:
|
184
|
+
- - ! '>='
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
version: '0'
|
187
|
+
type: :development
|
188
|
+
prerelease: false
|
189
|
+
version_requirements: *70102361156060
|
190
|
+
- !ruby/object:Gem::Dependency
|
191
|
+
name: geminabox
|
192
|
+
requirement: &70102361155580 !ruby/object:Gem::Requirement
|
193
|
+
none: false
|
194
|
+
requirements:
|
195
|
+
- - ! '>='
|
196
|
+
- !ruby/object:Gem::Version
|
197
|
+
version: '0'
|
198
|
+
type: :development
|
199
|
+
prerelease: false
|
200
|
+
version_requirements: *70102361155580
|
201
|
+
- !ruby/object:Gem::Dependency
|
202
|
+
name: simplecov
|
203
|
+
requirement: &70102361155120 !ruby/object:Gem::Requirement
|
204
|
+
none: false
|
205
|
+
requirements:
|
206
|
+
- - ! '>='
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '0'
|
209
|
+
type: :development
|
210
|
+
prerelease: false
|
211
|
+
version_requirements: *70102361155120
|
212
|
+
description: A command line tool for generating kpigen data based on csv inputs
|
213
|
+
email:
|
214
|
+
- andrew.forward@cenx.com
|
215
|
+
executables:
|
216
|
+
- kpigen
|
217
|
+
extensions: []
|
218
|
+
extra_rdoc_files: []
|
219
|
+
files:
|
220
|
+
- .gitignore
|
221
|
+
- Gemfile
|
222
|
+
- Rakefile
|
223
|
+
- autotest/discover.rb
|
224
|
+
- bin/kpigen
|
225
|
+
- kpigen.gemspec
|
226
|
+
- lib/kpigen.rb
|
227
|
+
- lib/kpigen/application.rb
|
228
|
+
- lib/kpigen/ci.rake
|
229
|
+
- lib/kpigen/message.rb
|
230
|
+
- lib/kpigen/version.rb
|
231
|
+
- lib/registry/kpigen_registry.rb
|
232
|
+
- spec/application_spec.rb
|
233
|
+
- spec/kpi_registry_spec.rb
|
234
|
+
- spec/message_spec.rb
|
235
|
+
- spec/spec_helper.rb
|
236
|
+
homepage: ''
|
237
|
+
licenses: []
|
238
|
+
post_install_message:
|
239
|
+
rdoc_options: []
|
240
|
+
require_paths:
|
241
|
+
- lib
|
242
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
243
|
+
none: false
|
244
|
+
requirements:
|
245
|
+
- - ! '>='
|
246
|
+
- !ruby/object:Gem::Version
|
247
|
+
version: '0'
|
248
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
249
|
+
none: false
|
250
|
+
requirements:
|
251
|
+
- - ! '>='
|
252
|
+
- !ruby/object:Gem::Version
|
253
|
+
version: '0'
|
254
|
+
requirements: []
|
255
|
+
rubyforge_project:
|
256
|
+
rubygems_version: 1.8.10
|
257
|
+
signing_key:
|
258
|
+
specification_version: 3
|
259
|
+
summary: A command line tool for generating kpigen data based on csv inputs
|
260
|
+
test_files:
|
261
|
+
- spec/application_spec.rb
|
262
|
+
- spec/kpi_registry_spec.rb
|
263
|
+
- spec/message_spec.rb
|
264
|
+
- spec/spec_helper.rb
|