activemerchant 1.4.2 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (227) hide show
  1. data.tar.gz.sig +0 -0
  2. data/CHANGELOG +78 -0
  3. data/{CONTRIBUTERS → CONTRIBUTORS} +44 -0
  4. data/{README → README.rdoc} +4 -1
  5. data/Rakefile +7 -13
  6. data/lib/active_merchant.rb +11 -21
  7. data/lib/active_merchant/billing/avs_result.rb +13 -10
  8. data/lib/active_merchant/billing/base.rb +2 -2
  9. data/lib/active_merchant/billing/check.rb +1 -1
  10. data/lib/active_merchant/billing/credit_card_methods.rb +2 -2
  11. data/lib/active_merchant/billing/expiry_date.rb +10 -4
  12. data/lib/active_merchant/billing/gateway.rb +7 -6
  13. data/lib/active_merchant/billing/gateways.rb +18 -3
  14. data/lib/active_merchant/billing/gateways/authorize_net.rb +20 -12
  15. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +40 -6
  16. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb.orig +736 -0
  17. data/lib/active_merchant/billing/gateways/braintree.rb +6 -211
  18. data/lib/active_merchant/billing/gateways/data_cash.rb +5 -7
  19. data/lib/active_merchant/billing/gateways/elavon.rb +134 -0
  20. data/lib/active_merchant/billing/gateways/eway.rb +7 -2
  21. data/lib/active_merchant/billing/gateways/first_pay.rb +172 -0
  22. data/lib/active_merchant/billing/gateways/instapay.rb +164 -0
  23. data/lib/active_merchant/billing/gateways/jetpay.rb +270 -0
  24. data/lib/active_merchant/billing/gateways/linkpoint.rb +65 -12
  25. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +154 -0
  26. data/lib/active_merchant/billing/gateways/merchant_ware.rb +283 -0
  27. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +12 -6
  28. data/lib/active_merchant/billing/gateways/ogone.rb +279 -0
  29. data/lib/active_merchant/billing/gateways/pay_secure.rb +1 -1
  30. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +1 -1
  31. data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +1 -1
  32. data/lib/active_merchant/billing/gateways/payflow_express.rb +1 -1
  33. data/lib/active_merchant/billing/gateways/payment_express.rb +20 -32
  34. data/lib/active_merchant/billing/gateways/paypal.rb +22 -9
  35. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +2 -1
  36. data/lib/active_merchant/billing/gateways/paypal_ca.rb +1 -1
  37. data/lib/active_merchant/billing/gateways/psl_card.rb +4 -6
  38. data/lib/active_merchant/billing/gateways/sage/sage_core.rb +7 -1
  39. data/lib/active_merchant/billing/gateways/{protx.rb → sage_pay.rb} +60 -35
  40. data/lib/active_merchant/billing/gateways/sallie_mae.rb +144 -0
  41. data/lib/active_merchant/billing/gateways/secure_pay.rb +1 -1
  42. data/lib/active_merchant/billing/gateways/skip_jack.rb +23 -10
  43. data/lib/active_merchant/billing/gateways/smart_ps.rb +265 -0
  44. data/lib/active_merchant/billing/gateways/transax.rb +25 -0
  45. data/lib/active_merchant/billing/gateways/viaklix.rb +38 -14
  46. data/lib/active_merchant/billing/gateways/wirecard.rb +15 -2
  47. data/lib/active_merchant/billing/integrations.rb +18 -11
  48. data/lib/active_merchant/billing/integrations/bogus.rb +4 -3
  49. data/lib/active_merchant/billing/integrations/chronopay.rb +4 -3
  50. data/lib/active_merchant/billing/integrations/chronopay/notification.rb +3 -1
  51. data/lib/active_merchant/billing/integrations/gestpay.rb +4 -5
  52. data/lib/active_merchant/billing/integrations/gestpay/notification.rb +3 -1
  53. data/lib/active_merchant/billing/integrations/hi_trust.rb +4 -3
  54. data/lib/active_merchant/billing/integrations/nochex.rb +4 -3
  55. data/lib/active_merchant/billing/integrations/nochex/notification.rb +1 -1
  56. data/lib/active_merchant/billing/integrations/paypal.rb +3 -4
  57. data/lib/active_merchant/billing/integrations/paypal/helper.rb +9 -8
  58. data/lib/active_merchant/billing/integrations/quickpay.rb +2 -3
  59. data/lib/active_merchant/billing/integrations/quickpay/helper.rb +1 -1
  60. data/lib/active_merchant/billing/integrations/two_checkout.rb +3 -3
  61. data/lib/active_merchant/lib/connection.rb +170 -0
  62. data/lib/active_merchant/lib/country.rb +4 -1
  63. data/lib/active_merchant/lib/posts_data.rb +22 -84
  64. data/test/fixtures.yml +39 -1
  65. data/test/remote/gateways/remote_authorize_net_cim_test.rb +2 -1
  66. data/test/remote/gateways/remote_authorize_net_test.rb +1 -1
  67. data/test/remote/gateways/remote_beanstream_interac_test.rb +1 -1
  68. data/test/remote/gateways/remote_beanstream_test.rb +1 -1
  69. data/test/remote/gateways/remote_braintree_test.rb +2 -9
  70. data/test/remote/gateways/remote_card_stream_test.rb +1 -1
  71. data/test/remote/gateways/remote_cyber_source_test.rb +1 -1
  72. data/test/remote/gateways/remote_data_cash_test.rb +1 -2
  73. data/test/remote/gateways/remote_efsnet_test.rb +1 -1
  74. data/test/remote/gateways/remote_elavon_test.rb +66 -0
  75. data/test/remote/gateways/remote_eway_test.rb +1 -1
  76. data/test/remote/gateways/remote_exact_test.rb +1 -1
  77. data/test/remote/gateways/remote_first_pay_test.rb +87 -0
  78. data/test/remote/gateways/remote_instapay_test.rb +61 -0
  79. data/test/remote/gateways/remote_jetpay_test.rb +103 -0
  80. data/test/remote/gateways/remote_linkpoint_test.rb +11 -2
  81. data/test/remote/gateways/remote_merchant_e_solutions_test.rb +173 -0
  82. data/test/remote/gateways/remote_merchant_ware_test.rb +113 -0
  83. data/test/remote/gateways/remote_modern_payments_cim_test.rb +1 -1
  84. data/test/remote/gateways/remote_modern_payments_test.rb +23 -9
  85. data/test/remote/gateways/remote_moneris_test.rb +1 -1
  86. data/test/remote/gateways/remote_net_registry_test.rb +1 -1
  87. data/test/remote/gateways/remote_netbilling_test.rb +1 -1
  88. data/test/remote/gateways/remote_ogone_test.rb +115 -0
  89. data/test/remote/gateways/remote_pay_junction_test.rb +1 -1
  90. data/test/remote/gateways/remote_pay_secure_test.rb +1 -1
  91. data/test/remote/gateways/remote_payflow_express_test.rb +1 -1
  92. data/test/remote/gateways/remote_payflow_test.rb +1 -1
  93. data/test/remote/gateways/remote_payflow_uk_test.rb +1 -1
  94. data/test/remote/gateways/remote_payment_express_test.rb +17 -7
  95. data/test/remote/gateways/remote_paypal_express_test.rb +1 -1
  96. data/test/remote/gateways/remote_paypal_test.rb +26 -2
  97. data/test/remote/gateways/remote_plugnpay_test.rb +1 -1
  98. data/test/remote/gateways/remote_psigate_test.rb +1 -1
  99. data/test/remote/gateways/remote_psl_card_test.rb +1 -3
  100. data/test/remote/gateways/remote_quickpay_test.rb +1 -1
  101. data/test/remote/gateways/remote_realex_test.rb +1 -1
  102. data/test/remote/gateways/remote_sage_bankcard_test.rb +1 -1
  103. data/test/remote/gateways/remote_sage_pay_test.rb +219 -0
  104. data/test/remote/gateways/remote_sage_test.rb +1 -1
  105. data/test/remote/gateways/remote_sage_virtual_check_test.rb +1 -1
  106. data/test/remote/gateways/remote_sallie_mae_test.rb +51 -0
  107. data/test/remote/gateways/remote_secure_pay_au_test.rb +1 -1
  108. data/test/remote/gateways/remote_secure_pay_tech_test.rb +1 -1
  109. data/test/remote/gateways/remote_secure_pay_test.rb +2 -2
  110. data/test/remote/gateways/remote_skipjack_test.rb +1 -1
  111. data/test/remote/gateways/remote_trans_first_test.rb +1 -1
  112. data/test/remote/gateways/remote_transax_test.rb +112 -0
  113. data/test/remote/gateways/remote_trust_commerce_test.rb +1 -1
  114. data/test/remote/gateways/remote_usa_epay_test.rb +1 -1
  115. data/test/remote/gateways/remote_verifi_test.rb +1 -1
  116. data/test/remote/gateways/remote_viaklix_test.rb +1 -1
  117. data/test/remote/gateways/remote_wirecard_test.rb +34 -0
  118. data/test/remote/integrations/remote_gestpay_integration_test.rb +1 -1
  119. data/test/remote/integrations/remote_paypal_integration_test.rb +1 -1
  120. data/test/test_helper.rb +81 -89
  121. data/test/unit/avs_result_test.rb +1 -1
  122. data/test/unit/base_test.rb +1 -2
  123. data/test/unit/check_test.rb +1 -1
  124. data/test/unit/connection_test.rb +129 -0
  125. data/test/unit/country_code_test.rb +1 -1
  126. data/test/unit/country_test.rb +1 -1
  127. data/test/unit/credit_card_formatting_test.rb +1 -1
  128. data/test/unit/credit_card_methods_test.rb +10 -1
  129. data/test/unit/credit_card_test.rb +1 -1
  130. data/test/unit/cvv_result_test.rb +1 -1
  131. data/test/unit/expiry_date_test.rb +13 -2
  132. data/test/unit/gateways/authorize_net_cim_test.rb +39 -1
  133. data/test/unit/gateways/authorize_net_test.rb +1 -1
  134. data/test/unit/gateways/beanstream_interac_test.rb +1 -1
  135. data/test/unit/gateways/beanstream_test.rb +1 -1
  136. data/test/unit/gateways/bogus_test.rb +1 -1
  137. data/test/unit/gateways/braintree_test.rb +16 -14
  138. data/test/unit/gateways/card_stream_test.rb +1 -1
  139. data/test/unit/gateways/cyber_source_test.rb +1 -1
  140. data/test/unit/gateways/data_cash_test.rb +2 -1
  141. data/test/unit/gateways/efsnet_test.rb +1 -1
  142. data/test/unit/gateways/elavon_test.rb +139 -0
  143. data/test/unit/gateways/eway_test.rb +1 -1
  144. data/test/unit/gateways/exact_test.rb +1 -1
  145. data/test/unit/gateways/first_pay_test.rb +125 -0
  146. data/test/unit/gateways/gateway_test.rb +1 -1
  147. data/test/unit/gateways/instapay_test.rb +102 -0
  148. data/test/unit/gateways/jetpay_test.rb +185 -0
  149. data/test/unit/gateways/linkpoint_test.rb +37 -7
  150. data/test/unit/gateways/merchant_e_solutions_test.rb +169 -0
  151. data/test/unit/gateways/merchant_ware_test.rb +188 -0
  152. data/test/unit/gateways/modern_payments_cim_test.rb +25 -34
  153. data/test/unit/gateways/moneris_test.rb +1 -1
  154. data/test/unit/gateways/net_registry_test.rb +1 -1
  155. data/test/unit/gateways/netbilling_test.rb +1 -1
  156. data/test/unit/gateways/ogone_test.rb +319 -0
  157. data/test/unit/gateways/pay_junction_test.rb +1 -1
  158. data/test/unit/gateways/pay_secure_test.rb +1 -1
  159. data/test/unit/gateways/payflow_express_test.rb +2 -2
  160. data/test/unit/gateways/payflow_express_uk_test.rb +73 -1
  161. data/test/unit/gateways/payflow_test.rb +1 -1
  162. data/test/unit/gateways/payflow_uk_test.rb +1 -1
  163. data/test/unit/gateways/payment_express_test.rb +3 -3
  164. data/test/unit/gateways/paypal_express_test.rb +1 -1
  165. data/test/unit/gateways/paypal_test.rb +50 -1
  166. data/test/unit/gateways/plugnpay_test.rb +1 -1
  167. data/test/unit/gateways/psigate_test.rb +1 -1
  168. data/test/unit/gateways/psl_card_test.rb +1 -1
  169. data/test/unit/gateways/quickpay_test.rb +1 -1
  170. data/test/unit/gateways/realex_test.rb +1 -1
  171. data/test/unit/gateways/sage_bankcard_test.rb +36 -2
  172. data/test/unit/gateways/{protx_test.rb → sage_pay_test.rb} +49 -32
  173. data/test/unit/gateways/sage_virtual_check_test.rb +1 -1
  174. data/test/unit/gateways/sallie_mae_test.rb +53 -0
  175. data/test/unit/gateways/secure_pay_au_test.rb +1 -1
  176. data/test/unit/gateways/secure_pay_tech_test.rb +1 -1
  177. data/test/unit/gateways/secure_pay_test.rb +24 -10
  178. data/test/unit/gateways/skip_jack_test.rb +81 -1
  179. data/test/unit/gateways/trans_first_test.rb +1 -1
  180. data/test/unit/gateways/trust_commerce_test.rb +1 -1
  181. data/test/unit/gateways/usa_epay_test.rb +1 -1
  182. data/test/unit/gateways/verifi_test.rb +1 -1
  183. data/test/unit/gateways/viaklix_test.rb +1 -1
  184. data/test/unit/gateways/wirecard_test.rb +19 -1
  185. data/test/unit/generators/test_generator_helper.rb +1 -1
  186. data/test/unit/integrations/action_view_helper_test.rb +1 -1
  187. data/test/unit/integrations/bogus_module_test.rb +1 -1
  188. data/test/unit/integrations/chronopay_module_test.rb +1 -1
  189. data/test/unit/integrations/gestpay_module_test.rb +1 -1
  190. data/test/unit/integrations/helpers/bogus_helper_test.rb +1 -1
  191. data/test/unit/integrations/helpers/chronopay_helper_test.rb +1 -1
  192. data/test/unit/integrations/helpers/gestpay_helper_test.rb +1 -1
  193. data/test/unit/integrations/helpers/hi_trust_helper_test.rb +1 -1
  194. data/test/unit/integrations/helpers/nochex_helper_test.rb +1 -1
  195. data/test/unit/integrations/helpers/paypal_helper_test.rb +11 -2
  196. data/test/unit/integrations/helpers/quickpay_helper_test.rb +1 -1
  197. data/test/unit/integrations/helpers/two_checkout_helper_test.rb +1 -1
  198. data/test/unit/integrations/hi_trust_module_test.rb +1 -1
  199. data/test/unit/integrations/nochex_module_test.rb +1 -1
  200. data/test/unit/integrations/notifications/chronopay_notification_test.rb +1 -1
  201. data/test/unit/integrations/notifications/gestpay_notification_test.rb +1 -1
  202. data/test/unit/integrations/notifications/hi_trust_notification_test.rb +1 -1
  203. data/test/unit/integrations/notifications/nochex_notification_test.rb +2 -2
  204. data/test/unit/integrations/notifications/notification_test.rb +1 -1
  205. data/test/unit/integrations/notifications/paypal_notification_test.rb +1 -1
  206. data/test/unit/integrations/notifications/quickpay_notification_test.rb +1 -1
  207. data/test/unit/integrations/notifications/two_checkout_notification_test.rb +1 -1
  208. data/test/unit/integrations/paypal_module_test.rb +1 -1
  209. data/test/unit/integrations/quickpay_module_test.rb +1 -1
  210. data/test/unit/integrations/returns/chronopay_return_test.rb +1 -1
  211. data/test/unit/integrations/returns/gestpay_return_test.rb +1 -1
  212. data/test/unit/integrations/returns/hi_trust_return_test.rb +1 -1
  213. data/test/unit/integrations/returns/nochex_return_test.rb +1 -1
  214. data/test/unit/integrations/returns/paypal_return_test.rb +1 -1
  215. data/test/unit/integrations/returns/return_test.rb +1 -1
  216. data/test/unit/integrations/returns/two_checkout_return_test.rb +1 -1
  217. data/test/unit/integrations/two_checkout_module_test.rb +1 -1
  218. data/test/unit/post_data_test.rb +1 -1
  219. data/test/unit/posts_data_test.rb +14 -66
  220. data/test/unit/response_test.rb +1 -1
  221. data/test/unit/utils_test.rb +1 -1
  222. data/test/unit/validateable_test.rb +1 -1
  223. metadata +41 -45
  224. metadata.gz.sig +0 -0
  225. data/test/extra/binding_of_caller.rb +0 -80
  226. data/test/extra/breakpoint.rb +0 -547
  227. data/test/remote/gateways/remote_protx_test.rb +0 -184
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class ResponseTest < Test::Unit::TestCase
4
4
  def test_response_success
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class UtilsTest < Test::Unit::TestCase
4
4
  def test_unique_id_should_be_32_chars_and_alphanumeric
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class Dood
4
4
  include ActiveMerchant::Validateable
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activemerchant
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Luetke
@@ -30,7 +30,7 @@ cert_chain:
30
30
  hPaSTyVU0yCSnw==
31
31
  -----END CERTIFICATE-----
32
32
 
33
- date: 2009-04-24 00:00:00 -04:00
33
+ date: 2010-02-02 00:00:00 -05:00
34
34
  default_executable:
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
@@ -62,8 +62,6 @@ extensions: []
62
62
  extra_rdoc_files: []
63
63
 
64
64
  files:
65
- - lib/active_merchant
66
- - lib/active_merchant/billing
67
65
  - lib/active_merchant/billing/avs_result.rb
68
66
  - lib/active_merchant/billing/base.rb
69
67
  - lib/active_merchant/billing/check.rb
@@ -73,10 +71,9 @@ files:
73
71
  - lib/active_merchant/billing/cvv_result.rb
74
72
  - lib/active_merchant/billing/expiry_date.rb
75
73
  - lib/active_merchant/billing/gateway.rb
76
- - lib/active_merchant/billing/gateways
77
74
  - lib/active_merchant/billing/gateways/authorize_net.rb
78
75
  - lib/active_merchant/billing/gateways/authorize_net_cim.rb
79
- - lib/active_merchant/billing/gateways/beanstream
76
+ - lib/active_merchant/billing/gateways/authorize_net_cim.rb.orig
80
77
  - lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb
81
78
  - lib/active_merchant/billing/gateways/beanstream.rb
82
79
  - lib/active_merchant/billing/gateways/beanstream_interac.rb
@@ -86,17 +83,23 @@ files:
86
83
  - lib/active_merchant/billing/gateways/cyber_source.rb
87
84
  - lib/active_merchant/billing/gateways/data_cash.rb
88
85
  - lib/active_merchant/billing/gateways/efsnet.rb
86
+ - lib/active_merchant/billing/gateways/elavon.rb
89
87
  - lib/active_merchant/billing/gateways/eway.rb
90
88
  - lib/active_merchant/billing/gateways/exact.rb
89
+ - lib/active_merchant/billing/gateways/first_pay.rb
90
+ - lib/active_merchant/billing/gateways/instapay.rb
91
+ - lib/active_merchant/billing/gateways/jetpay.rb
91
92
  - lib/active_merchant/billing/gateways/linkpoint.rb
93
+ - lib/active_merchant/billing/gateways/merchant_e_solutions.rb
94
+ - lib/active_merchant/billing/gateways/merchant_ware.rb
92
95
  - lib/active_merchant/billing/gateways/modern_payments.rb
93
96
  - lib/active_merchant/billing/gateways/modern_payments_cim.rb
94
97
  - lib/active_merchant/billing/gateways/moneris.rb
95
98
  - lib/active_merchant/billing/gateways/net_registry.rb
96
99
  - lib/active_merchant/billing/gateways/netbilling.rb
100
+ - lib/active_merchant/billing/gateways/ogone.rb
97
101
  - lib/active_merchant/billing/gateways/pay_junction.rb
98
102
  - lib/active_merchant/billing/gateways/pay_secure.rb
99
- - lib/active_merchant/billing/gateways/payflow
100
103
  - lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb
101
104
  - lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb
102
105
  - lib/active_merchant/billing/gateways/payflow/payflow_response.rb
@@ -105,7 +108,6 @@ files:
105
108
  - lib/active_merchant/billing/gateways/payflow_express_uk.rb
106
109
  - lib/active_merchant/billing/gateways/payflow_uk.rb
107
110
  - lib/active_merchant/billing/gateways/payment_express.rb
108
- - lib/active_merchant/billing/gateways/paypal
109
111
  - lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb
110
112
  - lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
111
113
  - lib/active_merchant/billing/gateways/paypal.rb
@@ -113,75 +115,68 @@ files:
113
115
  - lib/active_merchant/billing/gateways/paypal_express.rb
114
116
  - lib/active_merchant/billing/gateways/paypal_express_common.rb
115
117
  - lib/active_merchant/billing/gateways/plugnpay.rb
116
- - lib/active_merchant/billing/gateways/protx.rb
117
118
  - lib/active_merchant/billing/gateways/psigate.rb
118
119
  - lib/active_merchant/billing/gateways/psl_card.rb
119
120
  - lib/active_merchant/billing/gateways/quickpay.rb
120
121
  - lib/active_merchant/billing/gateways/realex.rb
121
- - lib/active_merchant/billing/gateways/sage
122
122
  - lib/active_merchant/billing/gateways/sage/sage_bankcard.rb
123
123
  - lib/active_merchant/billing/gateways/sage/sage_core.rb
124
124
  - lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb
125
125
  - lib/active_merchant/billing/gateways/sage.rb
126
+ - lib/active_merchant/billing/gateways/sage_pay.rb
127
+ - lib/active_merchant/billing/gateways/sallie_mae.rb
126
128
  - lib/active_merchant/billing/gateways/secure_pay.rb
127
129
  - lib/active_merchant/billing/gateways/secure_pay_au.rb
128
130
  - lib/active_merchant/billing/gateways/secure_pay_tech.rb
129
131
  - lib/active_merchant/billing/gateways/skip_jack.rb
132
+ - lib/active_merchant/billing/gateways/smart_ps.rb
130
133
  - lib/active_merchant/billing/gateways/trans_first.rb
134
+ - lib/active_merchant/billing/gateways/transax.rb
131
135
  - lib/active_merchant/billing/gateways/trust_commerce.rb
132
136
  - lib/active_merchant/billing/gateways/usa_epay.rb
133
137
  - lib/active_merchant/billing/gateways/verifi.rb
134
138
  - lib/active_merchant/billing/gateways/viaklix.rb
135
139
  - lib/active_merchant/billing/gateways/wirecard.rb
136
140
  - lib/active_merchant/billing/gateways.rb
137
- - lib/active_merchant/billing/integrations
138
141
  - lib/active_merchant/billing/integrations/action_view_helper.rb
139
- - lib/active_merchant/billing/integrations/bogus
140
142
  - lib/active_merchant/billing/integrations/bogus/helper.rb
141
143
  - lib/active_merchant/billing/integrations/bogus/notification.rb
142
144
  - lib/active_merchant/billing/integrations/bogus/return.rb
143
145
  - lib/active_merchant/billing/integrations/bogus.rb
144
- - lib/active_merchant/billing/integrations/chronopay
145
146
  - lib/active_merchant/billing/integrations/chronopay/helper.rb
146
147
  - lib/active_merchant/billing/integrations/chronopay/notification.rb
147
148
  - lib/active_merchant/billing/integrations/chronopay/return.rb
148
149
  - lib/active_merchant/billing/integrations/chronopay.rb
149
- - lib/active_merchant/billing/integrations/gestpay
150
150
  - lib/active_merchant/billing/integrations/gestpay/common.rb
151
151
  - lib/active_merchant/billing/integrations/gestpay/helper.rb
152
152
  - lib/active_merchant/billing/integrations/gestpay/notification.rb
153
153
  - lib/active_merchant/billing/integrations/gestpay/return.rb
154
154
  - lib/active_merchant/billing/integrations/gestpay.rb
155
155
  - lib/active_merchant/billing/integrations/helper.rb
156
- - lib/active_merchant/billing/integrations/hi_trust
157
156
  - lib/active_merchant/billing/integrations/hi_trust/helper.rb
158
157
  - lib/active_merchant/billing/integrations/hi_trust/notification.rb
159
158
  - lib/active_merchant/billing/integrations/hi_trust/return.rb
160
159
  - lib/active_merchant/billing/integrations/hi_trust.rb
161
- - lib/active_merchant/billing/integrations/nochex
162
160
  - lib/active_merchant/billing/integrations/nochex/helper.rb
163
161
  - lib/active_merchant/billing/integrations/nochex/notification.rb
164
162
  - lib/active_merchant/billing/integrations/nochex/return.rb
165
163
  - lib/active_merchant/billing/integrations/nochex.rb
166
164
  - lib/active_merchant/billing/integrations/notification.rb
167
- - lib/active_merchant/billing/integrations/paypal
168
165
  - lib/active_merchant/billing/integrations/paypal/helper.rb
169
166
  - lib/active_merchant/billing/integrations/paypal/notification.rb
170
167
  - lib/active_merchant/billing/integrations/paypal/return.rb
171
168
  - lib/active_merchant/billing/integrations/paypal.rb
172
- - lib/active_merchant/billing/integrations/quickpay
173
169
  - lib/active_merchant/billing/integrations/quickpay/helper.rb
174
170
  - lib/active_merchant/billing/integrations/quickpay/notification.rb
175
171
  - lib/active_merchant/billing/integrations/quickpay.rb
176
172
  - lib/active_merchant/billing/integrations/return.rb
177
- - lib/active_merchant/billing/integrations/two_checkout
178
173
  - lib/active_merchant/billing/integrations/two_checkout/helper.rb
179
174
  - lib/active_merchant/billing/integrations/two_checkout/notification.rb
180
175
  - lib/active_merchant/billing/integrations/two_checkout/return.rb
181
176
  - lib/active_merchant/billing/integrations/two_checkout.rb
182
177
  - lib/active_merchant/billing/integrations.rb
183
178
  - lib/active_merchant/billing/response.rb
184
- - lib/active_merchant/lib
179
+ - lib/active_merchant/lib/connection.rb
185
180
  - lib/active_merchant/lib/country.rb
186
181
  - lib/active_merchant/lib/error.rb
187
182
  - lib/active_merchant/lib/post_data.rb
@@ -190,16 +185,9 @@ files:
190
185
  - lib/active_merchant/lib/utils.rb
191
186
  - lib/active_merchant/lib/validateable.rb
192
187
  - lib/active_merchant.rb
193
- - lib/certs
194
188
  - lib/certs/cacert.pem
195
- - lib/support
196
189
  - lib/support/gateway_support.rb
197
- - test/extra
198
- - test/extra/binding_of_caller.rb
199
- - test/extra/breakpoint.rb
200
190
  - test/fixtures.yml
201
- - test/remote
202
- - test/remote/gateways
203
191
  - test/remote/gateways/remote_authorize_net_cim_test.rb
204
192
  - test/remote/gateways/remote_authorize_net_test.rb
205
193
  - test/remote/gateways/remote_beanstream_interac_test.rb
@@ -209,14 +197,21 @@ files:
209
197
  - test/remote/gateways/remote_cyber_source_test.rb
210
198
  - test/remote/gateways/remote_data_cash_test.rb
211
199
  - test/remote/gateways/remote_efsnet_test.rb
200
+ - test/remote/gateways/remote_elavon_test.rb
212
201
  - test/remote/gateways/remote_eway_test.rb
213
202
  - test/remote/gateways/remote_exact_test.rb
203
+ - test/remote/gateways/remote_first_pay_test.rb
204
+ - test/remote/gateways/remote_instapay_test.rb
205
+ - test/remote/gateways/remote_jetpay_test.rb
214
206
  - test/remote/gateways/remote_linkpoint_test.rb
207
+ - test/remote/gateways/remote_merchant_e_solutions_test.rb
208
+ - test/remote/gateways/remote_merchant_ware_test.rb
215
209
  - test/remote/gateways/remote_modern_payments_cim_test.rb
216
210
  - test/remote/gateways/remote_modern_payments_test.rb
217
211
  - test/remote/gateways/remote_moneris_test.rb
218
212
  - test/remote/gateways/remote_net_registry_test.rb
219
213
  - test/remote/gateways/remote_netbilling_test.rb
214
+ - test/remote/gateways/remote_ogone_test.rb
220
215
  - test/remote/gateways/remote_pay_junction_test.rb
221
216
  - test/remote/gateways/remote_pay_secure_test.rb
222
217
  - test/remote/gateways/remote_payflow_express_test.rb
@@ -226,32 +221,33 @@ files:
226
221
  - test/remote/gateways/remote_paypal_express_test.rb
227
222
  - test/remote/gateways/remote_paypal_test.rb
228
223
  - test/remote/gateways/remote_plugnpay_test.rb
229
- - test/remote/gateways/remote_protx_test.rb
230
224
  - test/remote/gateways/remote_psigate_test.rb
231
225
  - test/remote/gateways/remote_psl_card_test.rb
232
226
  - test/remote/gateways/remote_quickpay_test.rb
233
227
  - test/remote/gateways/remote_realex_test.rb
234
228
  - test/remote/gateways/remote_sage_bankcard_test.rb
229
+ - test/remote/gateways/remote_sage_pay_test.rb
235
230
  - test/remote/gateways/remote_sage_test.rb
236
231
  - test/remote/gateways/remote_sage_virtual_check_test.rb
232
+ - test/remote/gateways/remote_sallie_mae_test.rb
237
233
  - test/remote/gateways/remote_secure_pay_au_test.rb
238
234
  - test/remote/gateways/remote_secure_pay_tech_test.rb
239
235
  - test/remote/gateways/remote_secure_pay_test.rb
240
236
  - test/remote/gateways/remote_skipjack_test.rb
241
237
  - test/remote/gateways/remote_trans_first_test.rb
238
+ - test/remote/gateways/remote_transax_test.rb
242
239
  - test/remote/gateways/remote_trust_commerce_test.rb
243
240
  - test/remote/gateways/remote_usa_epay_test.rb
244
241
  - test/remote/gateways/remote_verifi_test.rb
245
242
  - test/remote/gateways/remote_viaklix_test.rb
246
243
  - test/remote/gateways/remote_wirecard_test.rb
247
- - test/remote/integrations
248
244
  - test/remote/integrations/remote_gestpay_integration_test.rb
249
245
  - test/remote/integrations/remote_paypal_integration_test.rb
250
246
  - test/test_helper.rb
251
- - test/unit
252
247
  - test/unit/avs_result_test.rb
253
248
  - test/unit/base_test.rb
254
249
  - test/unit/check_test.rb
250
+ - test/unit/connection_test.rb
255
251
  - test/unit/country_code_test.rb
256
252
  - test/unit/country_test.rb
257
253
  - test/unit/credit_card_formatting_test.rb
@@ -259,7 +255,6 @@ files:
259
255
  - test/unit/credit_card_test.rb
260
256
  - test/unit/cvv_result_test.rb
261
257
  - test/unit/expiry_date_test.rb
262
- - test/unit/gateways
263
258
  - test/unit/gateways/authorize_net_cim_test.rb
264
259
  - test/unit/gateways/authorize_net_test.rb
265
260
  - test/unit/gateways/beanstream_interac_test.rb
@@ -270,14 +265,21 @@ files:
270
265
  - test/unit/gateways/cyber_source_test.rb
271
266
  - test/unit/gateways/data_cash_test.rb
272
267
  - test/unit/gateways/efsnet_test.rb
268
+ - test/unit/gateways/elavon_test.rb
273
269
  - test/unit/gateways/eway_test.rb
274
270
  - test/unit/gateways/exact_test.rb
271
+ - test/unit/gateways/first_pay_test.rb
275
272
  - test/unit/gateways/gateway_test.rb
273
+ - test/unit/gateways/instapay_test.rb
274
+ - test/unit/gateways/jetpay_test.rb
276
275
  - test/unit/gateways/linkpoint_test.rb
276
+ - test/unit/gateways/merchant_e_solutions_test.rb
277
+ - test/unit/gateways/merchant_ware_test.rb
277
278
  - test/unit/gateways/modern_payments_cim_test.rb
278
279
  - test/unit/gateways/moneris_test.rb
279
280
  - test/unit/gateways/net_registry_test.rb
280
281
  - test/unit/gateways/netbilling_test.rb
282
+ - test/unit/gateways/ogone_test.rb
281
283
  - test/unit/gateways/pay_junction_test.rb
282
284
  - test/unit/gateways/pay_secure_test.rb
283
285
  - test/unit/gateways/payflow_express_test.rb
@@ -288,13 +290,14 @@ files:
288
290
  - test/unit/gateways/paypal_express_test.rb
289
291
  - test/unit/gateways/paypal_test.rb
290
292
  - test/unit/gateways/plugnpay_test.rb
291
- - test/unit/gateways/protx_test.rb
292
293
  - test/unit/gateways/psigate_test.rb
293
294
  - test/unit/gateways/psl_card_test.rb
294
295
  - test/unit/gateways/quickpay_test.rb
295
296
  - test/unit/gateways/realex_test.rb
296
297
  - test/unit/gateways/sage_bankcard_test.rb
298
+ - test/unit/gateways/sage_pay_test.rb
297
299
  - test/unit/gateways/sage_virtual_check_test.rb
300
+ - test/unit/gateways/sallie_mae_test.rb
298
301
  - test/unit/gateways/secure_pay_au_test.rb
299
302
  - test/unit/gateways/secure_pay_tech_test.rb
300
303
  - test/unit/gateways/secure_pay_test.rb
@@ -305,16 +308,13 @@ files:
305
308
  - test/unit/gateways/verifi_test.rb
306
309
  - test/unit/gateways/viaklix_test.rb
307
310
  - test/unit/gateways/wirecard_test.rb
308
- - test/unit/generators
309
311
  - test/unit/generators/test_gateway_generator.rb
310
312
  - test/unit/generators/test_generator_helper.rb
311
313
  - test/unit/generators/test_integration_generator.rb
312
- - test/unit/integrations
313
314
  - test/unit/integrations/action_view_helper_test.rb
314
315
  - test/unit/integrations/bogus_module_test.rb
315
316
  - test/unit/integrations/chronopay_module_test.rb
316
317
  - test/unit/integrations/gestpay_module_test.rb
317
- - test/unit/integrations/helpers
318
318
  - test/unit/integrations/helpers/bogus_helper_test.rb
319
319
  - test/unit/integrations/helpers/chronopay_helper_test.rb
320
320
  - test/unit/integrations/helpers/gestpay_helper_test.rb
@@ -325,7 +325,6 @@ files:
325
325
  - test/unit/integrations/helpers/two_checkout_helper_test.rb
326
326
  - test/unit/integrations/hi_trust_module_test.rb
327
327
  - test/unit/integrations/nochex_module_test.rb
328
- - test/unit/integrations/notifications
329
328
  - test/unit/integrations/notifications/chronopay_notification_test.rb
330
329
  - test/unit/integrations/notifications/gestpay_notification_test.rb
331
330
  - test/unit/integrations/notifications/hi_trust_notification_test.rb
@@ -336,7 +335,6 @@ files:
336
335
  - test/unit/integrations/notifications/two_checkout_notification_test.rb
337
336
  - test/unit/integrations/paypal_module_test.rb
338
337
  - test/unit/integrations/quickpay_module_test.rb
339
- - test/unit/integrations/returns
340
338
  - test/unit/integrations/returns/chronopay_return_test.rb
341
339
  - test/unit/integrations/returns/gestpay_return_test.rb
342
340
  - test/unit/integrations/returns/hi_trust_return_test.rb
@@ -353,18 +351,16 @@ files:
353
351
  - script/destroy
354
352
  - script/generate
355
353
  - CHANGELOG
356
- - CONTRIBUTERS
354
+ - CONTRIBUTORS
357
355
  - gem-public_cert.pem
358
- - generators
359
356
  - init.rb
360
- - lib
361
357
  - MIT-LICENSE
362
358
  - Rakefile
363
- - README
364
- - script
365
- - test
359
+ - README.rdoc
366
360
  has_rdoc: true
367
361
  homepage: http://activemerchant.org/
362
+ licenses: []
363
+
368
364
  post_install_message:
369
365
  rdoc_options: []
370
366
 
@@ -385,9 +381,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
385
381
  requirements: []
386
382
 
387
383
  rubyforge_project: activemerchant
388
- rubygems_version: 1.3.1
384
+ rubygems_version: 1.3.5
389
385
  signing_key:
390
- specification_version: 2
386
+ specification_version: 3
391
387
  summary: Framework and tools for dealing with credit card transactions.
392
388
  test_files: []
393
389
 
metadata.gz.sig CHANGED
Binary file
@@ -1,80 +0,0 @@
1
- class Continuation # :nodoc:
2
- def self.create(*args, &block) # :nodoc:
3
- cc = nil; result = callcc {|c| cc = c; block.call(cc) if block and args.empty?}
4
- result ||= args
5
- return *[cc, *result]
6
- end
7
- end
8
-
9
- class Binding; end # for RDoc
10
- # This method returns the binding of the method that called your
11
- # method. It will raise an Exception when you're not inside a method.
12
- #
13
- # It's used like this:
14
- # def inc_counter(amount = 1)
15
- # Binding.of_caller do |binding|
16
- # # Create a lambda that will increase the variable 'counter'
17
- # # in the caller of this method when called.
18
- # inc = eval("lambda { |arg| counter += arg }", binding)
19
- # # We can refer to amount from inside this block safely.
20
- # inc.call(amount)
21
- # end
22
- # # No other statements can go here. Put them inside the block.
23
- # end
24
- # counter = 0
25
- # 2.times { inc_counter }
26
- # counter # => 2
27
- #
28
- # Binding.of_caller must be the last statement in the method.
29
- # This means that you will have to put everything you want to
30
- # do after the call to Binding.of_caller into the block of it.
31
- # This should be no problem however, because Ruby has closures.
32
- # If you don't do this an Exception will be raised. Because of
33
- # the way that Binding.of_caller is implemented it has to be
34
- # done this way.
35
- def Binding.of_caller(&block)
36
- old_critical = Thread.critical
37
- Thread.critical = true
38
- count = 0
39
- cc, result, error, extra_data = Continuation.create(nil, nil)
40
- error.call if error
41
-
42
- tracer = lambda do |*args|
43
- type, context, extra_data = args[0], args[4], args
44
- if type == "return"
45
- count += 1
46
- # First this method and then calling one will return --
47
- # the trace event of the second event gets the context
48
- # of the method which called the method that called this
49
- # method.
50
- if count == 2
51
- # It would be nice if we could restore the trace_func
52
- # that was set before we swapped in our own one, but
53
- # this is impossible without overloading set_trace_func
54
- # in current Ruby.
55
- set_trace_func(nil)
56
- cc.call(eval("binding", context), nil, extra_data)
57
- end
58
- elsif type == "line" then
59
- nil
60
- elsif type == "c-return" and extra_data[3] == :set_trace_func then
61
- nil
62
- else
63
- set_trace_func(nil)
64
- error_msg = "Binding.of_caller used in non-method context or " +
65
- "trailing statements of method using it aren't in the block."
66
- cc.call(nil, lambda { raise(ArgumentError, error_msg) }, nil)
67
- end
68
- end
69
-
70
- unless result
71
- set_trace_func(tracer)
72
- return nil
73
- else
74
- Thread.critical = old_critical
75
- case block.arity
76
- when 1 then yield(result)
77
- else yield(result, extra_data)
78
- end
79
- end
80
- end
@@ -1,547 +0,0 @@
1
- # The Breakpoint library provides the convenience of
2
- # being able to inspect and modify state, diagnose
3
- # bugs all via IRB by simply setting breakpoints in
4
- # your applications by the call of a method.
5
- #
6
- # This library was written and is supported by me,
7
- # Florian Gross. I can be reached at flgr@ccan.de
8
- # and enjoy getting feedback about my libraries.
9
- #
10
- # The whole library (including breakpoint_client.rb
11
- # and binding_of_caller.rb) is licensed under the
12
- # same license that Ruby uses. (Which is currently
13
- # either the GNU General Public License or a custom
14
- # one that allows for commercial usage.) If you for
15
- # some good reason need to use this under another
16
- # license please contact me.
17
-
18
- require 'irb'
19
- require 'binding_of_caller'
20
- require 'drb'
21
- require 'drb/acl'
22
- require 'thread'
23
-
24
- module Breakpoint
25
- id = %q$Id: breakpoint.rb 52 2005-02-26 19:43:19Z flgr $
26
- current_version = id.split(" ")[2]
27
- unless defined?(Version)
28
- # The Version of ruby-breakpoint you are using as String of the
29
- # 1.2.3 form where the digits stand for release, major and minor
30
- # version respectively.
31
- Version = "0.5.0"
32
- end
33
-
34
- extend self
35
-
36
- # This will pop up an interactive ruby session at a
37
- # pre-defined break point in a Ruby application. In
38
- # this session you can examine the environment of
39
- # the break point.
40
- #
41
- # You can get a list of variables in the context using
42
- # local_variables via +local_variables+. You can then
43
- # examine their values by typing their names.
44
- #
45
- # You can have a look at the call stack via +caller+.
46
- #
47
- # The source code around the location where the breakpoint
48
- # was executed can be examined via +source_lines+. Its
49
- # argument specifies how much lines of context to display.
50
- # The default amount of context is 5 lines. Note that
51
- # the call to +source_lines+ can raise an exception when
52
- # it isn't able to read in the source code.
53
- #
54
- # breakpoints can also return a value. They will execute
55
- # a supplied block for getting a default return value.
56
- # A custom value can be returned from the session by doing
57
- # +throw(:debug_return, value)+.
58
- #
59
- # You can also give names to break points which will be
60
- # used in the message that is displayed upon execution
61
- # of them.
62
- #
63
- # Here's a sample of how breakpoints should be placed:
64
- #
65
- # class Person
66
- # def initialize(name, age)
67
- # @name, @age = name, age
68
- # breakpoint("Person#initialize")
69
- # end
70
- #
71
- # attr_reader :age
72
- # def name
73
- # breakpoint("Person#name") { @name }
74
- # end
75
- # end
76
- #
77
- # person = Person.new("Random Person", 23)
78
- # puts "Name: #{person.name}"
79
- #
80
- # And here is a sample debug session:
81
- #
82
- # Executing break point "Person#initialize" at file.rb:4 in `initialize'
83
- # irb(#<Person:0x292fbe8>):001:0> local_variables
84
- # => ["name", "age", "_", "__"]
85
- # irb(#<Person:0x292fbe8>):002:0> [name, age]
86
- # => ["Random Person", 23]
87
- # irb(#<Person:0x292fbe8>):003:0> [@name, @age]
88
- # => ["Random Person", 23]
89
- # irb(#<Person:0x292fbe8>):004:0> self
90
- # => #<Person:0x292fbe8 @age=23, @name="Random Person">
91
- # irb(#<Person:0x292fbe8>):005:0> @age += 1; self
92
- # => #<Person:0x292fbe8 @age=24, @name="Random Person">
93
- # irb(#<Person:0x292fbe8>):006:0> exit
94
- # Executing break point "Person#name" at file.rb:9 in `name'
95
- # irb(#<Person:0x292fbe8>):001:0> throw(:debug_return, "Overriden name")
96
- # Name: Overriden name
97
- #
98
- # Breakpoint sessions will automatically have a few
99
- # convenience methods available. See Breakpoint::CommandBundle
100
- # for a list of them.
101
- #
102
- # Breakpoints can also be used remotely over sockets.
103
- # This is implemented by running part of the IRB session
104
- # in the application and part of it in a special client.
105
- # You have to call Breakpoint.activate_drb to enable
106
- # support for remote breakpoints and then run
107
- # breakpoint_client.rb which is distributed with this
108
- # library. See the documentation of Breakpoint.activate_drb
109
- # for details.
110
- def breakpoint(id = nil, context = nil, &block)
111
- callstack = caller
112
- callstack.slice!(0, 3) if callstack.first["breakpoint"]
113
- file, line, method = *callstack.first.match(/^(.+?):(\d+)(?::in `(.*?)')?/).captures
114
-
115
- message = "Executing break point " + (id ? "#{id.inspect} " : "") +
116
- "at #{file}:#{line}" + (method ? " in `#{method}'" : "")
117
-
118
- if context then
119
- return handle_breakpoint(context, message, file, line, &block)
120
- end
121
-
122
- Binding.of_caller do |binding_context|
123
- handle_breakpoint(binding_context, message, file, line, &block)
124
- end
125
- end
126
-
127
- # These commands are automatically available in all breakpoint shells.
128
- module CommandBundle
129
- # Proxy to a Breakpoint client. Lets you directly execute code
130
- # in the context of the client.
131
- class Client
132
- def initialize(eval_handler) # :nodoc:
133
- eval_handler.untaint
134
- @eval_handler = eval_handler
135
- end
136
-
137
- instance_methods.each do |method|
138
- next if method[/^__.+__$/]
139
- undef_method method
140
- end
141
-
142
- # Executes the specified code at the client.
143
- def eval(code)
144
- @eval_handler.call(code)
145
- end
146
-
147
- # Will execute the specified statement at the client.
148
- def method_missing(method, *args, &block)
149
- if args.empty? and not block
150
- result = eval "#{method}"
151
- else
152
- # This is a bit ugly. The alternative would be using an
153
- # eval context instead of an eval handler for executing
154
- # the code at the client. The problem with that approach
155
- # is that we would have to handle special expressions
156
- # like "self", "nil" or constants ourself which is hard.
157
- remote = eval %{
158
- result = lambda { |block, *args| #{method}(*args, &block) }
159
- def result.call_with_block(*args, &block)
160
- call(block, *args)
161
- end
162
- result
163
- }
164
- remote.call_with_block(*args, &block)
165
- end
166
-
167
- return result
168
- end
169
- end
170
-
171
- # Returns the source code surrounding the location where the
172
- # breakpoint was issued.
173
- def source_lines(context = 5, return_line_numbers = false)
174
- lines = File.readlines(@__bp_file).map { |line| line.chomp }
175
-
176
- break_line = @__bp_line
177
- start_line = [break_line - context, 1].max
178
- end_line = break_line + context
179
-
180
- result = lines[(start_line - 1) .. (end_line - 1)]
181
-
182
- if return_line_numbers then
183
- return [start_line, break_line, result]
184
- else
185
- return result
186
- end
187
- end
188
-
189
- # Lets an object that will forward method calls to the breakpoint
190
- # client. This is useful for outputting longer things at the client
191
- # and so on. You can for example do these things:
192
- #
193
- # client.puts "Hello" # outputs "Hello" at client console
194
- # # outputs "Hello" into the file temp.txt at the client
195
- # client.File.open("temp.txt", "w") { |f| f.puts "Hello" }
196
- def client()
197
- if Breakpoint.use_drb? then
198
- sleep(0.5) until Breakpoint.drb_service.eval_handler
199
- Client.new(Breakpoint.drb_service.eval_handler)
200
- else
201
- Client.new(lambda { |code| eval(code, TOPLEVEL_BINDING) })
202
- end
203
- end
204
- end
205
-
206
- def handle_breakpoint(context, message, file = "", line = "", &block) # :nodoc:
207
- catch(:debug_return) do |value|
208
- eval(%{
209
- @__bp_file = #{file.inspect}
210
- @__bp_line = #{line}
211
- extend Breakpoint::CommandBundle
212
- extend DRbUndumped if self
213
- }, context) rescue nil
214
-
215
- if not use_drb? then
216
- puts message
217
- IRB.start(nil, IRB::WorkSpace.new(context))
218
- else
219
- @drb_service.add_breakpoint(context, message)
220
- end
221
-
222
- block.call if block
223
- end
224
- end
225
-
226
- # These exceptions will be raised on failed asserts
227
- # if Breakpoint.asserts_cause_exceptions is set to
228
- # true.
229
- class FailedAssertError < RuntimeError
230
- end
231
-
232
- # This asserts that the block evaluates to true.
233
- # If it doesn't evaluate to true a breakpoint will
234
- # automatically be created at that execution point.
235
- #
236
- # You can disable assert checking in production
237
- # code by setting Breakpoint.optimize_asserts to
238
- # true. (It will still be enabled when Ruby is run
239
- # via the -d argument.)
240
- #
241
- # Example:
242
- # person_name = "Foobar"
243
- # assert { not person_name.nil? }
244
- #
245
- # Note: If you want to use this method from an
246
- # unit test, you will have to call it by its full
247
- # name, Breakpoint.assert.
248
- def assert(context = nil, &condition)
249
- return if Breakpoint.optimize_asserts and not $DEBUG
250
- return if yield
251
-
252
- callstack = caller
253
- callstack.slice!(0, 3) if callstack.first["assert"]
254
- file, line, method = *callstack.first.match(/^(.+?):(\d+)(?::in `(.*?)')?/).captures
255
-
256
- message = "Assert failed at #{file}:#{line}#{" in `#{method}'" if method}."
257
-
258
- if Breakpoint.asserts_cause_exceptions and not $DEBUG then
259
- raise(Breakpoint::FailedAssertError, message)
260
- end
261
-
262
- message += " Executing implicit breakpoint."
263
-
264
- if context then
265
- return handle_breakpoint(context, message, file, line)
266
- end
267
-
268
- Binding.of_caller do |context|
269
- handle_breakpoint(context, message, file, line)
270
- end
271
- end
272
-
273
- # Whether asserts should be ignored if not in debug mode.
274
- # Debug mode can be enabled by running ruby with the -d
275
- # switch or by setting $DEBUG to true.
276
- attr_accessor :optimize_asserts
277
- self.optimize_asserts = false
278
-
279
- # Whether an Exception should be raised on failed asserts
280
- # in non-$DEBUG code or not. By default this is disabled.
281
- attr_accessor :asserts_cause_exceptions
282
- self.asserts_cause_exceptions = false
283
- @use_drb = false
284
-
285
- attr_reader :drb_service # :nodoc:
286
-
287
- class DRbService # :nodoc:
288
- include DRbUndumped
289
-
290
- def initialize
291
- @handler = @eval_handler = @collision_handler = nil
292
-
293
- IRB.instance_eval { @CONF[:RC] = true }
294
- IRB.run_config
295
- end
296
-
297
- def collision
298
- sleep(0.5) until @collision_handler
299
-
300
- @collision_handler.untaint
301
-
302
- @collision_handler.call
303
- end
304
-
305
- def ping() end
306
-
307
- def add_breakpoint(context, message)
308
- workspace = IRB::WorkSpace.new(context)
309
- workspace.extend(DRbUndumped)
310
-
311
- sleep(0.5) until @handler
312
-
313
- @handler.untaint
314
- @handler.call(workspace, message)
315
- rescue Errno::ECONNREFUSED, DRb::DRbConnError
316
- raise if Breakpoint.use_drb?
317
- end
318
-
319
- attr_accessor :handler, :eval_handler, :collision_handler
320
- end
321
-
322
- # Will run Breakpoint in DRb mode. This will spawn a server
323
- # that can be attached to via the breakpoint-client command
324
- # whenever a breakpoint is executed. This is useful when you
325
- # are debugging CGI applications or other applications where
326
- # you can't access debug sessions via the standard input and
327
- # output of your application.
328
- #
329
- # You can specify an URI where the DRb server will run at.
330
- # This way you can specify the port the server runs on. The
331
- # default URI is druby://localhost:42531.
332
- #
333
- # Please note that breakpoints will be skipped silently in
334
- # case the DRb server can not spawned. (This can happen if
335
- # the port is already used by another instance of your
336
- # application on CGI or another application.)
337
- #
338
- # Also note that by default this will only allow access
339
- # from localhost. You can however specify a list of
340
- # allowed hosts or nil (to allow access from everywhere).
341
- # But that will still not protect you from somebody
342
- # reading the data as it goes through the net.
343
- #
344
- # A good approach for getting security and remote access
345
- # is setting up an SSH tunnel between the DRb service
346
- # and the client. This is usually done like this:
347
- #
348
- # $ ssh -L20000:127.0.0.1:20000 -R10000:127.0.0.1:10000 example.com
349
- # (This will connect port 20000 at the client side to port
350
- # 20000 at the server side, and port 10000 at the server
351
- # side to port 10000 at the client side.)
352
- #
353
- # After that do this on the server side: (the code being debugged)
354
- # Breakpoint.activate_drb("druby://127.0.0.1:20000", "localhost")
355
- #
356
- # And at the client side:
357
- # ruby breakpoint_client.rb -c druby://127.0.0.1:10000 -s druby://127.0.0.1:20000
358
- #
359
- # Running through such a SSH proxy will also let you use
360
- # breakpoint.rb in case you are behind a firewall.
361
- #
362
- # Detailed information about running DRb through firewalls is
363
- # available at http://www.rubygarden.org/ruby?DrbTutorial
364
- #
365
- # == Security considerations
366
- # Usually you will be fine when using the default druby:// URI and the default
367
- # access control list. However, if you are sitting on a machine where there are
368
- # local users that you likely can not trust (this is the case for example on
369
- # most web hosts which have multiple users sitting on the same physical machine)
370
- # you will be better off by doing client/server communication through a unix
371
- # socket. This can be accomplished by calling with a drbunix:/ style URI, e.g.
372
- # <code>Breakpoint.activate_drb('drbunix:/tmp/breakpoint_server')</code>. This
373
- # will only work on Unix based platforms.
374
- def activate_drb(uri = nil, allowed_hosts = ['localhost', '127.0.0.1', '::1'],
375
- ignore_collisions = false)
376
-
377
- return false if @use_drb
378
-
379
- uri ||= 'druby://localhost:42531'
380
-
381
- if allowed_hosts then
382
- acl = ["deny", "all"]
383
-
384
- Array(allowed_hosts).each do |host|
385
- acl += ["allow", host]
386
- end
387
-
388
- DRb.install_acl(ACL.new(acl))
389
- end
390
-
391
- @use_drb = true
392
- @drb_service = DRbService.new
393
- did_collision = false
394
- begin
395
- @service = DRb.start_service(uri, @drb_service)
396
- rescue Errno::EADDRINUSE
397
- if ignore_collisions then
398
- nil
399
- else
400
- # The port is already occupied by another
401
- # Breakpoint service. We will try to tell
402
- # the old service that we want its port.
403
- # It will then forward that request to the
404
- # user and retry.
405
- unless did_collision then
406
- DRbObject.new(nil, uri).collision
407
- did_collision = true
408
- end
409
- sleep(10)
410
- retry
411
- end
412
- end
413
-
414
- return true
415
- end
416
-
417
- # Deactivates a running Breakpoint service.
418
- def deactivate_drb
419
- Thread.exclusive do
420
- @service.stop_service unless @service.nil?
421
- @service = nil
422
- @use_drb = false
423
- @drb_service = nil
424
- end
425
- end
426
-
427
- # Returns true when Breakpoints are used over DRb.
428
- # Breakpoint.activate_drb causes this to be true.
429
- def use_drb?
430
- @use_drb == true
431
- end
432
- end
433
-
434
- module IRB # :nodoc:
435
- class << self; remove_method :start; end
436
- def self.start(ap_path = nil, main_context = nil, workspace = nil)
437
- $0 = File::basename(ap_path, ".rb") if ap_path
438
-
439
- # suppress some warnings about redefined constants
440
- old_verbose, $VERBOSE = $VERBOSE, nil
441
- IRB.setup(ap_path)
442
- $VERBOSE = old_verbose
443
-
444
- if @CONF[:SCRIPT] then
445
- irb = Irb.new(main_context, @CONF[:SCRIPT])
446
- else
447
- irb = Irb.new(main_context)
448
- end
449
-
450
- if workspace then
451
- irb.context.workspace = workspace
452
- end
453
-
454
- @CONF[:IRB_RC].call(irb.context) if @CONF[:IRB_RC]
455
- @CONF[:MAIN_CONTEXT] = irb.context
456
-
457
- old_sigint = trap("SIGINT") do
458
- begin
459
- irb.signal_handle
460
- rescue RubyLex::TerminateLineInput
461
- # ignored
462
- end
463
- end
464
-
465
- catch(:IRB_EXIT) do
466
- irb.eval_input
467
- end
468
- ensure
469
- trap("SIGINT", old_sigint)
470
- end
471
-
472
- class << self
473
- alias :old_CurrentContext :CurrentContext
474
- remove_method :CurrentContext
475
- remove_method :parse_opts
476
- end
477
-
478
- def IRB.CurrentContext
479
- if old_CurrentContext.nil? and Breakpoint.use_drb? then
480
- result = Object.new
481
- def result.last_value; end
482
- return result
483
- else
484
- old_CurrentContext
485
- end
486
- end
487
- def IRB.parse_opts() end
488
-
489
- class Context # :nodoc:
490
- alias :old_evaluate :evaluate
491
- def evaluate(line, line_no)
492
- if line.chomp == "exit" then
493
- exit
494
- else
495
- old_evaluate(line, line_no)
496
- end
497
- end
498
- end
499
-
500
- class WorkSpace # :nodoc:
501
- alias :old_evaluate :evaluate
502
-
503
- def evaluate(*args)
504
- if Breakpoint.use_drb? then
505
- result = old_evaluate(*args)
506
- if args[0] != :no_proxy and
507
- not [true, false, nil].include?(result)
508
- then
509
- result.extend(DRbUndumped) rescue nil
510
- end
511
- return result
512
- else
513
- old_evaluate(*args)
514
- end
515
- end
516
- end
517
-
518
- module InputCompletor # :nodoc:
519
- def self.eval(code, context, *more)
520
- # Big hack, this assumes that InputCompletor
521
- # will only call eval() when it wants code
522
- # to be executed in the IRB context.
523
- IRB.conf[:MAIN_CONTEXT].workspace.evaluate(:no_proxy, code, *more)
524
- end
525
- end
526
- end
527
-
528
- module DRb # :nodoc:
529
- class DRbObject # :nodoc:
530
- undef :inspect if method_defined?(:inspect)
531
- undef :clone if method_defined?(:clone)
532
- end
533
- end
534
-
535
- # See Breakpoint.breakpoint
536
- def breakpoint(id = nil, &block)
537
- Binding.of_caller do |context|
538
- Breakpoint.breakpoint(id, context, &block)
539
- end
540
- end
541
-
542
- # See Breakpoint.assert
543
- def assert(&block)
544
- Binding.of_caller do |context|
545
- Breakpoint.assert(context, &block)
546
- end
547
- end