module Geoserver::Publish

Constants

VERSION

Public Class Methods

config() click to toggle source
# File lib/geoserver/publish/config.rb, line 4
def config
  @config ||= config_yaml
end
config_yaml() click to toggle source
# File lib/geoserver/publish/config.rb, line 10
def config_yaml
  file_path = File.join(Geoserver::Publish.root, "config", "config.yml")
  YAML.safe_load(ERB.new(File.read(file_path)).result, [], [], true)
end
create_coverage(workspace_name:, coverage_store_name:, coverage_name:, title:, connection: nil) click to toggle source
# File lib/geoserver/publish/create.rb, line 10
def create_coverage(workspace_name:, coverage_store_name:, coverage_name:, title:, connection: nil)
  return if Coverage.new(connection).find(workspace_name: workspace_name, coverage_store_name: coverage_store_name, coverage_name: coverage_name)
  Coverage.new(connection).create(workspace_name: workspace_name, coverage_store_name: coverage_store_name, coverage_name: coverage_name, title: title)
end
create_coverage_store(workspace_name:, coverage_store_name:, url:, connection: nil) click to toggle source
# File lib/geoserver/publish/create.rb, line 5
def create_coverage_store(workspace_name:, coverage_store_name:, url:, connection: nil)
  return if CoverageStore.new(connection).find(workspace_name: workspace_name, coverage_store_name: coverage_store_name)
  CoverageStore.new(connection).create(workspace_name: workspace_name, coverage_store_name: coverage_store_name, url: url)
end
create_data_store(workspace_name:, data_store_name:, url:, connection: nil) click to toggle source
# File lib/geoserver/publish/create.rb, line 15
def create_data_store(workspace_name:, data_store_name:, url:, connection: nil)
  return if DataStore.new(connection).find(workspace_name: workspace_name, data_store_name: data_store_name)
  DataStore.new(connection).create(workspace_name: workspace_name, data_store_name: data_store_name, url: url)
end
create_feature_type(workspace_name:, data_store_name:, feature_type_name:, title:, connection: nil) click to toggle source
# File lib/geoserver/publish/create.rb, line 20
def create_feature_type(workspace_name:, data_store_name:, feature_type_name:, title:, connection: nil)
  return if FeatureType.new(connection).find(workspace_name: workspace_name, data_store_name: data_store_name, feature_type_name: feature_type_name)
  FeatureType.new(connection).create(workspace_name: workspace_name, data_store_name: data_store_name, feature_type_name: feature_type_name, title: title)
end
create_workspace(workspace_name:, connection: nil) click to toggle source
# File lib/geoserver/publish/create.rb, line 25
def create_workspace(workspace_name:, connection: nil)
  return if Workspace.new(connection).find(workspace_name: workspace_name)
  Workspace.new(connection).create(workspace_name: workspace_name)
end
delete_geotiff(workspace_name:, id:, connection: nil) click to toggle source
# File lib/geoserver/publish.rb, line 22
def self.delete_geotiff(workspace_name:, id:, connection: nil)
  CoverageStore.new(connection).delete(workspace_name: workspace_name, coverage_store_name: id)
end
delete_shapefile(workspace_name:, id:, connection: nil) click to toggle source
# File lib/geoserver/publish.rb, line 26
def self.delete_shapefile(workspace_name:, id:, connection: nil)
  DataStore.new(connection).delete(workspace_name: workspace_name, data_store_name: id)
end
geotiff(workspace_name:, file_path:, id:, title: nil, connection: nil) click to toggle source
# File lib/geoserver/publish.rb, line 30
def self.geotiff(workspace_name:, file_path:, id:, title: nil, connection: nil)
  create_workspace(workspace_name: workspace_name, connection: connection)
  create_coverage_store(workspace_name: workspace_name, coverage_store_name: id, url: file_path, connection: connection)
  create_coverage(workspace_name: workspace_name, coverage_store_name: id, coverage_name: id, title: title, connection: connection)
end
root() click to toggle source
# File lib/geoserver/publish.rb, line 42
def self.root
  Pathname.new(File.expand_path("../../../", __FILE__))
end
shapefile(workspace_name:, file_path:, id:, title: nil, connection: nil) click to toggle source
# File lib/geoserver/publish.rb, line 36
def self.shapefile(workspace_name:, file_path:, id:, title: nil, connection: nil)
  create_workspace(workspace_name: workspace_name, connection: connection)
  create_data_store(workspace_name: workspace_name, data_store_name: id, url: file_path, connection: connection)
  create_feature_type(workspace_name: workspace_name, data_store_name: id, feature_type_name: id, title: title, connection: connection)
end

Private Instance Methods

config() click to toggle source
# File lib/geoserver/publish/config.rb, line 4
def config
  @config ||= config_yaml
end
config_yaml() click to toggle source
# File lib/geoserver/publish/config.rb, line 10
def config_yaml
  file_path = File.join(Geoserver::Publish.root, "config", "config.yml")
  YAML.safe_load(ERB.new(File.read(file_path)).result, [], [], true)
end
create_coverage(workspace_name:, coverage_store_name:, coverage_name:, title:, connection: nil) click to toggle source
# File lib/geoserver/publish/create.rb, line 10
def create_coverage(workspace_name:, coverage_store_name:, coverage_name:, title:, connection: nil)
  return if Coverage.new(connection).find(workspace_name: workspace_name, coverage_store_name: coverage_store_name, coverage_name: coverage_name)
  Coverage.new(connection).create(workspace_name: workspace_name, coverage_store_name: coverage_store_name, coverage_name: coverage_name, title: title)
end
create_coverage_store(workspace_name:, coverage_store_name:, url:, connection: nil) click to toggle source
# File lib/geoserver/publish/create.rb, line 5
def create_coverage_store(workspace_name:, coverage_store_name:, url:, connection: nil)
  return if CoverageStore.new(connection).find(workspace_name: workspace_name, coverage_store_name: coverage_store_name)
  CoverageStore.new(connection).create(workspace_name: workspace_name, coverage_store_name: coverage_store_name, url: url)
end
create_data_store(workspace_name:, data_store_name:, url:, connection: nil) click to toggle source
# File lib/geoserver/publish/create.rb, line 15
def create_data_store(workspace_name:, data_store_name:, url:, connection: nil)
  return if DataStore.new(connection).find(workspace_name: workspace_name, data_store_name: data_store_name)
  DataStore.new(connection).create(workspace_name: workspace_name, data_store_name: data_store_name, url: url)
end
create_feature_type(workspace_name:, data_store_name:, feature_type_name:, title:, connection: nil) click to toggle source
# File lib/geoserver/publish/create.rb, line 20
def create_feature_type(workspace_name:, data_store_name:, feature_type_name:, title:, connection: nil)
  return if FeatureType.new(connection).find(workspace_name: workspace_name, data_store_name: data_store_name, feature_type_name: feature_type_name)
  FeatureType.new(connection).create(workspace_name: workspace_name, data_store_name: data_store_name, feature_type_name: feature_type_name, title: title)
end
create_workspace(workspace_name:, connection: nil) click to toggle source
# File lib/geoserver/publish/create.rb, line 25
def create_workspace(workspace_name:, connection: nil)
  return if Workspace.new(connection).find(workspace_name: workspace_name)
  Workspace.new(connection).create(workspace_name: workspace_name)
end