Module: Geoserver::Publish
- Defined in:
- lib/geoserver/publish.rb,
lib/geoserver/publish/layer.rb,
lib/geoserver/publish/style.rb,
lib/geoserver/publish/config.rb,
lib/geoserver/publish/create.rb,
lib/geoserver/publish/version.rb,
lib/geoserver/publish/coverage.rb,
lib/geoserver/publish/workspace.rb,
lib/geoserver/publish/connection.rb,
lib/geoserver/publish/data_store.rb,
lib/geoserver/publish/feature_type.rb,
lib/geoserver/publish/coverage_store.rb
Defined Under Namespace
Classes: Connection, Coverage, CoverageStore, DataStore, Error, FeatureType, Layer, Style, Workspace
Constant Summary
collapse
- VERSION =
"0.4.0"
Class Method Summary
collapse
-
.config ⇒ Object
-
.config_yaml ⇒ Object
-
.create_coverage(workspace_name:, coverage_store_name:, coverage_name:, title:, connection: nil) ⇒ Object
-
.create_coverage_store(workspace_name:, coverage_store_name:, url:, connection: nil) ⇒ Object
-
.create_data_store(workspace_name:, data_store_name:, url:, connection: nil) ⇒ Object
-
.create_feature_type(workspace_name:, data_store_name:, feature_type_name:, title:, connection: nil) ⇒ Object
-
.create_workspace(workspace_name:, connection: nil) ⇒ Object
-
.delete_geotiff(workspace_name:, id:, connection: nil) ⇒ Object
-
.delete_shapefile(workspace_name:, id:, connection: nil) ⇒ Object
-
.geotiff(workspace_name:, file_path:, id:, title: nil, connection: nil) ⇒ Object
-
.root ⇒ Object
-
.shapefile(workspace_name:, file_path:, id:, title: nil, connection: nil) ⇒ Object
Class Method Details
.config ⇒ Object
4
5
6
|
# File 'lib/geoserver/publish/config.rb', line 4
def config
@config ||= config_yaml
end
|
.config_yaml ⇒ Object
10
11
12
13
|
# 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) ⇒ Object
10
11
12
13
|
# 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) ⇒ Object
5
6
7
8
|
# 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) ⇒ Object
15
16
17
18
|
# 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) ⇒ Object
20
21
22
23
|
# 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) ⇒ Object
25
26
27
28
|
# 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) ⇒ Object
21
22
23
|
# File 'lib/geoserver/publish.rb', line 21
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) ⇒ Object
25
26
27
|
# File 'lib/geoserver/publish.rb', line 25
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) ⇒ Object
29
30
31
32
33
|
# File 'lib/geoserver/publish.rb', line 29
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 ⇒ Object
41
42
43
|
# File 'lib/geoserver/publish.rb', line 41
def self.root
Pathname.new(File.expand_path("../../../", __FILE__))
end
|
.shapefile(workspace_name:, file_path:, id:, title: nil, connection: nil) ⇒ Object
35
36
37
38
39
|
# File 'lib/geoserver/publish.rb', line 35
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
|