mole 1.0.12 → 1.0.15

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.
Files changed (131) hide show
  1. metadata +24 -146
  2. data/History.txt +0 -17
  3. data/Manifest.txt +0 -132
  4. data/README.txt +0 -216
  5. data/Rakefile +0 -46
  6. data/config/database.yml +0 -21
  7. data/config/test_database.yml +0 -69
  8. data/lib/mole.rb +0 -260
  9. data/lib/mole/db/migrate.rb +0 -90
  10. data/lib/mole/e_mole.rb +0 -75
  11. data/lib/mole/logger.rb +0 -134
  12. data/lib/mole/models/mole_feature.rb +0 -58
  13. data/lib/mole/models/mole_log.rb +0 -31
  14. data/lib/mole/module.rb +0 -292
  15. data/lib/mole/moler.rb +0 -71
  16. data/lib/mole/utils/frameworks.rb +0 -53
  17. data/lib/mole/version.rb +0 -15
  18. data/samples/merbapp/README +0 -14
  19. data/samples/merbapp/Rakefile +0 -124
  20. data/samples/merbapp/app/controllers/application.rb +0 -3
  21. data/samples/merbapp/app/controllers/exceptions.rb +0 -13
  22. data/samples/merbapp/app/controllers/moled.rb +0 -25
  23. data/samples/merbapp/app/helpers/global_helper.rb +0 -5
  24. data/samples/merbapp/app/mailers/views/layout/application.html.erb +0 -1
  25. data/samples/merbapp/app/mailers/views/layout/application.text.erb +0 -1
  26. data/samples/merbapp/app/parts/views/layout/application.html.erb +0 -1
  27. data/samples/merbapp/app/views/exceptions/internal_server_error.html.erb +0 -216
  28. data/samples/merbapp/app/views/exceptions/not_acceptable.html.erb +0 -38
  29. data/samples/merbapp/app/views/exceptions/not_found.html.erb +0 -40
  30. data/samples/merbapp/app/views/layout/application.html.erb +0 -11
  31. data/samples/merbapp/app/views/moled/index.html.erb +0 -5
  32. data/samples/merbapp/app/views/moled/result.html.erb +0 -5
  33. data/samples/merbapp/config/boot.rb +0 -11
  34. data/samples/merbapp/config/dependencies.rb +0 -41
  35. data/samples/merbapp/config/environments/development.rb +0 -1
  36. data/samples/merbapp/config/environments/production.rb +0 -1
  37. data/samples/merbapp/config/environments/test.rb +0 -1
  38. data/samples/merbapp/config/merb.yml +0 -82
  39. data/samples/merbapp/config/merb_init.rb +0 -26
  40. data/samples/merbapp/config/mole_config.rb +0 -33
  41. data/samples/merbapp/config/router.rb +0 -38
  42. data/samples/merbapp/config/upload.conf +0 -0
  43. data/samples/merbapp/public/images/merb.jpg +0 -0
  44. data/samples/merbapp/public/merb.fcgi +0 -6
  45. data/samples/merbapp/public/stylesheets/master.css +0 -119
  46. data/samples/merbapp/script/destroy +0 -32
  47. data/samples/merbapp/script/generate +0 -32
  48. data/samples/merbapp/script/stop_merb +0 -13
  49. data/samples/merbapp/spec/spec_helper.rb +0 -15
  50. data/samples/merbapp/test/test_helper.rb +0 -14
  51. data/samples/railsapp/README +0 -14
  52. data/samples/railsapp/Rakefile +0 -10
  53. data/samples/railsapp/app/controllers/application.rb +0 -13
  54. data/samples/railsapp/app/controllers/moled_controller.rb +0 -23
  55. data/samples/railsapp/app/helpers/application_helper.rb +0 -3
  56. data/samples/railsapp/app/views/moled/index.html.erb +0 -5
  57. data/samples/railsapp/app/views/moled/result.html.erb +0 -5
  58. data/samples/railsapp/config/boot.rb +0 -109
  59. data/samples/railsapp/config/database.yml +0 -13
  60. data/samples/railsapp/config/environment.rb +0 -59
  61. data/samples/railsapp/config/environments/development.rb +0 -18
  62. data/samples/railsapp/config/environments/production.rb +0 -20
  63. data/samples/railsapp/config/environments/test.rb +0 -22
  64. data/samples/railsapp/config/initializers/inflections.rb +0 -10
  65. data/samples/railsapp/config/initializers/mime_types.rb +0 -5
  66. data/samples/railsapp/config/initializers/mole.rb +0 -10
  67. data/samples/railsapp/config/moles/mole_config.rb +0 -44
  68. data/samples/railsapp/config/routes.rb +0 -35
  69. data/samples/railsapp/doc/README_FOR_APP +0 -2
  70. data/samples/railsapp/public/.htaccess +0 -40
  71. data/samples/railsapp/public/404.html +0 -30
  72. data/samples/railsapp/public/422.html +0 -30
  73. data/samples/railsapp/public/500.html +0 -30
  74. data/samples/railsapp/public/dispatch.cgi +0 -10
  75. data/samples/railsapp/public/dispatch.fcgi +0 -24
  76. data/samples/railsapp/public/dispatch.rb +0 -10
  77. data/samples/railsapp/public/favicon.ico +0 -0
  78. data/samples/railsapp/public/images/rails.png +0 -0
  79. data/samples/railsapp/public/javascripts/application.js +0 -2
  80. data/samples/railsapp/public/javascripts/controls.js +0 -963
  81. data/samples/railsapp/public/javascripts/dragdrop.js +0 -972
  82. data/samples/railsapp/public/javascripts/effects.js +0 -1120
  83. data/samples/railsapp/public/javascripts/prototype.js +0 -4225
  84. data/samples/railsapp/public/robots.txt +0 -5
  85. data/samples/railsapp/script/about +0 -3
  86. data/samples/railsapp/script/console +0 -3
  87. data/samples/railsapp/script/destroy +0 -3
  88. data/samples/railsapp/script/generate +0 -3
  89. data/samples/railsapp/script/performance/benchmarker +0 -3
  90. data/samples/railsapp/script/performance/profiler +0 -3
  91. data/samples/railsapp/script/performance/request +0 -3
  92. data/samples/railsapp/script/plugin +0 -3
  93. data/samples/railsapp/script/process/inspector +0 -3
  94. data/samples/railsapp/script/process/reaper +0 -3
  95. data/samples/railsapp/script/process/spawner +0 -3
  96. data/samples/railsapp/script/runner +0 -3
  97. data/samples/railsapp/script/server +0 -3
  98. data/samples/railsapp/test/test_helper.rb +0 -38
  99. data/samples/rubyapp/README +0 -22
  100. data/samples/rubyapp/bin/ruby_app +0 -35
  101. data/samples/rubyapp/config/mole_conf.rb +0 -31
  102. data/samples/rubyapp/lib/fred.rb +0 -22
  103. data/spec/config/auto_mole_config.rb +0 -26
  104. data/spec/config/mole_config.rb +0 -0
  105. data/spec/config/moles/fred_config.rb +0 -0
  106. data/spec/data/blee.rb +0 -64
  107. data/spec/db/migrate_spec.rb +0 -19
  108. data/spec/emole_spec.rb +0 -43
  109. data/spec/logger_spec.rb +0 -56
  110. data/spec/models/mole_feature_spec.rb +0 -48
  111. data/spec/models/mole_log_spec.rb +0 -62
  112. data/spec/module_spec.rb +0 -229
  113. data/spec/mole_spec.rb +0 -135
  114. data/spec/moler_spec.rb +0 -77
  115. data/spec/spec_helper.rb +0 -76
  116. data/spec/utils/framework_spec.rb +0 -99
  117. data/tasks/ann.rake +0 -76
  118. data/tasks/annotations.rake +0 -22
  119. data/tasks/doc.rake +0 -48
  120. data/tasks/gem.rake +0 -110
  121. data/tasks/manifest.rake +0 -49
  122. data/tasks/mole.rake +0 -115
  123. data/tasks/post_load.rake +0 -26
  124. data/tasks/rubyforge.rake +0 -57
  125. data/tasks/setup.rb +0 -227
  126. data/tasks/spec.rake +0 -54
  127. data/tasks/svn.rake +0 -44
  128. data/tasks/test.rake +0 -38
  129. data/templates/mole/e_mole/exception_alerts.rhtml +0 -14
  130. data/templates/mole/e_mole/feature_alerts.rhtml +0 -11
  131. data/templates/mole/e_mole/perf_alerts.rhtml +0 -12
@@ -1,5 +0,0 @@
1
- # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
2
- #
3
- # To ban all spiders from the entire site uncomment the next two lines:
4
- # User-Agent: *
5
- # Disallow: /
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require File.dirname(__FILE__) + '/../config/boot'
3
- require 'commands/about'
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require File.dirname(__FILE__) + '/../config/boot'
3
- require 'commands/console'
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require File.dirname(__FILE__) + '/../config/boot'
3
- require 'commands/destroy'
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require File.dirname(__FILE__) + '/../config/boot'
3
- require 'commands/generate'
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require File.dirname(__FILE__) + '/../../config/boot'
3
- require 'commands/performance/benchmarker'
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require File.dirname(__FILE__) + '/../../config/boot'
3
- require 'commands/performance/profiler'
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require File.dirname(__FILE__) + '/../../config/boot'
3
- require 'commands/performance/request'
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require File.dirname(__FILE__) + '/../config/boot'
3
- require 'commands/plugin'
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require File.dirname(__FILE__) + '/../../config/boot'
3
- require 'commands/process/inspector'
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require File.dirname(__FILE__) + '/../../config/boot'
3
- require 'commands/process/reaper'
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require File.dirname(__FILE__) + '/../../config/boot'
3
- require 'commands/process/spawner'
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require File.dirname(__FILE__) + '/../config/boot'
3
- require 'commands/runner'
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require File.dirname(__FILE__) + '/../config/boot'
3
- require 'commands/server'
@@ -1,38 +0,0 @@
1
- ENV["RAILS_ENV"] = "test"
2
- require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
3
- require 'test_help'
4
-
5
- class Test::Unit::TestCase
6
- # Transactional fixtures accelerate your tests by wrapping each test method
7
- # in a transaction that's rolled back on completion. This ensures that the
8
- # test database remains unchanged so your fixtures don't have to be reloaded
9
- # between every test method. Fewer database queries means faster tests.
10
- #
11
- # Read Mike Clark's excellent walkthrough at
12
- # http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
13
- #
14
- # Every Active Record database supports transactions except MyISAM tables
15
- # in MySQL. Turn off transactional fixtures in this case; however, if you
16
- # don't care one way or the other, switching from MyISAM to InnoDB tables
17
- # is recommended.
18
- #
19
- # The only drawback to using transactional fixtures is when you actually
20
- # need to test transactions. Since your test is bracketed by a transaction,
21
- # any transactions started in your code will be automatically rolled back.
22
- self.use_transactional_fixtures = true
23
-
24
- # Instantiated fixtures are slow, but give you @david where otherwise you
25
- # would need people(:david). If you don't want to migrate your existing
26
- # test cases which use the @david style and don't mind the speed hit (each
27
- # instantiated fixtures translates to a database query per test method),
28
- # then set this back to true.
29
- self.use_instantiated_fixtures = false
30
-
31
- # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
32
- #
33
- # Note: You'll currently still have to declare fixtures explicitly in integration tests
34
- # -- they do not yet inherit this setting
35
- fixtures :all
36
-
37
- # Add more helper methods to be used by all tests here...
38
- end
@@ -1,22 +0,0 @@
1
- Sample MOled Ruby App
2
-
3
- Launch the app using either of the following cmd line
4
-
5
- > cd samples/rubyapp
6
-
7
-
8
- To mole a regular method
9
-
10
- > ./bin/ruby_app --feature
11
-
12
-
13
-
14
- To mole a slow method
15
-
16
- > ./bin/ruby_app --slow
17
-
18
-
19
-
20
- To mole a hosed method that will throw an uncaught exception
21
-
22
- > ./bin/ruby_app --hosed
@@ -1,35 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require File.join( File.dirname(__FILE__), %w[.. lib fred] )
3
- require 'rubygems'
4
-
5
- # Initializes the MOle. The configuration file will be read from config/mole_conf.rb.
6
- require 'mole'
7
- ::Mole.initialize( :moleable => true,
8
- :application => "RubyApp",
9
- :perf_threshold => 2,
10
- :mole_config => File.join( File.dirname(__FILE__), %w[.. config mole_conf.rb]) )
11
- ::Mole.dump
12
- ::Mole.load_mole_configuration
13
-
14
- class Runner
15
- def initialize( args )
16
- check_args( args )
17
- fred = RubyApp::Fred.new
18
- case args.first
19
- when "--feature": fred.my_feature( 10, "Hello", 20 ) { puts "Hello" }
20
- when "--slow" : fred.my_slow_feature( "World" )
21
- when "--hosed" : fred.my_hosed_feature( "Boom" ) rescue nil
22
- end
23
- end
24
-
25
- def check_args( args )
26
- print_usage if !args or args.empty? or !["--feature", "--slow", "--hosed"].include?( args.first )
27
- end
28
-
29
- def print_usage
30
- puts "Please enter one of the following options: --feature | --slow | --hosed"
31
- end
32
- end
33
-
34
- Runner.new( ARGV )
35
-
@@ -1,31 +0,0 @@
1
- # Mole a feature called 'my_feature' on class Fred
2
- RubyApp::Fred.mole_after( :feature => :my_feature ) { |context, feature, ret, block, *args|
3
- ::Mole::Moler.mole_it(
4
- context , # Calling context => Fred instance
5
- feature , # Method called on Fred => my_feature
6
- "AppBreaker" , # If we had real user information we would put it here...
7
- :args => args.join( ", " ), # The args passed into my_feature
8
- :returned => ret ) # The value returned by my_feature call
9
- }
10
-
11
- # Monitor perf on all instance methods defined on Fred
12
- RubyApp::Fred.mole_perf do |context, feature, elapsed_time, ret, block, *args|
13
- ::Mole::Moler.perf_it(
14
- context ,
15
- "AppBreaker" , # User info
16
- :controller => context.class.name ,
17
- :feature => feature ,
18
- :args => args ,
19
- :returned => ret ,
20
- :elapsed_time => "%3.3f" % elapsed_time )
21
- end
22
-
23
- # Monitors unchecked exceptions raise in Fred
24
- RubyApp::Fred.mole_unchecked do |context, feature, boom, ret, block, *args|
25
- ::Mole::Moler.check_it(
26
- context ,
27
- "AppBreaker" , # User info
28
- :controller => context.class.name,
29
- :feature => feature ,
30
- :boom => boom )
31
- end
@@ -1,22 +0,0 @@
1
- # Sample ruby class that is used in our ruby applications
2
- # We will MOle this class and capture the essence of the interactions
3
- module RubyApp
4
- class Fred
5
-
6
- # Pure feature
7
- def my_feature( arg1, arg2, arg3, &block )
8
- "#{arg1}--#{arg2}--#{arg3}"
9
- end
10
-
11
- # Slow feature
12
- def my_slow_feature( arg1 )
13
- sleep( 2 )
14
- "slow returned #{arg1}"
15
- end
16
-
17
- # Hose feature
18
- def my_hosed_feature( arg1 )
19
- raise "This will hose your app"
20
- end
21
- end
22
- end
@@ -1,26 +0,0 @@
1
- ::Mole.auto_perf( File.join( File.dirname(__FILE__), %w[.. data] ) ) do |context, feature, elapsed_time, ret_val, block, *args|
2
- ::Mole::Moler.perf_it(
3
- context ,
4
- "AppBreaker" ,
5
- :controller => context.class.name,
6
- :feature => feature ,
7
- :args => args ,
8
- :elapsed_time => "%3.3f" % elapsed_time )
9
- end
10
-
11
- ::Mole.auto_unchecked( File.join( File.dirname(__FILE__), %w[.. data] ) ) do |context, feature, boom, ret_val, block, *args|
12
- ::Mole::Moler.check_it(
13
- context ,
14
- "AppBreaker" ,
15
- :controller => context.class.name,
16
- :feature => feature ,
17
- :boom => boom )
18
- end
19
-
20
- ::Mole.auto_after( File.join( File.dirname(__FILE__), %w[.. data] ) ) do |context, feature, ret, block, *args|
21
- ::Mole::Moler.mole_it(
22
- context ,
23
- feature ,
24
- "AppBreaker",
25
- :args => args )
26
- end
File without changes
File without changes
@@ -1,64 +0,0 @@
1
- require 'mole/module'
2
-
3
- class Blee
4
- def self.blee_static
5
- end
6
-
7
- def crap_out
8
- end
9
-
10
- def crap_out_too
11
- end
12
-
13
- def blee_no_args
14
- 10
15
- end
16
-
17
- # Try some ßpunctuations...
18
- def get_out?
19
- true
20
- end
21
-
22
- def blee_args( a, b, c, d )
23
- # puts ">>> Blee Many Args #{[a,b,c,d].join( "--" )}"
24
- 20
25
- end
26
-
27
- def blee_block( a, b, c, d, &block )
28
- # puts ">>> Blee Many Block #{[a,b,c,d,block].join( "--" )}"
29
- 10
30
- end
31
-
32
- def blee_args_ret( a )
33
- "Hello #{a}"
34
- end
35
-
36
- def blee_raise
37
- raise "Blee exception"
38
- end
39
-
40
- def blee_raise_too
41
- raise "Blee exception"
42
- end
43
-
44
- def blee_slow
45
- sleep( 1 )
46
- end
47
-
48
- def blee_slow_too
49
- sleep( 1 )
50
- end
51
-
52
- private
53
-
54
- def blee_private( arg )
55
- arg
56
- end
57
-
58
- protected
59
-
60
- def blee_protected( arg )
61
- arg
62
- end
63
-
64
- end
@@ -1,19 +0,0 @@
1
- require File.join(File.dirname(__FILE__), "..", "spec_helper" )
2
-
3
- describe Mole::Db::Migrate do
4
- before( :all ) do
5
- ::Mole.reset_configuration!
6
- ::Mole.initialize( :moleable => true )
7
- @config = ::File.expand_path( ::File.join(::File.dirname(__FILE__), %w[.. .. config database.yml] ) )
8
- end
9
-
10
- it "migrates down correctly" do
11
- mgt = Mole::Db::Migrate.new( OpenStruct.new( :direction => :down, :configuration => @config, :environment => 'test' ) )
12
- mgt.apply
13
- end
14
-
15
- it "migrates up correctly" do
16
- mgt = Mole::Db::Migrate.new( OpenStruct.new( :direction => :up, :configuration => @config, :environment => 'test' ) )
17
- mgt.apply
18
- end
19
- end
@@ -1,43 +0,0 @@
1
- require File.join(File.dirname(__FILE__), "spec_helper" )
2
-
3
- require 'action_mailer'
4
- ActionMailer::Base.delivery_method = :sendmail
5
- ActionMailer::Base.raise_delivery_errors = true
6
-
7
- # TODO Figure out how to auto check email was sent
8
- describe Mole::EMole do
9
- before( :each ) do
10
- ::Mole.reset_configuration!
11
- ::Mole.initialize( :moleable => true,
12
- :emole_from => "MOleBeatch@liquidrail.com",
13
- :emole_recipients => ['fernand@liquidrail.com'] )
14
- end
15
-
16
- it "should send out a correct perf alert" do
17
- Mole::EMole.deliver_perf_alerts(
18
- self,
19
- "fernand",
20
- :feature => "test",
21
- :elapsed_time => 10 )
22
- end
23
-
24
- it "should send out a correct feature alert" do
25
- Mole::EMole.deliver_feature_alerts(
26
- self,
27
- "fernand",
28
- :feature => "test",
29
- :fred => "blee" )
30
- end
31
-
32
- it "should send out a correct exception alert" do
33
- begin
34
- raise "Something craped out"
35
- rescue => boom
36
- Mole::EMole.deliver_exception_alerts(
37
- self,
38
- "fernand",
39
- :feature => "test",
40
- :boom => boom )
41
- end
42
- end
43
- end
@@ -1,56 +0,0 @@
1
- require File.join(File.dirname(__FILE__), "spec_helper" )
2
-
3
- require 'stringio'
4
- require File.join(File.dirname(__FILE__), %w[.. lib mole logger] )
5
-
6
- describe Mole::Logger do
7
- it "raises an error if the email addresses passed in is empty" do
8
- lambda { Mole::Logger.new( { :email_alerts_to => [] } ) }.should raise_error( Mole::Logger::ConfigurationError )
9
- end
10
-
11
- it "configures an email appender if :email_alerts is set" do
12
- l = Mole::Logger.new( { :logger_name => "Test2", :email_alerts_to => "fernand@invalid.address", :email_alert_level => :off })
13
- l.email_appender.should_not == nil
14
- end
15
-
16
- it "does not configure an email appender if :email_alerts is not set" do
17
- l = Mole::Logger.new( { :logger_name => "Test3" })
18
- lambda { l.email_appender }.should raise_error( Mole::Logger::ConfigurationError )
19
- end
20
-
21
- it "raises an error if an invalid object is passed in for the :log_file" do
22
- lambda { l = Mole::Logger.new( { :log_file => Object.new } ) }.should raise_error( Mole::Logger::ConfigurationError )
23
- end
24
-
25
- it "logs to an IO stream if given" do
26
- io = StringIO.new
27
- l = Mole::Logger.new( { :log_file => io, :logger_name => "Test4" })
28
- l.info "This is a test io message"
29
- io.string.split("\n").should have(1).item
30
- io.string.should =~ /This is a test io message/
31
- io.string.should =~ /INFO/
32
- end
33
-
34
- it "logs to a file if given a file name to log to" do
35
- log_file = "/tmp/mole_logger_test.log"
36
- FileUtils.rm( log_file ) if File.exists?( log_file )
37
- l = Mole::Logger.new({ :log_file => log_file, :logger_name => "Test5" })
38
- l.info "This is a test log file message"
39
-
40
- log_lines = IO.readlines(log_file)
41
-
42
- log_lines.should have(1).items
43
- log_lines.first.should =~ /This is a test log file message/
44
- log_lines.first.should =~ /INFO/
45
- end
46
-
47
- it "creates a logger from another logger" do
48
- io = StringIO.new
49
- l = Mole::Logger.new( { :log_file => io, :logger_name => ::Mole})
50
- child_l = l.for(Mole)
51
-
52
- child_l.info "This is a child log message"
53
- io.string.should =~ /This is a child log message/
54
- io.string.should =~ /INFO/
55
- end
56
- end