rubyrep 1.0.3 → 1.0.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.
data/History.txt CHANGED
@@ -1,9 +1,12 @@
1
- == 1.0.3 ???
1
+ == 1.0.4 2009-06-20
2
+
3
+ * Bug fix: added missing file (log_helper.rb) to gem manifest
4
+
5
+ == 1.0.3 2009-06-20
2
6
 
3
7
  * Minor enhancements:
4
8
  * Added support (and according tests) for non-standard table / column names
5
9
  * Verified compatibility with jruby 1.3.0
6
-
7
10
  * Bug fixes:
8
11
  * Also big exception messages should be accommodated in event log table.
9
12
 
data/Manifest.txt CHANGED
@@ -26,6 +26,7 @@ lib/rubyrep/database_proxy.rb
26
26
  lib/rubyrep/direct_table_scan.rb
27
27
  lib/rubyrep/generate_runner.rb
28
28
  lib/rubyrep/initializer.rb
29
+ lib/rubyrep/log_helper.rb
29
30
  lib/rubyrep/logged_change.rb
30
31
  lib/rubyrep/proxied_table_scan.rb
31
32
  lib/rubyrep/proxy_block_cursor.rb
@@ -87,6 +88,7 @@ spec/direct_table_scan_spec.rb
87
88
  spec/dolphins.jpg
88
89
  spec/generate_runner_spec.rb
89
90
  spec/initializer_spec.rb
91
+ spec/log_helper_spec.rb
90
92
  spec/logged_change_spec.rb
91
93
  spec/postgresql_replication_spec.rb
92
94
  spec/postgresql_support_spec.rb
@@ -0,0 +1,30 @@
1
+ module RR
2
+
3
+ # Shared functionality for SyncHelper and LogHelper
4
+ module LogHelper
5
+
6
+ # Takes outcome and details and makes them fit (for available space) in the
7
+ # 'descrition' and 'long_description' columns of the event log.
8
+ # Parameters:
9
+ # * outcome: short description
10
+ # * details: long description
11
+ # Returns (cut off if necessary)
12
+ # * outcome
13
+ # * details (also containig the full outcome if it had to be cut off for short description)
14
+ def fit_description_columns(outcome, details)
15
+ outcome = outcome.to_s
16
+ if outcome.length > ReplicationInitializer::DESCRIPTION_SIZE
17
+ fitting_outcome = outcome[0...ReplicationInitializer::DESCRIPTION_SIZE]
18
+ fitting_details = outcome + "\n"
19
+ else
20
+ fitting_outcome = outcome
21
+ fitting_details = ""
22
+ end
23
+ fitting_details += details if details
24
+ fitting_details = fitting_details[0...ReplicationInitializer::LONG_DESCRIPTION_SIZE]
25
+ fitting_details = nil if fitting_details.empty?
26
+
27
+ return fitting_outcome, fitting_details
28
+ end
29
+ end
30
+ end
@@ -2,7 +2,7 @@ module RR #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 1
4
4
  MINOR = 0
5
- TINY = 3
5
+ TINY = 4
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -0,0 +1,39 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ include RR
4
+
5
+ class MyLogHelper
6
+ include LogHelper
7
+ end
8
+
9
+ describe LogHelper do
10
+ before(:each) do
11
+ end
12
+
13
+ it "should do nothing if the description fields are small enough" do
14
+ MyLogHelper.new.fit_description_columns("bla", "blub").
15
+ should == %w(bla blub)
16
+ end
17
+
18
+ it "should cut details to fit into the 'long_description' column" do
19
+ MyLogHelper.new.fit_description_columns(
20
+ "bla",
21
+ "x" * (ReplicationInitializer::LONG_DESCRIPTION_SIZE - 1) + "yz").
22
+ should == ["bla", "x" * (ReplicationInitializer::LONG_DESCRIPTION_SIZE - 1) + "y"]
23
+ end
24
+
25
+ it "should cut outcome to fit into the 'description' column" do
26
+ MyLogHelper.new.fit_description_columns(
27
+ "x" * (ReplicationInitializer::DESCRIPTION_SIZE - 1) + "yz",
28
+ "blub")[0].
29
+ should == "x" * (ReplicationInitializer::DESCRIPTION_SIZE - 1) + "y"
30
+ end
31
+
32
+ it "should carry over a long outcome into the 'long_description' column" do
33
+ MyLogHelper.new.fit_description_columns(
34
+ "x" * (ReplicationInitializer::DESCRIPTION_SIZE - 1) + "yz",
35
+ "blub")[1].
36
+ should == "x" * (ReplicationInitializer::DESCRIPTION_SIZE - 1) + "yz\nblub"
37
+ end
38
+
39
+ end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyrep
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arndt Lehmann
@@ -103,6 +103,7 @@ files:
103
103
  - lib/rubyrep/direct_table_scan.rb
104
104
  - lib/rubyrep/generate_runner.rb
105
105
  - lib/rubyrep/initializer.rb
106
+ - lib/rubyrep/log_helper.rb
106
107
  - lib/rubyrep/logged_change.rb
107
108
  - lib/rubyrep/proxied_table_scan.rb
108
109
  - lib/rubyrep/proxy_block_cursor.rb
@@ -164,6 +165,7 @@ files:
164
165
  - spec/dolphins.jpg
165
166
  - spec/generate_runner_spec.rb
166
167
  - spec/initializer_spec.rb
168
+ - spec/log_helper_spec.rb
167
169
  - spec/logged_change_spec.rb
168
170
  - spec/postgresql_replication_spec.rb
169
171
  - spec/postgresql_support_spec.rb
metadata.gz.sig CHANGED
Binary file