padrino-performance 0.11.2 → 0.11.4

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 88cb559c62adba63d3a93b43bc2f8b26a08c55c1
4
+ data.tar.gz: 21155bbb6357a3103c8348803a1b8057eb1bfb26
5
+ SHA512:
6
+ metadata.gz: 3bc9418c45e2b30af1b70efdf6dbf807817856a4e671c99a11f5598c2d2526c62c7ab13316c33c148e6ede9a9a124f5ff6075b8aa335374bd7b0500efba451c7
7
+ data.tar.gz: 0652c403a0d9c8b006aaeb0363362e3fc12475e00f698cc9a345cfb88854ab851fecd27d39425980e45da3c3276af10d5979781d6b0ff64e1e083f08cb491ed9
data/README.md CHANGED
@@ -2,23 +2,49 @@
2
2
 
3
3
  Performance tools for Padrino.
4
4
 
5
- ## "Installation"
6
5
 
7
- Add ```padrino-performance``` to your ```Gemfile```.
6
+ ## Installation
8
7
 
9
- ## Available suites
8
+ Add `padrino-performance` to your `Gemfile` of your Padrino application.
10
9
 
11
- * JSON. ```-j``` or ```--json``` option.
12
- * Memory.
10
+ Install the gem with
13
11
 
14
- ## Basic usage
12
+ $ bundle install
15
13
 
16
- ```bundle exec padrino-performance SUITE -- bundle exec padrino COMMAND```
14
+
15
+ ## Available suites
16
+
17
+ - JSON: Tell you if you have conflicting libraries being declared in your `Gemfile`. Why? Because they would nearly do the same job and this will help you to detect it.
18
+ - You can it by passing the `-j` or `--json` option.
19
+ - Memory: Print the memory usage of your application when it is started.
20
+ - You can it by passing the `-j` or `--json` option.
21
+
22
+
23
+ ## Usage
24
+
25
+ `bundle exec padrino-performance SUITE -- bundle exec padrino COMMAND`
17
26
 
18
27
  E.g.:
19
28
 
20
- * Measure json on a console:
21
- ```bundle exec padrino-performance -j -- bundle exec padrino console```
29
+ - Measure json on a console:
30
+
31
+ bundle exec padrino-performance -j -- bundle exec padrino console
32
+ >> require 'json'
33
+ >> require 'json_pure'
34
+
35
+ Then you will get some error reports in the terminal, which indicates that you have
36
+ conflicting json libraries that do the same
37
+
38
+
39
+ - Measure memory on a running app:
40
+
41
+ bundle exec padrino-performance -m -- bundle exec padrino start
42
+ # The output will be the following
43
+
44
+ total 44056K
45
+ total 44980K
46
+ => Padrino/0.11.2 has taken the stage development at http://127.0.0.1:3000
47
+ >> Thin web server (v1.5.1 codename Straight Razor)
48
+ >> Maximum connections set to 1024
49
+ >> Listening on 127.0.0.1:3000, CTRL+C to stop
22
50
 
23
- * Measure memory on a running app:
24
- ```bundle exec padrino-performance -m -- bundle exec padrino start```
@@ -1,14 +1,14 @@
1
1
  module Padrino
2
2
  module Performance
3
- # OS detection useful for targeting CLI commands
3
+ # OS detection useful for targeting CLI commands.
4
4
  # Source: http://stackoverflow.com/questions/170956/how-can-i-find-which-operating-system-my-ruby-program-is-running-on
5
5
  module OS
6
6
  def self.windows?
7
- (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
7
+ (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RbConfig::CONFIG['target_os']) != nil
8
8
  end
9
9
 
10
10
  def self.mac?
11
- (/darwin/ =~ RUBY_PLATFORM) != nil
11
+ (/darwin/ =~ RbConfig::CONFIG['target_os']) != nil
12
12
  end
13
13
 
14
14
  def self.unix?
@@ -18,6 +18,6 @@ module Padrino
18
18
  def self.linux?
19
19
  self.unix? and not self.mac?
20
20
  end
21
- end # OS
22
- end # Performance
23
- end # Padrino
21
+ end
22
+ end
23
+ end
@@ -1,7 +1,7 @@
1
1
  module Padrino
2
2
  module Performance
3
3
  # The version constant for the current version of Padrino.
4
- VERSION = '0.10.7' unless defined?(Padrino::VERSION)
4
+ VERSION = '0.11.3' unless defined?(Padrino::VERSION)
5
5
 
6
6
  #
7
7
  # The current Padrino version.
data/lib/suites/json.rb CHANGED
@@ -32,9 +32,9 @@ following call stacks to see who loaded the offending libraries
32
32
  and contact the authors if necessary:"
33
33
  WARN
34
34
  loaded_libs.each do |name, stack|
35
- $stderr.puts "============"
35
+ $stderr.puts "=================="
36
36
  $stderr.puts "libname: " + name
37
- $stderr.puts "============"
37
+ $stderr.puts "=================="
38
38
  $stderr.puts caller
39
39
  end
40
40
  end
@@ -45,7 +45,7 @@ WARN
45
45
  end
46
46
 
47
47
  infect_require!
48
- setup_captures!("json", "json_pure", "yajl", "oj", "crack", "crack/json")
48
+ setup_captures!("json", "json_pure", "yajl-ruby", "oj", "crack")
49
49
  end # JSON
50
50
  # Performance
51
51
  end
data/lib/suites/mem.rb CHANGED
@@ -22,12 +22,12 @@ module Padrino
22
22
  end
23
23
  end
24
24
  end
25
-
25
+
26
26
  before_load do
27
- puts `#{perf_memusage_command}`
27
+ puts "Memory before the application is loaded: #{perf_memusage_command}"
28
28
  end
29
29
 
30
30
  after_load do
31
- puts `#{perf_memusage_command}`
31
+ puts "Memory usage after loading the application: #{perf_memusage_command}"
32
32
  end
33
33
  end
data/test/helper.rb ADDED
@@ -0,0 +1,12 @@
1
+ require File.expand_path('../../../load_paths', __FILE__)
2
+ require File.join(File.dirname(__FILE__), '..', '..', 'padrino-core', 'test', 'mini_shoulda')
3
+
4
+ require 'padrino-core'
5
+ require 'padrino-performance'
6
+ require 'rack'
7
+ require 'rack/test'
8
+
9
+ class MiniTest::Spec
10
+ include Rack::Test::Methods
11
+ end
12
+
data/test/test_os.rb ADDED
@@ -0,0 +1,61 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/helper')
2
+
3
+ describe "Padrino Performance OS Module" do
4
+ WINDOWS_RELATED_SYSTEMS = %w(cygwin mswin mingw bccwin wince emx)
5
+
6
+ context "#windows?" do
7
+ should "return false if OS is now windows" do
8
+ RbConfig::CONFIG['target_os'] = "linux"
9
+ refute(Padrino::Performance::OS.windows?, "No non windows system given")
10
+ end
11
+
12
+ should "return true if we have some windows instance" do
13
+ WINDOWS_RELATED_SYSTEMS.each do |system|
14
+ RbConfig::CONFIG['target_os'] = system
15
+ assert(Padrino::Performance::OS.windows?, "#{system} is no windows related operation system.")
16
+ end
17
+ end
18
+ end
19
+
20
+ context "#mac?" do
21
+ should "return true if we have darwin running" do
22
+ RbConfig::CONFIG['target_os'] = 'darwin'
23
+ assert(Padrino::Performance::OS.mac?, "We have no Mac related system running")
24
+ end
25
+
26
+ should "return false if we have linux running" do
27
+ RbConfig::CONFIG['target_os'] = 'linux'
28
+ refute(Padrino::Performance::OS.mac?, "We have no Mac related system running")
29
+ end
30
+ end
31
+
32
+ context "#unix?" do
33
+ should "return true if OS is not windows" do
34
+ RbConfig::CONFIG['target_os'] = 'linux'
35
+ assert(Padrino::Performance::OS.unix?, "We have no windows related system running")
36
+ end
37
+
38
+ should "return false if OS is windows" do
39
+ WINDOWS_RELATED_SYSTEMS.each do |system|
40
+ RbConfig::CONFIG['target_os'] = system
41
+ refute(Padrino::Performance::OS.unix?, "#{system} is windows related operation system.")
42
+ end
43
+ end
44
+ end
45
+
46
+ context "#linux?" do
47
+ should "return true if we have no Windows or Mac related OS" do
48
+ RbConfig::CONFIG['target_os'] = 'linux'
49
+ assert(Padrino::Performance::OS.linux?, 'We have either Mac or Windows operation system.')
50
+ end
51
+
52
+ should "return false if we have a Windows or Mac related OS" do
53
+ RbConfig::CONFIG['target_os'] = 'mingw'
54
+ refute(Padrino::Performance::OS.linux?, 'We a Windows related operation system.')
55
+
56
+ RbConfig::CONFIG['target_os'] = 'darwin'
57
+ refute(Padrino::Performance::OS.linux?, 'We a darwin operation system.')
58
+ end
59
+ end
60
+
61
+ end
@@ -0,0 +1,5 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/helper')
2
+
3
+ describe "Padrino Performance" do
4
+
5
+ end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: padrino-performance
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.2
5
- prerelease:
4
+ version: 0.11.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - Padrino Team
@@ -15,7 +14,7 @@ authors:
15
14
  autorequire:
16
15
  bindir: bin
17
16
  cert_chain: []
18
- date: 2013-05-21 00:00:00.000000000 Z
17
+ date: 2013-09-24 00:00:00.000000000 Z
19
18
  dependencies: []
20
19
  description: A gem for finding performance problems in Padrino by tracking loads and
21
20
  memory consumption.
@@ -35,33 +34,35 @@ files:
35
34
  - lib/suites/json.rb
36
35
  - lib/suites/mem.rb
37
36
  - padrino-performance.gemspec
37
+ - test/helper.rb
38
+ - test/test_os.rb
39
+ - test/test_padrino_performance.rb
38
40
  homepage: http://www.padrinorb.com
39
41
  licenses: []
42
+ metadata: {}
40
43
  post_install_message:
41
44
  rdoc_options:
42
45
  - --charset=UTF-8
43
46
  require_paths:
44
47
  - lib
45
48
  required_ruby_version: !ruby/object:Gem::Requirement
46
- none: false
47
49
  requirements:
48
- - - ! '>='
50
+ - - '>='
49
51
  - !ruby/object:Gem::Version
50
52
  version: '0'
51
- segments:
52
- - 0
53
- hash: 407263033370610842
54
53
  required_rubygems_version: !ruby/object:Gem::Requirement
55
- none: false
56
54
  requirements:
57
- - - ! '>='
55
+ - - '>='
58
56
  - !ruby/object:Gem::Version
59
57
  version: 1.3.6
60
58
  requirements: []
61
59
  rubyforge_project: padrino-performance
62
- rubygems_version: 1.8.25
60
+ rubygems_version: 2.0.6
63
61
  signing_key:
64
- specification_version: 3
62
+ specification_version: 4
65
63
  summary: A gem for finding performance problems in Padrino
66
- test_files: []
64
+ test_files:
65
+ - test/helper.rb
66
+ - test/test_os.rb
67
+ - test/test_padrino_performance.rb
67
68
  has_rdoc: