This repository has been archived by the owner on Jun 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
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 #9 from NuCivic/rc-1.12.11.0
Upgrades to DKAN 1.11
- Loading branch information
Showing
888 changed files
with
49,617 additions
and
8,267 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
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,87 @@ | ||
require "pathname" | ||
|
||
TOKENS = { | ||
"s" => (1), | ||
"m" => (60), | ||
"h" => (60 * 60), | ||
"d" => (60 * 60 * 24) | ||
} | ||
|
||
|
||
def parse_time(time_string, measure = "m") | ||
time = 0 | ||
time_string.scan(/([-+]?[0-9]*\.?[0-9]*)(\w)/).each do |amount, measure| | ||
begin | ||
time += amount.to_i * TOKENS[measure] | ||
rescue TypeError => te | ||
puts "Missing time header" | ||
rescue StandardError => se | ||
puts "An error happen trying to parse the time header" | ||
end | ||
end | ||
return time | ||
end | ||
|
||
def parse_header(file) | ||
file = Pathname(file).realpath.to_s | ||
first_line = File.open(file, &:gets) | ||
first_line.sub! "#", "" | ||
if first_line.include? "time" | ||
time = first_line.split(":")[1].strip | ||
time = parse_time(time) | ||
else | ||
time = 60 # For missing headers default to 60s | ||
end | ||
return time | ||
end | ||
|
||
def sort_files(files) | ||
sorted_files = {} | ||
files.each_index do |i| | ||
sorted_files[files[i]] = parse_header(files[i]) | ||
end | ||
return sorted_files.sort_by {|k, v| v}.reverse | ||
end | ||
|
||
def node_total() | ||
unless ENV.has_key?("CIRCLE_NODE_TOTAL") | ||
return 1 | ||
else | ||
return ENV["CIRCLE_NODE_TOTAL"].to_i | ||
end | ||
end | ||
|
||
def node_index() | ||
unless ENV.has_key?("CIRCLE_NODE_INDEX") | ||
return 0 | ||
else | ||
return ENV["CIRCLE_NODE_INDEX"].to_i | ||
end | ||
end | ||
|
||
def get_containers() | ||
return Array.new(node_total(), 0) | ||
end | ||
|
||
def get_distribution() | ||
distribution = {} | ||
to = node_total() - 1; | ||
for i in 0..to | ||
distribution[i] = [] | ||
end | ||
return distribution | ||
end | ||
|
||
def balance(files) | ||
containers = get_containers() | ||
distribution = get_distribution() | ||
files = sort_files(files) | ||
files.each_index do |i| | ||
emptier = containers.each_with_index.min[1] | ||
file, weight = files[i] | ||
containers[emptier] += weight | ||
distribution[emptier].push(file) | ||
end | ||
return distribution | ||
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
if [ $(uname) == "Darwin" ]; then | ||
concurrency=`sysctl -n hw.ncpu` | ||
else | ||
concurrency=`grep -c ^processor /proc/cpuinfo` | ||
fi | ||
|
||
if [ "$AHOY_CMD_PROXY" = "DOCKER" ]; then | ||
working_copy="--working-copy" | ||
else | ||
working_copy="" | ||
fi | ||
|
||
drush --root=docroot -y make --no-core --contrib-destination=./ dkan/drupal-org.make --no-recursion --no-cache --verbose $working_copy --concurrency=$concurrency docroot/profiles/dkan $@ |
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,4 @@ | ||
drush si dkan --root=docroot --verbose --account-pass='admin' "$1" --site-name='DKAN' install_configure_form.update_status_module='array(FALSE,FALSE)' --yes && \ | ||
drush --root=docroot sql-dump > backups/last_install.sql.tmp && \ | ||
mv backups/last_install.sql.tmp backups/last_install.sql && \ | ||
echo "Installed DKAN and created a new backup at backups/last_install.sql" |
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,16 @@ | ||
if [ $(uname) == "Darwin" ]; then | ||
concurrency=`sysctl -n hw.ncpu` | ||
else | ||
concurrency=`grep -c ^processor /proc/cpuinfo` | ||
fi | ||
|
||
if [ "$AHOY_CMD_PROXY" = "DOCKER" ]; then | ||
working_copy="--working-copy" | ||
else | ||
working_copy="" | ||
fi | ||
|
||
drush --root=docroot make --concurrency=$concurrency --prepare-install dkan/drupal-org-core.make docroot --yes | ||
|
||
drush --root=docroot -y --verbose $root si minimal --sites-subdir=default --account-pass='admin' --db-url=$1 install_configure_form.update_status_module='array(false,false)' && | ||
ln -s ../../dkan docroot/profiles/dkan |
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
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 |
---|---|---|
|
@@ -163,8 +163,8 @@ commands: | |
set -e | ||
AHOY_CMD_PROXY='' | ||
DIRNAME=${PWD##*/} | ||
if [[ "$DIRNAME" != "dkan_starter" ]]; then | ||
echo "This command should only be use from a dkan_starter working copy" | ||
if [[ "$DIRNAME" != "data_starter_private" ]]; then | ||
echo "This command should only be use from a data_starter_private working copy" | ||
exit 0 | ||
fi | ||
|
@@ -179,7 +179,7 @@ commands: | |
fi | ||
# No ahoy commands after cd-ing out of project folder. | ||
cd .. | ||
git clone '[email protected]:NuCivic/dkan_starter.git' {{args}} --depth=1 | ||
git clone '[email protected]:NuCivic/data_starter_private.git' {{args}} --depth=1 | ||
cd {{args}} | ||
rm -rf .git build.make build-dkan.make drupal-org-core.make | ||
echo "Site {{args}} initiated at ../{{args}}" | ||
|
Oops, something went wrong.