geohydra 0.3.1 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (194) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +2 -1
  3. data/.travis.yml +1 -2
  4. data/Gemfile +1 -8
  5. data/Gemfile.lock +87 -102
  6. data/README.md +2 -2
  7. data/VERSION +1 -1
  8. data/bin/accession.rb +99 -89
  9. data/bin/assemble.rb +288 -247
  10. data/bin/assemble_data.rb +54 -51
  11. data/bin/assemble_placenames.rb +85 -85
  12. data/bin/build_stage_options.rb +24 -18
  13. data/bin/derive_wgs84.rb +65 -66
  14. data/bin/extract_thumbnail.rb +38 -37
  15. data/bin/geo2mods.rb +78 -0
  16. data/bin/geohydra +14 -5
  17. data/bin/ingest_arcgis.rb +80 -60
  18. data/bin/iso2geo.rb +64 -0
  19. data/bin/loader_postgis.rb +121 -227
  20. data/bin/run_task.rb +23 -0
  21. data/bin/sync_geoserver_metadata.rb +132 -127
  22. data/bin/xsltproc-saxon +6 -0
  23. data/geohydra.gemspec +6 -4
  24. data/lib/geohydra.rb +5 -0
  25. data/lib/geohydra/accession.rb +24 -13
  26. data/lib/geohydra/{arcgis_to_iso19139_fc.xsl → arcgis_to_iso19110.xsl} +0 -0
  27. data/lib/geohydra/gazetteer.csv +842 -36
  28. data/lib/geohydra/gazetteer.rb +48 -24
  29. data/lib/geohydra/mods2geoblacklight.xsl +248 -0
  30. data/lib/geohydra/mods2ogp.xsl +5 -8
  31. data/lib/geohydra/transform.rb +8 -2
  32. data/lib/geohydra/utils.rb +6 -0
  33. data/lib/geohydra/workflow/gisAssemblyWF.rb +109 -0
  34. data/lib/geohydra/workflow/gisAssemblyWF.xml +85 -0
  35. data/lib/geohydra/workflow/gisDeliveryWF.rb +33 -0
  36. data/lib/geohydra/workflow/gisDeliveryWF.xml +36 -0
  37. data/lib/geohydra/workflow/gisDiscoveryWF.rb +55 -0
  38. data/lib/geohydra/workflow/gisDiscoveryWF.xml +28 -0
  39. data/lib/geohydra/workflow/task.rb +82 -0
  40. data/ogp/README.md +350 -0
  41. data/ogp/download.rb +92 -0
  42. data/ogp/fgdc2mods.sh +9 -0
  43. data/ogp/fgdc2mods.xsl +884 -0
  44. data/ogp/ingest.rb +48 -0
  45. data/ogp/select.rb +20 -0
  46. data/ogp/transform.rb +354 -0
  47. data/ogp/validate.rb +182 -0
  48. data/{bin → scripts}/ingest_tufts.rb +0 -0
  49. data/scripts/iso2html/doit.sh +15 -0
  50. data/scripts/iso2html/main.css +66 -0
  51. data/scripts/iso2html/pacioos-iso-html.xsl +1749 -0
  52. data/scripts/iso2html/utils/replace-newlines.xsl +97 -0
  53. data/scripts/iso2html/utils/replace-string.xsl +80 -0
  54. data/scripts/iso2html/utils/strip-digits.xsl +60 -0
  55. data/{bin → scripts}/loader.rb +0 -0
  56. data/scripts/rename_shapefiles.rb +5 -0
  57. data/scripts/render_gazetteer.rb +36 -0
  58. data/{bin → scripts}/seed.rb +0 -0
  59. data/{bin → scripts}/solr_indexer.rb +0 -0
  60. data/scripts/status.csv +253 -0
  61. data/scripts/status.rb +32 -0
  62. data/{bin → scripts}/validate_data.rb +1 -1
  63. data/solr/kurma-app-dev/conf/lang/stopwords_en.txt +34 -0
  64. data/solr/kurma-app-dev/conf/protwords.txt +21 -0
  65. data/solr/kurma-app-dev/conf/schema.xml +156 -0
  66. data/solr/kurma-app-dev/conf/solrconfig.xml +161 -0
  67. data/solr/kurma-app-dev/conf/synonyms.txt +29 -0
  68. data/solr/kurma-app-dev/purge.sh +8 -0
  69. data/solr/kurma-app-test/conf/lang/stopwords_en.txt +34 -0
  70. data/solr/kurma-app-test/conf/protwords.txt +21 -0
  71. data/solr/kurma-app-test/conf/schema.xml +158 -0
  72. data/solr/kurma-app-test/conf/solrconfig.xml +161 -0
  73. data/solr/kurma-app-test/conf/synonyms.txt +29 -0
  74. data/solr/kurma-app-test/deploy.sh +15 -0
  75. data/solr/kurma-app-test/purge.sh +8 -0
  76. data/solr/ogp-dev/purge.sh +1 -2
  77. data/spec/fixtures/bw938nk9584/temp/{TRIPURA-iso19139-fc.xml → TRIPURA-iso19110.xml} +0 -0
  78. data/spec/fixtures/cc142xj8436/temp/{HARYANA-iso19139-fc.xml → HARYANA-iso19110.xml} +0 -0
  79. data/spec/fixtures/cg716wc7949/temp/{metadata.iso19139-fc.xml → metadata.iso19110.xml} +0 -0
  80. data/spec/fixtures/cm007pv9601/temp/{MEGHALAYA-iso19139-fc.xml → MEGHALAYA-iso19110.xml} +0 -0
  81. data/spec/fixtures/cp055nb0189/temp/{metadata.iso19139-fc.xml → metadata.iso19110.xml} +0 -0
  82. data/spec/fixtures/cs838pw3418/temp/{OIL_GAS_FIELDS-iso19139-fc.xml → OIL_GAS_FIELDS-iso19110.xml} +0 -0
  83. data/spec/fixtures/dd308sy5843/temp/{ORISSA-iso19139-fc.xml → ORISSA-iso19110.xml} +0 -0
  84. data/spec/fixtures/dd452vk1873/temp/{metadata.iso19139-fc.xml → metadata.iso19110.xml} +0 -0
  85. data/spec/fixtures/dg850pt1796/temp/{STATE1951-iso19139-fc.xml → STATE1951-iso19110.xml} +0 -0
  86. data/spec/fixtures/dn744tf5427/temp/{DISTRICT1991-iso19139-fc.xml → DISTRICT1991-iso19110.xml} +0 -0
  87. data/spec/fixtures/dq603nz8402/temp/{STATE2001-iso19139-fc.xml → STATE2001-iso19110.xml} +0 -0
  88. data/spec/fixtures/dv609zt4699/temp/{ASSAM-iso19139-fc.xml → ASSAM-iso19110.xml} +0 -0
  89. data/spec/fixtures/dz222hw0585/temp/{PUNJAB-iso19139-fc.xml → PUNJAB-iso19110.xml} +0 -0
  90. data/spec/fixtures/fd673qb9705/temp/{STATE1971-iso19139-fc.xml → STATE1971-iso19110.xml} +0 -0
  91. data/spec/fixtures/fg451wp8917/temp/{SIKKIM-iso19139-fc.xml → SIKKIM-iso19110.xml} +0 -0
  92. data/spec/fixtures/fh247yz0156/temp/{RAJASTHAN-iso19139-fc.xml → RAJASTHAN-iso19110.xml} +0 -0
  93. data/spec/fixtures/fs487vd1465/temp/{CHHATTISGARH-iso19139-fc.xml → CHHATTISGARH-iso19110.xml} +0 -0
  94. data/spec/fixtures/fs591bn3317/temp/{HIMACHAL_PRADESH-iso19139-fc.xml → HIMACHAL_PRADESH-iso19110.xml} +0 -0
  95. data/spec/fixtures/fw920bc5473/temp/{PLSS_TWN-iso19139-fc.xml → PLSS_TWN-iso19110.xml} +0 -0
  96. data/spec/fixtures/gj831wj3625/temp/{metadata.iso19139-fc.xml → metadata.iso19110.xml} +0 -0
  97. data/spec/fixtures/gp075nv3265/temp/{PONDICHERRY-iso19139-fc.xml → PONDICHERRY-iso19110.xml} +0 -0
  98. data/spec/fixtures/gv800hj8141/temp/{BIHAR-iso19139-fc.xml → BIHAR-iso19110.xml} +0 -0
  99. data/spec/fixtures/gw520gz6339/temp/{DADRA_NAGAR_HAVELI_PT-iso19139-fc.xml → DADRA_NAGAR_HAVELI_PT-iso19110.xml} +0 -0
  100. data/spec/fixtures/gy054hz1045/temp/{HARYANA-iso19139-fc.xml → HARYANA-iso19110.xml} +0 -0
  101. data/spec/fixtures/gz352mw6982/temp/{metadata.iso19139-fc.xml → metadata.iso19110.xml} +0 -0
  102. data/spec/fixtures/hb489vm9892/temp/{DISTRICT1981-iso19139-fc.xml → DISTRICT1981-iso19110.xml} +0 -0
  103. data/spec/fixtures/hw125dq0418/temp/{DELHI-iso19139-fc.xml → DELHI-iso19110.xml} +0 -0
  104. data/spec/fixtures/hw892mn4587/temp/{KERALA-iso19139-fc.xml → KERALA-iso19110.xml} +0 -0
  105. data/spec/fixtures/jb371hz3868/temp/{INCOME-iso19139-fc.xml → INCOME-iso19110.xml} +0 -0
  106. data/spec/fixtures/jc017yk9928/temp/{KARNATAKA-iso19139-fc.xml → KARNATAKA-iso19110.xml} +0 -0
  107. data/spec/fixtures/jf841ys4828/temp/{ANDHRA_PRADESH-iso19139-fc.xml → ANDHRA_PRADESH-iso19110.xml} +0 -0
  108. data/spec/fixtures/jh802mp2160/temp/{DELHI_PT-iso19139-fc.xml → DELHI_PT-iso19110.xml} +0 -0
  109. data/spec/fixtures/jj806fc3801/temp/{metadata.iso19139-fc.xml → metadata.iso19110.xml} +0 -0
  110. data/spec/fixtures/jq835yn7161/temp/{HIMACHAL_PRADESH-iso19139-fc.xml → HIMACHAL_PRADESH-iso19110.xml} +0 -0
  111. data/spec/fixtures/jr455pt6676/temp/{TAMILNADU-iso19139-fc.xml → TAMILNADU-iso19110.xml} +0 -0
  112. data/spec/fixtures/js637zp2537/temp/{BIHAR-iso19139-fc.xml → BIHAR-iso19110.xml} +0 -0
  113. data/spec/fixtures/jv502wg9611/temp/{GOA-iso19139-fc.xml → GOA-iso19110.xml} +0 -0
  114. data/spec/fixtures/jw462ck6560/temp/{JAMMU_KASHMIR-iso19139-fc.xml → JAMMU_KASHMIR-iso19110.xml} +0 -0
  115. data/spec/fixtures/kj800fb6273/temp/{STATE2011-iso19139-fc.xml → STATE2011-iso19110.xml} +0 -0
  116. data/spec/fixtures/km504zq3948/temp/{HIMACHAL_PRADESH-iso19139-fc.xml → HIMACHAL_PRADESH-iso19110.xml} +0 -0
  117. data/spec/fixtures/ks297fy1411/temp/{OFFSH_BLOCKS-iso19139-fc.xml → OFFSH_BLOCKS-iso19110.xml} +0 -0
  118. data/spec/fixtures/md358hy5049/temp/{MIZORAM-iso19139-fc.xml → MIZORAM-iso19110.xml} +0 -0
  119. data/spec/fixtures/mg745bq0193/temp/{MADHYA_PRADESH-iso19139-fc.xml → MADHYA_PRADESH-iso19110.xml} +0 -0
  120. data/spec/fixtures/mh187yx3536/temp/{WEST_BENGAL-iso19139-fc.xml → WEST_BENGAL-iso19110.xml} +0 -0
  121. data/spec/fixtures/mk488yn6694/temp/{GUJARAT-iso19139-fc.xml → GUJARAT-iso19110.xml} +0 -0
  122. data/spec/fixtures/my216kp3008/temp/{DELHI-iso19139-fc.xml → DELHI-iso19110.xml} +0 -0
  123. data/spec/fixtures/my504nz9827/temp/{JAMMU_KASHMIR-iso19139-fc.xml → JAMMU_KASHMIR-iso19110.xml} +0 -0
  124. data/spec/fixtures/ng819jm8700/temp/{MANIPUR-iso19139-fc.xml → MANIPUR-iso19110.xml} +0 -0
  125. data/spec/fixtures/np020jq2139/temp/{metadata.iso19139-fc.xml → metadata.iso19110.xml} +0 -0
  126. data/spec/fixtures/ns377mt1608/temp/{STATE1991-iso19139-fc.xml → STATE1991-iso19110.xml} +0 -0
  127. data/spec/fixtures/nw926np8508/temp/{metadata.iso19139-fc.xml → metadata.iso19110.xml} +0 -0
  128. data/spec/fixtures/ny358rm8559/temp/{TRIPURA-iso19139-fc.xml → TRIPURA-iso19110.xml} +0 -0
  129. data/spec/fixtures/nz176rm8192/temp/{DISTRICT2011-iso19139-fc.xml → DISTRICT2011-iso19110.xml} +0 -0
  130. data/spec/fixtures/nz252rq2252/temp/{UTTAR_PRADESH-iso19139-fc.xml → UTTAR_PRADESH-iso19110.xml} +0 -0
  131. data/spec/fixtures/pd902kb3348/temp/{MADHYA_PRADESH-iso19139-fc.xml → MADHYA_PRADESH-iso19110.xml} +0 -0
  132. data/spec/fixtures/pz792fz1776/temp/{MAHARASHTRA-iso19139-fc.xml → MAHARASHTRA-iso19110.xml} +0 -0
  133. data/spec/fixtures/qb767ss4042/temp/{UTTAR_PRADESH-iso19139-fc.xml → UTTAR_PRADESH-iso19110.xml} +0 -0
  134. data/spec/fixtures/qc091qw0570/temp/{GUJARAT-iso19139-fc.xml → GUJARAT-iso19110.xml} +0 -0
  135. data/spec/fixtures/qc652vr7204/temp/{ANDHRA_PRADESH_PT-iso19139-fc.xml → ANDHRA_PRADESH_PT-iso19110.xml} +0 -0
  136. data/spec/fixtures/qk786js7484/temp/{DISTRICT1961-iso19139-fc.xml → DISTRICT1961-iso19110.xml} +0 -0
  137. data/spec/fixtures/qn676pg6767/temp/{GOA-iso19139-fc.xml → GOA-iso19110.xml} +0 -0
  138. data/spec/fixtures/qr255jh4074/temp/{LOKSABHA_14-iso19139-fc.xml → LOKSABHA_14-iso19110.xml} +0 -0
  139. data/spec/fixtures/qr374kj4827/temp/{ASSAM-iso19139-fc.xml → ASSAM-iso19110.xml} +0 -0
  140. data/spec/fixtures/qy162js1748/temp/{CHHATTISGARH-iso19139-fc.xml → CHHATTISGARH-iso19110.xml} +0 -0
  141. data/spec/fixtures/rd446vf2633/temp/{NAGALAND-iso19139-fc.xml → NAGALAND-iso19110.xml} +0 -0
  142. data/spec/fixtures/rf389hf2983/temp/{CHHATTISGARH_PT-iso19139-fc.xml → CHHATTISGARH_PT-iso19110.xml} +0 -0
  143. data/spec/fixtures/rf859ff4582/temp/{JHARKHAND-iso19139-fc.xml → JHARKHAND-iso19110.xml} +0 -0
  144. data/spec/fixtures/rh343ds8931/temp/{BIHAR-iso19139-fc.xml → BIHAR-iso19110.xml} +0 -0
  145. data/spec/fixtures/rn815xk8157/temp/{SIKKIM-iso19139-fc.xml → SIKKIM-iso19110.xml} +0 -0
  146. data/spec/fixtures/rq653sz4470/temp/{CHHATTISGARH-iso19139-fc.xml → CHHATTISGARH-iso19110.xml} +0 -0
  147. data/spec/fixtures/rt625ws6022/temp/{GULF_FAIRWAYS-iso19139-fc.xml → GULF_FAIRWAYS-iso19110.xml} +0 -0
  148. data/spec/fixtures/sc330vf4259/temp/{JHARKHAND-iso19139-fc.xml → JHARKHAND-iso19110.xml} +0 -0
  149. data/spec/fixtures/sq479mx3086/temp/{OFFSH_PLATF-iso19139-fc.xml → OFFSH_PLATF-iso19110.xml} +0 -0
  150. data/spec/fixtures/sr686bm4098/temp/{DAMAN_DIU_PT-iso19139-fc.xml → DAMAN_DIU_PT-iso19110.xml} +0 -0
  151. data/spec/fixtures/sv303sh5583/temp/{ARUNACHAL_PRADESH-iso19139-fc.xml → ARUNACHAL_PRADESH-iso19110.xml} +0 -0
  152. data/spec/fixtures/sy319nh8520/temp/{GUJARAT-iso19139-fc.xml → GUJARAT-iso19110.xml} +0 -0
  153. data/spec/fixtures/td363vx2792/temp/{HIMACHAL_PRADESH_PT-iso19139-fc.xml → HIMACHAL_PRADESH_PT-iso19110.xml} +0 -0
  154. data/spec/fixtures/tf374bd2484/temp/{DISTRICT1951-iso19139-fc.xml → DISTRICT1951-iso19110.xml} +0 -0
  155. data/spec/fixtures/tj797mj7877/temp/{LOKSABHA_15-iso19139-fc.xml → LOKSABHA_15-iso19110.xml} +0 -0
  156. data/spec/fixtures/tv060wq5179/temp/{ASSAM-iso19139-fc.xml → ASSAM-iso19110.xml} +0 -0
  157. data/spec/fixtures/tv536bn1915/temp/{ARUNACHAL_PRADESH-iso19139-fc.xml → ARUNACHAL_PRADESH-iso19110.xml} +0 -0
  158. data/spec/fixtures/tz359cc2977/temp/{MANIPUR-iso19139-fc.xml → MANIPUR-iso19110.xml} +0 -0
  159. data/spec/fixtures/vb525my6511/temp/{UTTARAKHAND-iso19139-fc.xml → UTTARAKHAND-iso19110.xml} +0 -0
  160. data/spec/fixtures/vh802fs4240/temp/{PONDICHERRY-iso19139-fc.xml → PONDICHERRY-iso19110.xml} +0 -0
  161. data/spec/fixtures/vk120xn2474/temp/{PLSS_SEC-iso19139-fc.xml → PLSS_SEC-iso19110.xml} +0 -0
  162. data/spec/fixtures/vn439bc7316/temp/{KERALA-iso19139-fc.xml → KERALA-iso19110.xml} +0 -0
  163. data/spec/fixtures/vq745jk0695/temp/{MEGHALAYA-iso19139-fc.xml → MEGHALAYA-iso19110.xml} +0 -0
  164. data/spec/fixtures/vr593vj7147/temp/{ANDHRA_PRADESH-iso19139-fc.xml → ANDHRA_PRADESH-iso19110.xml} +0 -0
  165. data/spec/fixtures/vw911qb5271/temp/{DISTRICT2001-iso19139-fc.xml → DISTRICT2001-iso19110.xml} +0 -0
  166. data/spec/fixtures/wg680pz0365/temp/{ANDHRA_PRADESH-iso19139-fc.xml → ANDHRA_PRADESH-iso19110.xml} +0 -0
  167. data/spec/fixtures/wg761xn1926/temp/{HARYANA-iso19139-fc.xml → HARYANA-iso19110.xml} +0 -0
  168. data/spec/fixtures/wh870qw1934/temp/{PUNJAB-iso19139-fc.xml → PUNJAB-iso19110.xml} +0 -0
  169. data/spec/fixtures/wk775mm4673/temp/{MAHARASHTRA-iso19139-fc.xml → MAHARASHTRA-iso19110.xml} +0 -0
  170. data/spec/fixtures/ws171yz2165/temp/{ARUNACHAL_PRADESH_PT-iso19139-fc.xml → ARUNACHAL_PRADESH_PT-iso19110.xml} +0 -0
  171. data/spec/fixtures/wt473hz7153/temp/{CHANDIGARH_PT-iso19139-fc.xml → CHANDIGARH_PT-iso19110.xml} +0 -0
  172. data/spec/fixtures/ww217dj0457/temp/{CO2_PIPE-iso19139-fc.xml → CO2_PIPE-iso19110.xml} +0 -0
  173. data/spec/fixtures/wy875pk9849/temp/{STATE1961-iso19139-fc.xml → STATE1961-iso19110.xml} +0 -0
  174. data/spec/fixtures/xb018tk2042/temp/{STATE1981-iso19139-fc.xml → STATE1981-iso19110.xml} +0 -0
  175. data/spec/fixtures/xg539vw8586/temp/{ORISSA-iso19139-fc.xml → ORISSA-iso19110.xml} +0 -0
  176. data/spec/fixtures/xv475kp4644/temp/{ASSAM_PT-iso19139-fc.xml → ASSAM_PT-iso19110.xml} +0 -0
  177. data/spec/fixtures/xy096gc2959/temp/{GOA-iso19139-fc.xml → GOA-iso19110.xml} +0 -0
  178. data/spec/fixtures/xz518gz3362/temp/{UTTARAKHAND-iso19139-fc.xml → UTTARAKHAND-iso19110.xml} +0 -0
  179. data/spec/fixtures/yh986wy4737/temp/{NAGALAND-iso19139-fc.xml → NAGALAND-iso19110.xml} +0 -0
  180. data/spec/fixtures/yn187fq4474/temp/{KARNATAKA-iso19139-fc.xml → KARNATAKA-iso19110.xml} +0 -0
  181. data/spec/fixtures/yn236mw3250/temp/{TAMILNADU-iso19139-fc.xml → TAMILNADU-iso19110.xml} +0 -0
  182. data/spec/fixtures/yz596nz0112/temp/{WEST_BENGAL-iso19139-fc.xml → WEST_BENGAL-iso19110.xml} +0 -0
  183. data/spec/fixtures/zk596gy7380/temp/{DISTRICT1971-iso19139-fc.xml → DISTRICT1971-iso19110.xml} +0 -0
  184. data/spec/fixtures/zn452hh7431/temp/{RAJASTHAN-iso19139-fc.xml → RAJASTHAN-iso19110.xml} +0 -0
  185. data/spec/fixtures/zt093fw6519/temp/{MIZORAM-iso19139-fc.xml → MIZORAM-iso19110.xml} +0 -0
  186. data/spec/fixtures/zv925hd6723/temp/{OGWELLS-iso19139-fc.xml → OGWELLS-iso19110.xml} +0 -0
  187. data/spec/fixtures/zy658cr1728/temp/{ANDAMAAN_NICOBAR_PT-iso19139-fc.xml → ANDAMAAN_NICOBAR_PT-iso19110.xml} +0 -0
  188. data/spec/fixtures/zz943vx1492/temp/{BASINS-iso19139-fc.xml → BASINS-iso19110.xml} +0 -0
  189. data/spec/unit/gazetteer_spec.rb +100 -35
  190. data/spec/unit/task_spec.rb +68 -0
  191. data/spec/unit/transform_spec.rb +1 -1
  192. data/spec/unit/utils_spec.rb +17 -3
  193. data/workflow.rb +35 -0
  194. metadata +323 -316
@@ -5,303 +5,344 @@ require 'druid-tools'
5
5
  require 'optparse'
6
6
  require 'json'
7
7
 
8
- def setup_druid(obj, flags)
9
- druid = DruidTools::Druid.new(obj.druid, flags[:workspacedir])
10
- raise ArgumentError unless DruidTools::Druid.valid?(druid.druid)
11
- %w{path content_dir metadata_dir temp_dir}.each do |k|
12
- d = druid.send(k.to_sym)
13
- unless File.directory? d
14
- $stderr.puts "Creating directory #{d}" if flags[:verbose]
15
- FileUtils.mkdir_p d
8
+ class Assemble < GeoHydra::Process
9
+ def setup_druid(obj, flags)
10
+ druid = DruidTools::Druid.new(obj.druid, flags[:workspacedir])
11
+ raise ArgumentError unless DruidTools::Druid.valid?(druid.druid)
12
+ %w{path content_dir metadata_dir temp_dir}.each do |k|
13
+ d = druid.send(k.to_sym)
14
+ unless File.directory? d
15
+ $stderr.puts "Creating directory #{d}" if flags[:verbose]
16
+ FileUtils.mkdir_p d
17
+ end
16
18
  end
19
+ druid
17
20
  end
18
- druid
19
- end
20
21
 
21
- def find_mef(druid, uuid, flags)
22
- # export MEF -- the .iso19139.xml file is preferred
23
- puts "Exporting MEF for #{uuid}" if flags[:verbose]
24
- client.export(uuid, flags[:tmpdir])
25
- system(['unzip',
26
- '-oq',
27
- "'#{flags[:tmpdir]}/#{uuid}.mef'",
28
- '-d',
29
- "'#{flags[:tmpdir]}'"].join(' '))
30
- found_metadata = false
31
- %w{metadata.iso19139.xml metadata.xml}.each do |fn| # priority order as per MEF
32
- unless found_metadata
33
- fn = File.join(flags[:tmpdir], uuid, 'metadata', fn)
34
- next unless File.exist? fn
22
+ def find_mef(druid, uuid, flags)
23
+ # export MEF -- the .iso19139.xml file is preferred
24
+ puts "Exporting MEF for #{uuid}" if flags[:verbose]
25
+ client.export(uuid, flags[:tmpdir])
26
+ system(['unzip',
27
+ '-oq',
28
+ "'#{flags[:tmpdir]}/#{uuid}.mef'",
29
+ '-d',
30
+ "'#{flags[:tmpdir]}'"].join(' '))
31
+ found_metadata = false
32
+ %w{metadata.iso19139.xml metadata.xml}.each do |fn| # priority order as per MEF
33
+ unless found_metadata
34
+ fn = File.join(flags[:tmpdir], uuid, 'metadata', fn)
35
+ next unless File.exist? fn
35
36
 
36
- found_metadata = true
37
- # original ISO 19139
38
- ifn = File.join(druid.temp_dir, 'iso19139.xml')
39
- FileUtils.link fn, ifn, :verbose => flags[:verbose], :force => true
37
+ found_metadata = true
38
+ # original ISO 19139
39
+ ifn = File.join(druid.temp_dir, 'iso19139.xml')
40
+ FileUtils.link fn, ifn, :verbose => flags[:verbose], :force => true
41
+ end
40
42
  end
43
+ ifn
41
44
  end
42
- ifn
43
- end
44
45
 
45
- def find_local(druid, xml, fcXml, flags)
46
- ifn = File.join(druid.temp_dir, 'iso19139.xml')
47
- unless File.exist?(ifn)
48
- File.open(ifn, "w") {|f| f << xml.to_s}
49
- end
46
+ def find_local(druid, xml, fcXml, flags)
47
+ ifn = File.join(druid.temp_dir, 'iso19139.xml')
48
+ unless File.exist?(ifn)
49
+ File.open(ifn, "w") {|f| f << xml.to_s}
50
+ end
50
51
 
51
- fcfn = File.join(druid.temp_dir, 'iso19139-fc.xml')
52
- unless File.exist?(fcfn)
53
- File.open(fcfn, "w") {|f| f << fcXml.to_s}
54
- end
52
+ fcfn = File.join(druid.temp_dir, 'iso19110.xml')
53
+ unless File.exist?(fcfn)
54
+ File.open(fcfn, "w") {|f| f << fcXml.to_s}
55
+ end
55
56
 
56
- [ifn, fcfn]
57
- end
57
+ [ifn, fcfn]
58
+ end
58
59
 
59
- def convert_iso2geo(druid, ifn, isoXml, fcXml, flags)
60
- isoXml = Nokogiri::XML(isoXml)
61
- if isoXml.nil? or isoXml.root.nil?
62
- raise ArgumentError, "Empty ISO 19139"
60
+ def convert_iso2geo(druid, ifn, isoXml, fcXml, flags)
61
+ isoXml = Nokogiri::XML(isoXml)
62
+ if isoXml.nil? or isoXml.root.nil?
63
+ raise ArgumentError, "Empty ISO 19139"
64
+ end
65
+ fcXml = Nokogiri::XML(fcXml)
66
+ ap({:ifn => ifn, :isoXml => isoXml, :fcXml => fcXml, :flags => flags}) if flags[:debug]
67
+ # GeoMetadataDS
68
+ gfn = File.join(druid.metadata_dir, 'geoMetadata.xml')
69
+ puts "Generating #{gfn}" if flags[:verbose]
70
+ xml = GeoHydra::Transform.to_geoMetadataDS(isoXml, fcXml, { 'purl' => "#{flags[:purl]}/#{druid.id}"})
71
+ File.open(gfn, 'w') {|f| f << xml.to_xml(:indent => 2) }
72
+ gfn
63
73
  end
64
- fcXml = Nokogiri::XML(fcXml)
65
- ap({:ifn => ifn, :isoXml => isoXml, :fcXml => fcXml, :flags => flags}) if flags[:debug]
66
- # GeoMetadataDS
67
- gfn = File.join(druid.metadata_dir, 'geoMetadata.xml')
68
- puts "Generating #{gfn}" if flags[:verbose]
69
- xml = GeoHydra::Transform.to_geoMetadataDS(isoXml, fcXml, { 'purl' => "#{flags[:purl]}/#{druid.id}"})
70
- File.open(gfn, 'w') {|f| f << xml.to_xml(:indent => 2) }
71
- gfn
72
- end
73
74
 
74
- def convert_geo2mods(druid, geoMetadata, flags)
75
- # MODS from GeoMetadataDS
76
- ap({:geoMetadata => geoMetadata.ng_xml}) if flags[:debug]
77
- dfn = File.join(druid.metadata_dir, 'descMetadata.xml')
78
- puts "Generating #{dfn}" if flags[:verbose]
79
- File.open(dfn, 'w') { |f| f << geoMetadata.to_mods.to_xml(:index => 2) }
80
- dfn
81
- end
75
+ def convert_geo2mods(druid, geoMetadata, flags)
76
+ # MODS from GeoMetadataDS
77
+ ap({:geoMetadata => geoMetadata.ng_xml}) if flags[:debug]
78
+ dfn = File.join(druid.metadata_dir, 'descMetadata.xml')
79
+ puts "Generating #{dfn}" if flags[:verbose]
80
+ File.open(dfn, 'w') { |f| f << geoMetadata.to_mods.to_xml(:index => 2) }
81
+ dfn
82
+ end
82
83
 
83
- def convert_geo2solrspatial(druid, geoMetadata, flags)
84
- # Solr document from GeoMetadataDS
85
- sfn = File.join(druid.temp_dir, 'spatialSolr.xml')
86
- puts "Generating #{sfn}" if flags[:verbose]
87
- h = geoMetadata.to_solr_spatial
88
- ap({:to_solr_spatial => h}) if flags[:debug]
84
+ def convert_geo2solrspatial(druid, geoMetadata, flags)
85
+ # Solr document from GeoMetadataDS
86
+ sfn = File.join(druid.temp_dir, 'spatialSolr.xml')
87
+ puts "Generating #{sfn}" if flags[:verbose]
88
+ h = geoMetadata.to_solr_spatial
89
+ ap({:to_solr_spatial => h}) if flags[:debug]
89
90
 
90
- doc = Nokogiri::XML::Builder.new do |xml|
91
- xml.add {
92
- xml.doc_ {
93
- h.each do |k, v|
94
- v.each do |s|
95
- xml.field s, :name => k
96
- end unless v.nil?
97
- end unless h.nil?
91
+ doc = Nokogiri::XML::Builder.new do |xml|
92
+ xml.add {
93
+ xml.doc_ {
94
+ h.each do |k, v|
95
+ v.each do |s|
96
+ xml.field s, :name => k
97
+ end unless v.nil?
98
+ end unless h.nil?
99
+ }
98
100
  }
99
- }
101
+ end
102
+ File.open(sfn, 'w') { |f| f << doc.to_xml(:indent => 2) }
103
+ sfn
100
104
  end
101
- File.open(sfn, 'w') { |f| f << doc.to_xml(:indent => 2) }
102
- sfn
103
- end
104
105
 
105
- def convert_mods2ogpsolr(druid, dfn, flags)
106
- raise ArgumentError, 'Missing required :geoserver flag' if flags[:geoserver].nil?
107
- raise ArgumentError, 'Missing required :purl flag' if flags[:purl].nil?
106
+ def convert_mods2geoblacklight(druid, dfn, flags)
107
+ raise ArgumentError, 'Missing required :geoserver flag' if flags[:geoserver].nil?
108
+ raise ArgumentError, 'Missing required :purl flag' if flags[:purl].nil?
108
109
 
109
- geoserver = flags[:geoserver]
110
- purl = "#{flags[:purl]}/#{druid.id}"
110
+ geoserver = flags[:geoserver]
111
+ purl = "#{flags[:purl]}/#{druid.id}"
111
112
 
112
- # OGP Solr document from GeoMetadataDS
113
- sfn = File.join(druid.temp_dir, 'ogpSolr.xml')
114
- FileUtils.rm_f(sfn) if File.exist?(sfn)
115
- cmd = ['xsltproc',
116
- "--stringparam geoserver_root '#{geoserver}'",
117
- "--stringparam purl '#{purl}'",
118
- "--output '#{sfn}'",
119
- "'#{File.expand_path(File.dirname(__FILE__) + '/../lib/geohydra/mods2ogp.xsl')}'",
120
- "'#{dfn}'"
121
- ].join(' ')
122
- puts "Generating #{sfn} using #{cmd}" if flags[:verbose]
123
- ap({:cmd => cmd}) if flags[:debug]
124
- system(cmd)
113
+ # OGP Solr document from descMetadataDS
114
+ sfn = File.join(druid.temp_dir, 'geoblacklightSolr.xml')
115
+ FileUtils.rm_f(sfn) if File.exist?(sfn)
116
+ cmd = ['xsltproc',
117
+ "--stringparam geoserver_root '#{geoserver}'",
118
+ "--stringparam purl '#{purl}'",
119
+ "--output '#{sfn}'",
120
+ "'#{File.expand_path(File.dirname(__FILE__) + '/../lib/geohydra/mods2geoblacklight.xsl')}'",
121
+ "'#{dfn}'"
122
+ ].join(' ')
123
+ puts "Generating #{sfn} using #{cmd}" if flags[:verbose]
124
+ ap({:cmd => cmd}) if flags[:debug]
125
+ system(cmd)
125
126
 
126
- sfn
127
- end
127
+ sfn
128
+ end
129
+
130
+ def convert_mods2ogpsolr(druid, dfn, flags)
131
+ raise ArgumentError, 'Missing required :geoserver flag' if flags[:geoserver].nil?
132
+ raise ArgumentError, 'Missing required :purl flag' if flags[:purl].nil?
128
133
 
129
- def convert_geo2dc(geoMetadata, flags)
130
- # Solr document from GeoMetadataDS
131
- dcfn = File.join(druid.temp_dir, 'dc.xml')
132
- puts "Generating #{dcfn}" if flags[:verbose]
133
- File.open(dcfn, 'w') { |f| f << geoMetadata.to_dublin_core.to_xml(:indent => 2) }
134
- dcfn
135
- end
134
+ geoserver = flags[:geoserver]
135
+ purl = "#{flags[:purl]}/#{druid.id}"
136
136
 
137
- def export_images(druid, uuid, flags)
138
- # export any thumbnail images
139
- %w{png jpg}.each do |fmt|
140
- Dir.glob("#{flags[:tmpdir]}/#{uuid}/{private,public}/*.#{fmt}") do |fn|
141
- ext = '.' + fmt
142
- tfn = File.basename(fn, ext)
143
- # convert _s to _small as per GeoNetwork convention
144
- tfn = tfn.gsub(/_s$/, '_small')
145
- imagefn = File.join(druid.content_dir, tfn + ext)
146
- FileUtils.link fn, imagefn, :verbose => flags[:debug], :force => true
147
- yield imagefn if block_given?
137
+ # OGP Solr document from descMetadataDS
138
+ sfn = File.join(druid.temp_dir, 'ogpSolr.xml')
139
+ FileUtils.rm_f(sfn) if File.exist?(sfn)
140
+ cmd = ['xsltproc',
141
+ "--stringparam geoserver_root '#{geoserver}'",
142
+ "--stringparam purl '#{purl}'",
143
+ "--output '#{sfn}'",
144
+ "'#{File.expand_path(File.dirname(__FILE__) + '/../lib/geohydra/mods2ogp.xsl')}'",
145
+ "'#{dfn}'"
146
+ ].join(' ')
147
+ puts "Generating #{sfn} using #{cmd}" if flags[:verbose]
148
+ ap({:cmd => cmd}) if flags[:debug]
149
+ system(cmd)
150
+
151
+ sfn
152
+ end
153
+
154
+ def convert_geo2dc(geoMetadata, flags)
155
+ # Solr document from GeoMetadataDS
156
+ dcfn = File.join(druid.temp_dir, 'dc.xml')
157
+ puts "Generating #{dcfn}" if flags[:verbose]
158
+ File.open(dcfn, 'w') { |f| f << geoMetadata.to_dublin_core.to_xml(:indent => 2) }
159
+ dcfn
160
+ end
161
+
162
+ def export_images(druid, uuid, flags)
163
+ # export any thumbnail images
164
+ %w{png jpg}.each do |fmt|
165
+ Dir.glob("#{flags[:tmpdir]}/#{uuid}/{private,public}/*.#{fmt}") do |fn|
166
+ ext = '.' + fmt
167
+ tfn = File.basename(fn, ext)
168
+ # convert _s to _small as per GeoNetwork convention
169
+ tfn = tfn.gsub(/_s$/, '_small')
170
+ imagefn = File.join(druid.content_dir, tfn + ext)
171
+ FileUtils.link fn, imagefn, :verbose => flags[:debug], :force => true
172
+ yield imagefn if block_given?
173
+ end
148
174
  end
149
175
  end
150
- end
151
176
 
152
- def export_local_images(druid, tempdir, flags)
153
- # export any thumbnail images
154
- n = 0
155
- %w{png jpg}.each do |fmt|
156
- Dir.glob("#{flags[:stagedir]}/#{druid.id}/content/*.#{fmt}") do |fn|
157
- imagefn = File.join(druid.content_dir, 'preview' + '.' + fmt)
158
- FileUtils.link fn, imagefn, :verbose => flags[:debug], :force => true
159
- yield imagefn if block_given?
160
- n = n + 1
177
+ def export_local_images(druid, tempdir, flags)
178
+ # export any thumbnail images
179
+ n = 0
180
+ %w{png jpg}.each do |fmt|
181
+ Dir.glob("#{flags[:stagedir]}/#{druid.id}/content/*.#{fmt}") do |fn|
182
+ imagefn = File.join(druid.content_dir, 'preview' + '.' + fmt)
183
+ FileUtils.link fn, imagefn, :verbose => flags[:debug], :force => true
184
+ yield imagefn if block_given?
185
+ n = n + 1
186
+ end
161
187
  end
188
+ puts "WARNING: Multiple images for #{druid.id}" if n > 1
162
189
  end
163
- puts "WARNING: Multiple images for #{druid.id}" if n > 1
164
- end
165
190
 
166
- def export_attachments(druid, flags)
167
- Dir.glob("#{flags[:stagedir]}/#{druid.id}/content/*") do |fn|
168
- unless %w{.png .jpg .zip}.include?(File.extname(fn))
169
- afn = File.join(druid.content_dir, File.basename(fn))
170
- FileUtils.link fn, afn, :verbose => flags[:debug], :force => true
171
- yield afn if block_given?
191
+ def export_attachments(druid, flags)
192
+ Dir.glob("#{flags[:stagedir]}/#{druid.id}/content/*") do |fn|
193
+ unless %w{.png .jpg .zip}.include?(File.extname(fn))
194
+ afn = File.join(druid.content_dir, File.basename(fn))
195
+ FileUtils.link fn, afn, :verbose => flags[:debug], :force => true
196
+ yield afn if block_given?
197
+ end
172
198
  end
173
199
  end
174
- end
175
200
 
176
- def export_zip(druid, flags)
177
- # export content into zip files
178
- Dir.glob(File.join(flags[:stagedir], "#{druid.id}/content/*.zip")) do |fn|
179
- ofn = File.join(druid.content_dir, File.basename(fn))
180
- FileUtils.link fn, ofn, :verbose => flags[:verbose], :force => true
181
- yield ofn if block_given?
201
+ def export_zip(druid, flags)
202
+ # export content into zip files
203
+ Dir.glob(File.join(flags[:stagedir], "#{druid.id}/content/*.zip")) do |fn|
204
+ ofn = File.join(druid.content_dir, File.basename(fn))
205
+ FileUtils.link fn, ofn, :verbose => flags[:verbose], :force => true
206
+ yield ofn if block_given?
207
+ end
182
208
  end
183
- end
184
209
 
185
- def doit(client, uuid, obj, flags)
186
- puts "Processing #{obj.druid}"
187
- druid = setup_druid(obj, flags)
210
+ def doit(client, uuid, obj, flags)
211
+ puts "Processing #{obj.druid}"
212
+ druid = setup_druid(obj, flags)
188
213
 
189
- if flags[:geonetwork]
190
- puts "Processing #{uuid} from geonetwork" if flags[:debug]
191
- ifn = find_mef(druid, uuid, flags)
192
- else
193
- raise ArgumentError, druid if obj.content.empty?
194
- ifn, fcfn = find_local(druid, obj.content.to_s, obj.fc.to_s, flags)
195
- end
214
+ if flags[:geonetwork]
215
+ puts "Processing #{uuid} from geonetwork" if flags[:debug]
216
+ ifn = find_mef(druid, uuid, flags)
217
+ else
218
+ raise ArgumentError, druid if obj.content.empty?
219
+ ifn, fcfn = find_local(druid, obj.content.to_s, obj.fc.to_s, flags)
220
+ end
196
221
 
197
- puts "Processing #{ifn}" if flags[:verbose]
222
+ puts "Processing #{ifn}" if flags[:verbose]
198
223
 
199
- optfn = File.expand_path("#{flags[:stagedir]}/#{obj.druid}/temp/geoOptions.json")
200
- puts "Loading extra out-of-band options #{optfn}" if flags[:debug]
201
- if File.exist?(optfn)
202
- h = JSON.parse(File.read(optfn))
203
- flags = flags.merge(h).symbolize_keys
204
- ap({:optfn => optfn, :h => h, :flags => flags}) if flags[:debug]
205
- else
206
- puts "WARNING: #{obj.druid} is missing options .json parameters: #{optfn}"
207
- flags[:geometryType] ||= 'Polygon' # XXX: placeholder
208
- end
224
+ optfn = File.expand_path("#{flags[:stagedir]}/#{obj.druid}/temp/geoOptions.json")
225
+ puts "Loading extra out-of-band options #{optfn}" if flags[:debug]
226
+ if File.exist?(optfn)
227
+ h = JSON.parse(File.read(optfn))
228
+ flags = flags.merge(h).symbolize_keys
229
+ ap({:optfn => optfn, :h => h, :flags => flags}) if flags[:debug]
230
+ else
231
+ puts "WARNING: #{obj.druid} is missing options .json parameters: #{optfn}"
232
+ flags[:geometryType] ||= 'Polygon' # XXX: placeholder
233
+ end
209
234
 
210
- gfn = convert_iso2geo(druid, ifn, obj.content, obj.fc, flags)
211
- geoMetadata = Dor::GeoMetadataDS.from_xml File.read(gfn)
212
- geoMetadata.geometryType = flags[:geometryType] || 'Polygon'
213
- geoMetadata.zipName = 'data.zip'
214
- geoMetadata.purl = File.join(flags[:purl], druid.id)
235
+ gfn = convert_iso2geo(druid, ifn, obj.content, obj.fc, flags)
236
+ geoMetadata = Dor::GeoMetadataDS.from_xml File.read(gfn)
237
+ geoMetadata.geometryType = flags[:geometryType] || 'Polygon'
238
+ geoMetadata.zipName = 'data.zip'
239
+ geoMetadata.purl = File.join(flags[:purl], druid.id)
215
240
 
216
- dfn = convert_geo2mods(druid, geoMetadata, flags)
217
- sfn = convert_geo2solrspatial(druid, geoMetadata, flags)
241
+ dfn = convert_geo2mods(druid, geoMetadata, flags)
242
+ sfn = convert_mods2geoblacklight(druid, dfn, flags) if flags[:geoblacklight]
243
+ ofn = convert_mods2ogpsolr(druid, dfn, flags) if flags[:ogp]
218
244
 
219
- ofn = convert_mods2ogpsolr(druid, dfn, flags)
245
+ if flags[:geonetwork]
246
+ export_images(druid, uuid, flags)
247
+ else
248
+ export_local_images(druid, File.expand_path(File.dirname(obj.zipfn) + '/../temp'), flags)
249
+ end
220
250
 
221
- if flags[:geonetwork]
222
- export_images(druid, uuid, flags)
223
- else
224
- export_local_images(druid, File.expand_path(File.dirname(obj.zipfn) + '/../temp'), flags)
251
+ export_attachments(druid, flags)
252
+ export_zip(druid, flags)
225
253
  end
226
-
227
- export_attachments(druid, flags)
228
- export_zip(druid, flags)
229
- end
230
254
 
231
- def main(flags)
232
- File.umask(002)
233
- if flags[:geonetwork]
234
- client = GeoHydra::GeoNetwork.new
235
- client.each do |uuid|
236
- begin
237
- puts "Processing #{uuid}"
238
- obj = client.fetch(uuid)
239
- doit client, uuid, obj, flags
240
- rescue Exception => e
241
- $stderr.puts e
242
- $stderr.puts e.backtrace if flags[:debug]
255
+ def main(flags)
256
+ File.umask(002)
257
+ if flags[:geonetwork]
258
+ client = GeoHydra::GeoNetwork.new
259
+ client.each do |uuid|
260
+ begin
261
+ puts "Processing #{uuid}"
262
+ obj = client.fetch(uuid)
263
+ doit client, uuid, obj, flags
264
+ rescue Exception => e
265
+ $stderr.puts e
266
+ $stderr.puts e.backtrace if flags[:debug]
267
+ end
243
268
  end
244
- end
245
- else
246
- puts "Searching for staged content..." if flags[:verbose]
247
- puts flags[:stagedir] + '/' + DruidTools::Druid.glob + '/content/data.zip' if flags[:debug]
248
- Dir.glob(flags[:stagedir] + '/' + DruidTools::Druid.glob + '/content/data.zip') do |zipfn|
249
- Dir.glob(File.join(File.dirname(zipfn), '..', 'temp', '*iso19139.xml')) do |xmlfn|
250
- druid = File.basename(File.dirname(File.dirname(zipfn)))
251
- obj = Struct.new(:content, :status, :druid, :zipfn, :fc).new(File.read(xmlfn), nil, druid, zipfn, File.read(xmlfn.gsub('.xml', '-fc.xml')))
252
- ap({:zipfn => zipfn, :obj => obj}) if flags[:debug]
253
- doit client, nil, obj, flags
269
+ else
270
+ puts "Searching for staged content..." if flags[:verbose]
271
+ puts flags[:stagedir] + '/' + DruidTools::Druid.glob + '/content/data.zip' if flags[:debug]
272
+ Dir.glob(flags[:stagedir] + '/' + DruidTools::Druid.glob + '/content/data.zip') do |zipfn|
273
+ Dir.glob(File.join(File.dirname(zipfn), '..', 'temp', '*iso19139.xml')) do |xmlfn|
274
+ druid = File.basename(File.dirname(File.dirname(zipfn)))
275
+ begin
276
+ fcXml = File.read(xmlfn.gsub('19139.xml', '19110.xml'))
277
+ rescue Exception => e
278
+ begin
279
+ fcXml = File.read(xmlfn.gsub('19139.xml', '19139-fc.xml'))
280
+ rescue Exception => e
281
+ fcXml = ''
282
+ end
283
+ end
284
+ obj = Struct.new(:content, :status, :druid, :zipfn, :fc).new(File.read(xmlfn), nil, druid, zipfn, fcXml)
285
+ ap({:zipfn => zipfn, :obj => obj}) if flags[:debug]
286
+ doit client, nil, obj, flags
287
+ end
254
288
  end
255
289
  end
256
290
  end
257
- end
258
291
 
259
- # __MAIN__
260
- begin
261
- flags = {
262
- :debug => false,
263
- :verbose => false,
264
- :geonetwork => false,
265
- :geoserver => GeoHydra::Config.ogp.geoserver,
266
- :solr => GeoHydra::Config.ogp.solr,
267
- :purl => GeoHydra::Config.ogp.purl,
268
- :stagedir => GeoHydra::Config.geohydra.stage || 'stage',
269
- :xinclude => false,
270
- :workspacedir => GeoHydra::Config.geohydra.workspace || 'workspace',
271
- :tmpdir => GeoHydra::Config.geohydra.tmpdir || 'tmp'
272
- }
292
+ def run(args)
293
+ flags = {
294
+ :debug => false,
295
+ :verbose => false,
296
+ :geonetwork => false,
297
+ :geoserver => GeoHydra::Config.ogp.geoserver,
298
+ :solr => GeoHydra::Config.ogp.solr,
299
+ :geoblacklight => true,
300
+ :ogp => true,
301
+ :purl => GeoHydra::Config.ogp.purl,
302
+ :stagedir => GeoHydra::Config.geohydra.stage || 'stage',
303
+ :xinclude => false,
304
+ :workspacedir => GeoHydra::Config.geohydra.workspace || 'workspace',
305
+ :tmpdir => GeoHydra::Config.geohydra.tmpdir || 'tmp'
306
+ }
273
307
 
274
- OptionParser.new do |opts|
275
- opts.banner = <<EOM
276
- Usage: #{File.basename(__FILE__)} [options]
308
+ OptionParser.new do |opts|
309
+ opts.banner = <<EOM
310
+ Usage: #{File.basename(__FILE__)} [options]
277
311
  EOM
278
- opts.on('--geonetwork', 'Run against GeoNetwork server') do |v|
279
- flags[:geonetwork] = true
280
- end
281
- opts.on('-v', '--verbose', 'Run verbosely') do |v|
282
- flags[:debug] = true if flags[:verbose]
283
- flags[:verbose] = true
284
- end
285
- opts.on('--stagedir DIR', "Staging directory with ZIP files (default: #{flags[:stagedir]})") do |v|
286
- flags[:stagedir] = v
287
- end
288
- opts.on('--workspace DIR', "Workspace directory for assembly (default: #{flags[:workspacedir]})") do |v|
289
- flags[:workspacedir] = v
290
- end
291
- opts.on('--tmpdir DIR', "Temporary directory for assembly (default: #{flags[:tmpdir]})") do |v|
292
- flags[:tmpdir] = v
312
+ opts.on('--geonetwork', 'Run against GeoNetwork server (deprecated)') do |v|
313
+ flags[:geonetwork] = true
314
+ end
315
+ opts.on('-v', '--verbose', 'Run verbosely') do |v|
316
+ flags[:debug] = true if flags[:verbose]
317
+ flags[:verbose] = true
318
+ end
319
+ opts.on('--stagedir DIR', "Staging directory with ZIP files (default: #{flags[:stagedir]})") do |v|
320
+ flags[:stagedir] = v
321
+ end
322
+ opts.on('--workspace DIR', "Workspace directory for assembly (default: #{flags[:workspacedir]})") do |v|
323
+ flags[:workspacedir] = v
324
+ end
325
+ opts.on('--tmpdir DIR', "Temporary directory for assembly (default: #{flags[:tmpdir]})") do |v|
326
+ flags[:tmpdir] = v
327
+ end
328
+ opts.on('--[no-]geoblacklight', 'Generate geoblacklightSolr.xml') do |v|
329
+ flags[:geoblacklight] = v
330
+ end
331
+ opts.on('--[no-]ogp', 'Generate ogpSolr.xml') do |v|
332
+ flags[:ogp] = v
333
+ end
334
+ end.parse!(args)
335
+
336
+ %w{tmpdir stagedir workspacedir}.each do |k|
337
+ d = flags[k.to_sym]
338
+ raise ArgumentError, "Missing directory #{d}" unless d.nil? or File.directory? d
293
339
  end
294
- end.parse!
295
340
 
296
- %w{tmpdir stagedir workspacedir}.each do |k|
297
- d = flags[k.to_sym]
298
- raise ArgumentError, "Missing directory #{d}" unless d.nil? or File.directory? d
341
+ ap({:flags => flags}) if flags[:debug]
342
+ raise NotImplementError, 'geonetwork code is stale' if flags[:geonetwork]
343
+ main flags
299
344
  end
300
-
301
- ap({:flags => flags}) if flags[:debug]
302
- raise NotImplementError, 'geonetwork code is stale' if flags[:geonetwork]
303
- main flags
304
- rescue SystemCallError => e
305
- $stderr.puts "ERROR: #{e.message}"
306
- exit(-1)
307
345
  end
346
+
347
+ # __MAIN__
348
+ Assemble.new().run(ARGV)