Permalink
Browse files

Revert "Merge pull request #6 from bernerdschaefer/build-env-with-con…

…fig-merging"

This reverts commit 35ae1fe, reversing
changes made to 69f4e67.
  • Loading branch information...
1 parent 35ae1fe commit 2a4cefc75ffb33a8196f84a9189801bb0a0b8eea @ddollar ddollar committed Jul 10, 2012
Showing with 7 additions and 106 deletions.
  1. +6 −34 bin/compile
  2. +1 −1 bin/release
  3. +0 −71 support/update_config
View
@@ -2,17 +2,6 @@
set -e
-BUILD_DIR=$1
-CACHE_DIR=$2
-
-SUPPORT_DIR=$(dirname $0)/../support/
-
-RELEASE_CONFIG=$BUILD_DIR/release_config.yml
-BUILD_ENV=$CACHE_DIR/build_env
-
-mkdir -p $BUILD_DIR
-mkdir -p $CACHE_DIR
-
function indent() {
c='s/^/ /'
case $(uname) in
@@ -21,24 +10,9 @@ function indent() {
esac
}
-function with_env() {
- if [ -s $BUILD_ENV ]; then
- env "$(cat $BUILD_ENV)" $*
- else
- env $*
- fi
-}
-
-# reset build environment
-echo "=====> Resetting build environment"
-> $BUILD_ENV
-
-echo "=====> Generating empty release configuration"
-echo "--- {}" > $RELEASE_CONFIG
-
unset GIT_DIR
-for BUILDPACK in $(cat $BUILD_DIR/.buildpacks); do
+for BUILDPACK in $(cat $1/.buildpacks); do
dir=$(mktemp -t buildpackXXXXX)
rm -rf $dir
@@ -60,22 +34,20 @@ for BUILDPACK in $(cat $BUILD_DIR/.buildpacks); do
chmod +x $dir/bin/{detect,compile,release}
- framework=$(with_env $dir/bin/detect $BUILD_DIR)
+ framework=$($dir/bin/detect $1)
if [ $? == 0 ]; then
echo "=====> Detected Framework: $framework"
- with_env $dir/bin/compile $BUILD_DIR $CACHE_DIR
+ $dir/bin/compile $1 $2
if [ $? != 0 ]; then
exit 1
fi
- config=$(with_env $dir/bin/release $BUILD_DIR)
-
- $SUPPORT_DIR/update_config $RELEASE_CONFIG $BUILD_ENV <<< "${config}"
+ $dir/bin/release $1 > $1/last_pack_release.out
fi
fi
done
-echo "Using release configuration from framework $framework:" | indent
-cat $RELEASE_CONFIG | indent
+echo "Using release configuration from last framework $framework:" | indent
+cat $1/last_pack_release.out | indent
View
@@ -1,3 +1,3 @@
#!/usr/bin/env bash
-cat $1/release_config.yml
+cat $1/last_pack_release.out
View
@@ -1,71 +0,0 @@
-#!/usr/bin/env ruby
-# support/update_config config.yml build_env < new_config_data
-
-require "yaml"
-require "shellwords"
-
-release_config_file = ARGV[0]
-build_env_file = ARGV[1]
-
-class ReleaseConfig
- def initialize(config = {})
- @config = config
- end
-
- def [](key)
- @config[key]
- end
-
- def []=(key, value)
- @config[key] = value
- end
-
- def addons
- self["addons"] ||= []
- end
-
- def build_env
- self["build_env"] ||= {}
- end
-
- def config_vars
- self["config_vars"] ||= {}
- end
-
- def default_process_types
- self["default_process_types"] ||= {}
- end
-
- def merge(other)
- merged = ReleaseConfig.new
-
- merged["addons"] = addons | other.addons
- merged["build_env"] = build_env.merge(other.build_env)
- merged["config_vars"] = config_vars.merge(other.config_vars)
- merged["default_process_types"] = default_process_types.merge(other.default_process_types)
-
- merged
- end
-
- def write_release_config(filename)
- File.open(filename, "w") do |file|
- YAML.dump @config, file
- end
- end
-
- def write_build_env(filename)
- File.open(filename, "w") do |file|
- build_env.each do |key, value|
- file.puts "#{key}=#{value}"
- end
- end
- end
-end
-
-source = ReleaseConfig.new(YAML.load_file(release_config_file))
-new = ReleaseConfig.new(YAML.load($stdin.read))
-
-merged = source.merge(new)
-
-merged.write_release_config release_config_file
-merged.write_build_env build_env_file

0 comments on commit 2a4cefc

Please sign in to comment.