-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #198 from unepwcmc/release-1.3.1
Release 1.3.1
- Loading branch information
Showing
8 changed files
with
120 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,12 @@ | ||
set :stage, :staging | ||
set :branch, :develop | ||
|
||
|
||
|
||
server "web-supported-staging.linode.unep-wcmc.org", user: 'wcmc', roles: %w{app web db} | ||
|
||
set :application, "ocean-plus-habitats" | ||
set :server_name, "ocean-plus-habitats.web-supported-staging.linode.unep-wcmc.org" | ||
set :sudo_user, "wcmc" | ||
set :app_port, "80" | ||
|
||
|
||
set :branch, ENV['BRANCH'] || :develop | ||
|
||
server 'web-supported-staging.linode.unep-wcmc.org', user: 'wcmc', roles: %w[app web db] | ||
|
||
set :application, 'ocean-plus-habitats' | ||
set :server_name, 'ocean-plus-habitats.web-supported-staging.linode.unep-wcmc.org' | ||
set :sudo_user, 'wcmc' | ||
set :app_port, '80' | ||
|
||
# server-based syntax | ||
# ====================== | ||
|
@@ -23,8 +17,6 @@ | |
# server "example.com", user: "deploy", roles: %w{app web}, other_property: :other_value | ||
# server "db.example.com", user: "deploy", roles: %w{db} | ||
|
||
|
||
|
||
# role-based syntax | ||
# ================== | ||
|
||
|
@@ -37,8 +29,6 @@ | |
# role :web, %w{[email protected] [email protected]}, other_property: :other_value | ||
# role :db, %w{[email protected]} | ||
|
||
|
||
|
||
# Configuration | ||
# ============= | ||
# You can set any configuration variable like in config/deploy.rb | ||
|
@@ -47,8 +37,6 @@ | |
# http://capistranorb.com/documentation/getting-started/configuration/ | ||
# Feel free to add new variables to customise your setup. | ||
|
||
|
||
|
||
# Custom SSH Options | ||
# ================== | ||
# You may pass any option but keep in mind that net/ssh understands a | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
db/migrate/20210812135252_add_global_habitat_coverage_protection_stats_to_habitats.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class AddGlobalHabitatCoverageProtectionStatsToHabitats < ActiveRecord::Migration[5.1] | ||
def change | ||
add_column :habitats, :total_area, :float, null: true | ||
add_column :habitats, :protected_area, :float, null: true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,24 @@ | ||
# NOTE(1): if the global stats are ever generated by the app again, we might | ||
# no-longer need to have the total_area and protected_area attributes | ||
namespace :import do | ||
desc "import CSV data into database" | ||
desc 'import CSV data into database' | ||
task :habitats, [:csv_file] => [:environment] do | ||
habitats_config = YAML.load(File.open("#{Rails.root}/config/habitats.yml", 'r')) | ||
|
||
habitats_config['habitats'].each do |name, data| | ||
Habitat.where(name: data['name']).first_or_create do |habitat| | ||
habitat.update_attributes(data) | ||
end | ||
attributes = { | ||
title: data['title'], | ||
theme: data['theme'], | ||
poly_table: data['poly_table'], | ||
point_table: data['point_table'], | ||
wms_url: data['wms_url'], | ||
total_area: data['total_area'].to_f, # see NOTE(1) | ||
protected_area: data['protected_area'].to_f # see NOTE(1) | ||
} | ||
|
||
Habitat.find_or_create_by(name: data['name']).update_attributes(attributes) | ||
|
||
Rails.logger.info "#{name.capitalize} habitat created!" | ||
end | ||
end | ||
end | ||
end |