Skip to content

Commit

Permalink
Fix build command's sanity checks
Browse files Browse the repository at this point in the history
This looks very much like I stopped coding half-way through a thought!
  • Loading branch information
gma committed Nov 7, 2024
1 parent 8d6b6f0 commit 80b1b5e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/nesta/static/site.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ def log(message)

def set_app_root
root = ::File.expand_path('.')
['Gemfile', ].each do |expected|
if ! File.exist?(File.join(root, 'config', 'config.yml'))
['Gemfile', File.join('config', 'config.yml')].each do |expected|
if ! File.exist?(File.join(root, expected))
message = "is this a Nesta site? (expected './#{expected}')"
raise RuntimeError, message
end
Expand Down
5 changes: 4 additions & 1 deletion test/support/temporary_files.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'fileutils'

module TemporaryFiles
TEMP_DIR = File.expand_path('tmp', File.join(File.dirname(__FILE__), '..'))

Expand All @@ -21,7 +23,8 @@ def project_path(path)

def in_temporary_project(*args, &block)
FileUtils.mkdir_p(File.join(project_root, 'config'))
File.open(File.join(project_root, 'config', 'config.yml'), 'w').close
FileUtils.touch(File.join(project_root, 'Gemfile'))
FileUtils.touch(File.join(project_root, 'config', 'config.yml'))
Dir.chdir(project_root) { yield project_root }
ensure
remove_temp_directory
Expand Down

0 comments on commit 80b1b5e

Please sign in to comment.