clientperf 0.0.1 → 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.
- data/CONTRIBUTORS +3 -0
- data/History.rdoc +1 -1
- data/LICENSE +22 -0
- data/Manifest +5 -0
- data/Rakefile +1 -0
- data/TODO.rdoc +5 -0
- data/bin/clientperf +3 -3
- data/clientperf.gemspec +7 -4
- data/lib/clientperf.rb +1 -1
- data/lib/clientperf_config.rb +35 -0
- data/lib/clientperf_migrations.rb +55 -0
- metadata +20 -3
data/CONTRIBUTORS
ADDED
data/History.rdoc
CHANGED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2008 Eric Falcao
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person
|
4
|
+
obtaining a copy of this software and associated documentation
|
5
|
+
files (the "Software"), to deal in the Software without
|
6
|
+
restriction, including without limitation the rights to use,
|
7
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
copies of the Software, and to permit persons to whom the
|
9
|
+
Software is furnished to do so, subject to the following
|
10
|
+
conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
17
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
19
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
20
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
data/Manifest
CHANGED
@@ -1,15 +1,20 @@
|
|
1
1
|
bin/clientperf
|
2
|
+
CONTRIBUTORS
|
2
3
|
History.rdoc
|
3
4
|
init.rb
|
4
5
|
lib/clientperf.rb
|
6
|
+
lib/clientperf_config.rb
|
5
7
|
lib/clientperf_controller.rb
|
8
|
+
lib/clientperf_migrations.rb
|
6
9
|
lib/clientperf_result.rb
|
7
10
|
lib/clientperf_uri.rb
|
8
11
|
lib/extend_action_controller.rb
|
12
|
+
LICENSE
|
9
13
|
Manifest
|
10
14
|
rails/init.rb
|
11
15
|
Rakefile
|
12
16
|
README.rdoc
|
17
|
+
TODO.rdoc
|
13
18
|
views/clientperf/index.html.erb
|
14
19
|
views/clientperf/show.html.erb
|
15
20
|
views/layouts/clientperf.html.erb
|
data/Rakefile
CHANGED
data/TODO.rdoc
ADDED
data/bin/clientperf
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
require 'fileutils'
|
3
3
|
require File.dirname(__FILE__) << "/../lib/clientperf"
|
4
4
|
require File.dirname(__FILE__) << "/../lib/clientperf_config"
|
5
|
-
require File.dirname(__FILE__) << "/../lib/
|
5
|
+
require File.dirname(__FILE__) << "/../lib/clientperf_migrations"
|
6
6
|
|
7
7
|
# For older Rails versions
|
8
8
|
# USAGE: clientperf [RAILS_ROOT]
|
@@ -25,7 +25,7 @@ File.readlines(File.dirname(__FILE__) << "/../Manifest").each do |line|
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
ClientperfMigrations.
|
29
|
-
ClientperfConfig.create_unless_exists
|
28
|
+
ClientperfMigrations.new(rails_dir).install_new
|
29
|
+
ClientperfConfig.create_unless_exists(rails_dir)
|
30
30
|
|
31
31
|
STDERR.puts "Installed clientperf (v#{Clientperf.version}) in vendor/plugins/clientperf"
|
data/clientperf.gemspec
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
|
2
|
-
# Gem::Specification for Clientperf-0.0.
|
2
|
+
# Gem::Specification for Clientperf-0.0.2
|
3
3
|
# Originally generated by Echoe
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = %q{clientperf}
|
7
|
-
s.version = "0.0.
|
7
|
+
s.version = "0.0.2"
|
8
8
|
|
9
9
|
s.specification_version = 2 if s.respond_to? :specification_version=
|
10
10
|
|
@@ -15,8 +15,8 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.description = %q{Instrumentation for the FiveRuns TuneUp product.}
|
16
16
|
s.email = %q{efalcao@gmail.com}
|
17
17
|
s.executables = ["clientperf"]
|
18
|
-
s.extra_rdoc_files = ["bin/clientperf", "lib/clientperf.rb", "lib/clientperf_controller.rb", "lib/clientperf_result.rb", "lib/clientperf_uri.rb", "lib/extend_action_controller.rb", "README.rdoc"]
|
19
|
-
s.files = ["bin/clientperf", "History.rdoc", "init.rb", "lib/clientperf.rb", "lib/clientperf_controller.rb", "lib/clientperf_result.rb", "lib/clientperf_uri.rb", "lib/extend_action_controller.rb", "Manifest", "rails/init.rb", "Rakefile", "README.rdoc", "views/clientperf/index.html.erb", "views/clientperf/show.html.erb", "views/layouts/clientperf.html.erb", "clientperf.gemspec"]
|
18
|
+
s.extra_rdoc_files = ["bin/clientperf", "lib/clientperf.rb", "lib/clientperf_config.rb", "lib/clientperf_controller.rb", "lib/clientperf_migrations.rb", "lib/clientperf_result.rb", "lib/clientperf_uri.rb", "lib/extend_action_controller.rb", "LICENSE", "README.rdoc", "TODO.rdoc"]
|
19
|
+
s.files = ["bin/clientperf", "CONTRIBUTORS", "History.rdoc", "init.rb", "lib/clientperf.rb", "lib/clientperf_config.rb", "lib/clientperf_controller.rb", "lib/clientperf_migrations.rb", "lib/clientperf_result.rb", "lib/clientperf_uri.rb", "lib/extend_action_controller.rb", "LICENSE", "Manifest", "rails/init.rb", "Rakefile", "README.rdoc", "TODO.rdoc", "views/clientperf/index.html.erb", "views/clientperf/show.html.erb", "views/layouts/clientperf.html.erb", "clientperf.gemspec"]
|
20
20
|
s.has_rdoc = true
|
21
21
|
s.homepage = %q{http://github.com/efalcao/clientperf}
|
22
22
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Clientperf", "--main", "README.rdoc"]
|
@@ -24,6 +24,8 @@ Gem::Specification.new do |s|
|
|
24
24
|
s.rubyforge_project = %q{clientperf}
|
25
25
|
s.rubygems_version = %q{1.0.1}
|
26
26
|
s.summary = %q{Instrumentation for the FiveRuns TuneUp product.}
|
27
|
+
|
28
|
+
s.add_dependency(%q<activesupport>, [">= 0"])
|
27
29
|
end
|
28
30
|
|
29
31
|
|
@@ -41,5 +43,6 @@ end
|
|
41
43
|
# p.project = 'clientperf'
|
42
44
|
# p.summary = "Instrumentation for the FiveRuns TuneUp product."
|
43
45
|
# p.url = "http://github.com/efalcao/clientperf"
|
46
|
+
# p.dependencies = %w(activesupport)
|
44
47
|
# p.include_rakefile = true
|
45
48
|
# end
|
data/lib/clientperf.rb
CHANGED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'activesupport'
|
3
|
+
|
4
|
+
class ClientperfConfig
|
5
|
+
|
6
|
+
delegate :[], :[]=, :each, :update, :to => :data
|
7
|
+
|
8
|
+
class << self
|
9
|
+
def defaults
|
10
|
+
{ 'username' => nil, 'password' => nil }
|
11
|
+
end
|
12
|
+
|
13
|
+
def config_file
|
14
|
+
File.join(RAILS_ROOT, 'config', 'clientperf.yml')
|
15
|
+
end
|
16
|
+
|
17
|
+
def create_unless_exists(rails_dir)
|
18
|
+
file = File.join(rails_dir, 'config', 'clientperf.yml')
|
19
|
+
return if File.exists?(file)
|
20
|
+
|
21
|
+
File.open(file, 'w') { |f| f.puts defaults.to_yaml }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def data
|
26
|
+
@data ||= begin
|
27
|
+
YAML.load(File.read(self.class.config_file)) rescue self.class.defaults
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
def has_auth?
|
33
|
+
data['username'] && data['password']
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
class ClientperfMigrations
|
2
|
+
MIGRATION_NAMES = %w(add_clientperf_tables)
|
3
|
+
MIGRATION_CONTENTS = {
|
4
|
+
:add_clientperf_tables => %(
|
5
|
+
class AddClientperfTables < ActiveRecord::Migration
|
6
|
+
def self.up
|
7
|
+
create_table :clientperf_uris do |t|
|
8
|
+
t.string :uri
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
|
12
|
+
create_table :clientperf_results do |t|
|
13
|
+
t.integer :clientperf_uri_id
|
14
|
+
t.integer :milliseconds
|
15
|
+
t.timestamps
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.down
|
20
|
+
drop_table :clientperf_uris
|
21
|
+
drop_table :clientperf_results
|
22
|
+
end
|
23
|
+
end)
|
24
|
+
}
|
25
|
+
|
26
|
+
attr_accessor :rails_dir
|
27
|
+
|
28
|
+
def initialize(rails_dir)
|
29
|
+
@rails_dir = rails_dir
|
30
|
+
end
|
31
|
+
|
32
|
+
def install_new
|
33
|
+
MIGRATION_NAMES.reject {|name| exists?(name) }.each do |migration|
|
34
|
+
generate(migration)
|
35
|
+
install(migration)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def generate(migration_name)
|
42
|
+
`#{File.join(rails_dir, 'script', 'generate')} migration #{migration_name}`
|
43
|
+
end
|
44
|
+
|
45
|
+
def migration_path(migration_name)
|
46
|
+
Dir[File.join(rails_dir, 'db', 'migrate', "*_#{migration_name}.rb")].first
|
47
|
+
end
|
48
|
+
alias_method :exists?, :migration_path
|
49
|
+
|
50
|
+
def install(migration)
|
51
|
+
File.open(migration_path(migration), 'w') do |file|
|
52
|
+
file << MIGRATION_CONTENTS[migration.to_sym]
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clientperf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Falcao
|
@@ -11,8 +11,16 @@ cert_chain: []
|
|
11
11
|
|
12
12
|
date: 2008-06-18 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: activesupport
|
17
|
+
version_requirement:
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: "0"
|
23
|
+
version:
|
16
24
|
description: Instrumentation for the FiveRuns TuneUp product.
|
17
25
|
email: efalcao@gmail.com
|
18
26
|
executables:
|
@@ -22,24 +30,33 @@ extensions: []
|
|
22
30
|
extra_rdoc_files:
|
23
31
|
- bin/clientperf
|
24
32
|
- lib/clientperf.rb
|
33
|
+
- lib/clientperf_config.rb
|
25
34
|
- lib/clientperf_controller.rb
|
35
|
+
- lib/clientperf_migrations.rb
|
26
36
|
- lib/clientperf_result.rb
|
27
37
|
- lib/clientperf_uri.rb
|
28
38
|
- lib/extend_action_controller.rb
|
39
|
+
- LICENSE
|
29
40
|
- README.rdoc
|
41
|
+
- TODO.rdoc
|
30
42
|
files:
|
31
43
|
- bin/clientperf
|
44
|
+
- CONTRIBUTORS
|
32
45
|
- History.rdoc
|
33
46
|
- init.rb
|
34
47
|
- lib/clientperf.rb
|
48
|
+
- lib/clientperf_config.rb
|
35
49
|
- lib/clientperf_controller.rb
|
50
|
+
- lib/clientperf_migrations.rb
|
36
51
|
- lib/clientperf_result.rb
|
37
52
|
- lib/clientperf_uri.rb
|
38
53
|
- lib/extend_action_controller.rb
|
54
|
+
- LICENSE
|
39
55
|
- Manifest
|
40
56
|
- rails/init.rb
|
41
57
|
- Rakefile
|
42
58
|
- README.rdoc
|
59
|
+
- TODO.rdoc
|
43
60
|
- views/clientperf/index.html.erb
|
44
61
|
- views/clientperf/show.html.erb
|
45
62
|
- views/layouts/clientperf.html.erb
|