remote_partial 0.4.0 → 0.5.0

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.
@@ -43,7 +43,16 @@ module RemotePartial
43
43
 
44
44
  private
45
45
  def get_whole_page
46
- self.class.get_raw(@url).force_encoding('UTF-8')
46
+ self.class.get_raw(@url).force_encoding(encoding).gsub(windows_bom_text, "")
47
+ end
48
+
49
+ # Windows editors add a BOM to the start of text files, and this needs to be removed
50
+ def windows_bom_text
51
+ "\xEF\xBB\xBF".force_encoding(encoding)
52
+ end
53
+
54
+ def encoding
55
+ "UTF-8"
47
56
  end
48
57
 
49
58
  def get_part_of_page
@@ -1,10 +1,16 @@
1
1
  module RemotePartial
2
- VERSION = "0.4.0"
2
+ VERSION = "0.5.0"
3
3
  end
4
4
 
5
5
  # History
6
6
  # =======
7
7
  #
8
+ # 0.5.0 Improves handling of remote content from Windows system
9
+ # -------------------------------------------------------------
10
+ # Windows editors add a byte order mark (BOM) to the start of text files.
11
+ # To provide consistent behaviour, this is now removed before the partial
12
+ # is created.
13
+ #
8
14
  # 0.4.0 Add facility to modify the partial file before it is saved
9
15
  # ----------------------------------------------------------------
10
16
  # A modification can now be made to the content retrieved from the
@@ -29896,3 +29896,226 @@ stub_request(:get, "http://www.warwickshire.gov.uk/").
29896
29896
  -----------------------------
29897
29897
  RemotePartialTest: test_truth
29898
29898
  -----------------------------
29899
+ Unable to retrieve remote partial at http://www.timeanddate.com/worldclock/city.html?n=136: #<WebMock::NetConnectNotAllowedError: Real HTTP connections are disabled. Unregistered request: GET http://www.timeanddate.com/worldclock/city.html?n=136 with headers {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}
29900
+
29901
+ You can stub this request with the following snippet:
29902
+
29903
+ stub_request(:get, "http://www.timeanddate.com/worldclock/city.html?n=136").
29904
+ with(:headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}).
29905
+ to_return(:status => 200, :body => "", :headers => {})
29906
+
29907
+ ============================================================>
29908
+ Unable to retrieve remote partial at http://www.ruby-lang.org/en/: #<WebMock::NetConnectNotAllowedError: Real HTTP connections are disabled. Unregistered request: GET http://www.ruby-lang.org/en/ with headers {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}
29909
+
29910
+ You can stub this request with the following snippet:
29911
+
29912
+ stub_request(:get, "http://www.ruby-lang.org/en/").
29913
+ with(:headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}).
29914
+ to_return(:status => 200, :body => "", :headers => {})
29915
+
29916
+ ============================================================>
29917
+ -------------------------------
29918
+ DemosControllerTest: test_index
29919
+ -------------------------------
29920
+ Processing by DemosController#index as HTML
29921
+ Rendered demos/index.html.erb within layouts/application (48.7ms)
29922
+ Completed 200 OK in 105ms (Views: 105.2ms)
29923
+ ------------------------------------
29924
+ DemosControllerTest: test_show_fixed
29925
+ ------------------------------------
29926
+ Processing by DemosController#show as HTML
29927
+ Parameters: {"id"=>"fixed"}
29928
+ Rendered remote_partials/_fixed.html.erb (0.3ms)
29929
+ Rendered demos/_fixed.html.erb (11.8ms)
29930
+ Completed 200 OK in 35ms (Views: 35.0ms)
29931
+ -----------------------------------------------------------
29932
+ DemosHelperTest: test_render_remote_partial_with_no_partial
29933
+ -----------------------------------------------------------
29934
+ --------------------------------------
29935
+ RemotePartial::BuilderTest: test_build
29936
+ --------------------------------------
29937
+ ------------------------------------------------------------
29938
+ RemotePartial::BuilderTest: test_build_with_existing_partial
29939
+ ------------------------------------------------------------
29940
+ ------------------------------------------------------------------
29941
+ RemotePartial::BuilderTest: test_build_with_existing_stale_partial
29942
+ ------------------------------------------------------------------
29943
+ ------------------------------------------------------
29944
+ RemotePartial::BuilderTest: test_build_with_http_error
29945
+ ------------------------------------------------------
29946
+ Unable to retrieve remote partial at http://www.warwickshire.gov.uk: #<Net::HTTPBadRequest 400 readbody=true>
29947
+ -------------------------------------------------------------
29948
+ RemotePartial::BuilderTest: test_builder_with_output_modifier
29949
+ -------------------------------------------------------------
29950
+ ---------------------------------------------------------
29951
+ RemotePartial::BuilderTest: test_create_or_update_partial
29952
+ ---------------------------------------------------------
29953
+ -----------------------------------------------------------------------------------
29954
+ RemotePartial::BuilderTest: test_create_or_update_partial_updates_if_partial_exists
29955
+ -----------------------------------------------------------------------------------
29956
+ ----------------------------------------------------------------------------
29957
+ RemotePartial::BuilderTest: test_stale_at_not_modified_if_unable_to_retrieve
29958
+ ----------------------------------------------------------------------------
29959
+ Unable to retrieve remote partial at http://www.warwickshire.gov.uk: #<Net::HTTPBadRequest 400 readbody=true>
29960
+ ----------------------------------------------------------------
29961
+ RemotePartial::ExceptionTest: test_remote_partial_retrival_error
29962
+ ----------------------------------------------------------------
29963
+ -------------------------------------------------
29964
+ RemotePartial::PartialTest: test_output_file_name
29965
+ -------------------------------------------------
29966
+ --------------------------------------------------------
29967
+ RemotePartial::PartialTest: test_stale_at_gets_into_file
29968
+ --------------------------------------------------------
29969
+ --------------------------------------------------------
29970
+ RemotePartial::PartialTest: test_stale_at_gets_into_hash
29971
+ --------------------------------------------------------
29972
+ ------------------------------------------------------------------
29973
+ RemotePartial::PartialTest: test_stale_at_not_updated_unless_stale
29974
+ ------------------------------------------------------------------
29975
+ --------------------------------------------------------
29976
+ RemotePartial::PartialTest: test_stale_at_reset_if_stale
29977
+ --------------------------------------------------------
29978
+ --------------------------------------------
29979
+ RemotePartial::PartialTest: test_update_file
29980
+ --------------------------------------------
29981
+ ------------------------------------------------------------------------
29982
+ RemotePartial::PartialTest: test_update_file_not_affected_by_stale_state
29983
+ ------------------------------------------------------------------------
29984
+ -----------------------------------------------------------------
29985
+ RemotePartial::PartialTest: test_update_file_with_output_modifier
29986
+ -----------------------------------------------------------------
29987
+ ------------------------------------------------
29988
+ RemotePartial::PartialTest: test_update_stale_at
29989
+ ------------------------------------------------
29990
+ --------------------------------------------------
29991
+ RemotePartial::PartialTest: test_update_stale_file
29992
+ --------------------------------------------------
29993
+ -----------------------------------------------------------------
29994
+ RemotePartial::PartialTest: test_update_stale_file_when_not_stale
29995
+ -----------------------------------------------------------------
29996
+ -----------------------------------------------------------
29997
+ RemotePartial::ResourceManagerTest: test_connection_failure
29998
+ -----------------------------------------------------------
29999
+ ------------------------------------------------------------------------------
30000
+ RemotePartial::ResourceManagerTest: test_connection_failure_due_to_invalid_url
30001
+ ------------------------------------------------------------------------------
30002
+ -------------------------------------------------
30003
+ RemotePartial::ResourceManagerTest: test_get_page
30004
+ -------------------------------------------------
30005
+ ------------------------------------------------
30006
+ RemotePartial::ResourceManagerTest: test_get_raw
30007
+ ------------------------------------------------
30008
+ ---------------------------------------------
30009
+ RemotePartial::ResourceManagerTest: test_html
30010
+ ---------------------------------------------
30011
+ --------------------------------------------------------
30012
+ RemotePartial::ResourceManagerTest: test_html_with_limit
30013
+ --------------------------------------------------------
30014
+ --------------------------------------------------------------------------------------
30015
+ RemotePartial::ResourceManagerTest: test_html_with_limit_that_returns_multiple_matches
30016
+ --------------------------------------------------------------------------------------
30017
+ -----------------------------------------------------------
30018
+ RemotePartial::ResourceManagerTest: test_html_with_proc_mod
30019
+ -----------------------------------------------------------
30020
+ --------------------------------------------------
30021
+ RemotePartial::ResourceManagerTest: test_output_to
30022
+ --------------------------------------------------
30023
+ ---------------------------------------------
30024
+ RemotePartial::ResourceManagerTest: test_stub
30025
+ ---------------------------------------------
30026
+ --------------------------------------
30027
+ RemotePartial::YamlStoreTest: test_all
30028
+ --------------------------------------
30029
+ ----------------------------------------------------
30030
+ RemotePartial::YamlStoreTest: test_all_with_no_items
30031
+ ----------------------------------------------------
30032
+ ----------------------------------------
30033
+ RemotePartial::YamlStoreTest: test_count
30034
+ ----------------------------------------
30035
+ -----------------------------------------
30036
+ RemotePartial::YamlStoreTest: test_create
30037
+ -----------------------------------------
30038
+ ---------------------------------------------
30039
+ RemotePartial::YamlStoreTest: test_created_at
30040
+ ---------------------------------------------
30041
+ -------------------------------------------------------------------
30042
+ RemotePartial::YamlStoreTest: test_created_at_not_updated_if_exists
30043
+ -------------------------------------------------------------------
30044
+ ------------------------------------------
30045
+ RemotePartial::YamlStoreTest: test_db_path
30046
+ ------------------------------------------
30047
+ --------------------------------------
30048
+ RemotePartial::YamlStoreTest: test_dir
30049
+ --------------------------------------
30050
+ ---------------------------------------
30051
+ RemotePartial::YamlStoreTest: test_file
30052
+ ---------------------------------------
30053
+ ---------------------------------------
30054
+ RemotePartial::YamlStoreTest: test_find
30055
+ ---------------------------------------
30056
+ -------------------------------------------------------
30057
+ RemotePartial::YamlStoreTest: test_find_when_none_exist
30058
+ -------------------------------------------------------
30059
+ ---------------------------------------------------
30060
+ RemotePartial::YamlStoreTest: test_find_with_symbol
30061
+ ---------------------------------------------------
30062
+ -----------------------------------------
30063
+ RemotePartial::YamlStoreTest: test_merge!
30064
+ -----------------------------------------
30065
+ --------------------------------------
30066
+ RemotePartial::YamlStoreTest: test_new
30067
+ --------------------------------------
30068
+ ---------------------------------------
30069
+ RemotePartial::YamlStoreTest: test_read
30070
+ ---------------------------------------
30071
+ -----------------------------------------------------------
30072
+ RemotePartial::YamlStoreTest: test_read_when_no_file_exists
30073
+ -----------------------------------------------------------
30074
+ ---------------------------------------
30075
+ RemotePartial::YamlStoreTest: test_root
30076
+ ---------------------------------------
30077
+ ---------------------------------------
30078
+ RemotePartial::YamlStoreTest: test_save
30079
+ ---------------------------------------
30080
+ ------------------------------------------------------
30081
+ RemotePartial::YamlStoreTest: test_save_without_a_name
30082
+ ------------------------------------------------------
30083
+ ----------------------------------------------
30084
+ RemotePartial::YamlStoreTest: test_string_keys
30085
+ ----------------------------------------------
30086
+ ---------------------------------------------
30087
+ RemotePartial::YamlStoreTest: test_updated_at
30088
+ ---------------------------------------------
30089
+ ------------------------------------------------------------------
30090
+ RemotePartial::YamlStoreTest: test_updated_at_if_updated_if_exists
30091
+ ------------------------------------------------------------------
30092
+ ----------------------------------------
30093
+ RemotePartial::YamlStoreTest: test_write
30094
+ ----------------------------------------
30095
+ ------------------------------
30096
+ RemotePartialTest: test_define
30097
+ ------------------------------
30098
+ Unable to retrieve remote partial at http://www.warwickshire.gov.uk: #<WebMock::NetConnectNotAllowedError: Real HTTP connections are disabled. Unregistered request: GET http://www.warwickshire.gov.uk/ with headers {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}
30099
+
30100
+ You can stub this request with the following snippet:
30101
+
30102
+ stub_request(:get, "http://www.warwickshire.gov.uk/").
30103
+ with(:headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}).
30104
+ to_return(:status => 200, :body => "", :headers => {})
30105
+
30106
+ ============================================================>
30107
+ -----------------------------------------------
30108
+ RemotePartialTest: test_define_with_string_keys
30109
+ -----------------------------------------------
30110
+ Unable to retrieve remote partial at http://www.warwickshire.gov.uk: #<WebMock::NetConnectNotAllowedError: Real HTTP connections are disabled. Unregistered request: GET http://www.warwickshire.gov.uk/ with headers {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}
30111
+
30112
+ You can stub this request with the following snippet:
30113
+
30114
+ stub_request(:get, "http://www.warwickshire.gov.uk/").
30115
+ with(:headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}).
30116
+ to_return(:status => 200, :body => "", :headers => {})
30117
+
30118
+ ============================================================>
30119
+ -----------------------------
30120
+ RemotePartialTest: test_truth
30121
+ -----------------------------
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remote_partial
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-19 00:00:00.000000000 Z
12
+ date: 2013-07-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails