File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,7 +15,8 @@ class Config
1515 include RakeHelper
1616
1717 TOP_DIRS = %w( app db config lib log script vendor )
18- FILE = "config/warble.rb"
18+ CONFIG_DIR = "config"
19+ FILE = "#{ CONFIG_DIR } /warble.rb"
1920 BUILD_GEMS = %w( warbler rake rcov )
2021
2122 include Traits
Original file line number Diff line number Diff line change @@ -151,12 +151,15 @@ def define_config_task
151151 if File . exist? ( Warbler ::Config ::FILE ) && ENV [ "FORCE" ] . nil?
152152 puts "There's another bird sitting on my favorite branch"
153153 puts "(file '#{ Warbler ::Config ::FILE } ' already exists. Pass argument FORCE=1 to override)"
154- elsif !File . directory? ( "config" )
155- puts "I'm confused; my favorite branch is missing"
156- puts "(directory 'config' is missing)"
157- else
158- cp "#{ Warbler ::WARBLER_HOME } /warble.rb" , Warbler ::Config ::FILE
154+ next
155+ end
156+
157+ if !File . directory? ( Warbler ::Config ::CONFIG_DIR )
158+ puts "config dir is missing, creating it"
159+ mkdir_p Warbler ::Config ::CONFIG_DIR
159160 end
161+
162+ cp "#{ Warbler ::WARBLER_HOME } /warble.rb" , Warbler ::Config ::FILE
160163 end
161164 end
162165
Original file line number Diff line number Diff line change 5757 expect ( capture { Warbler ::Application . new . run } ) . to match /already exists/
5858 end
5959
60- it "should complain if the config directory is missing" do
60+ it "should create the config dir if it is missing" do
6161 begin
6262 mv "config" , "config-tmp"
6363 ARGV . unshift "config"
64- expect ( capture { Warbler ::Application . new . run } ) . to match /missing/
64+ expect ( capture { Warbler ::Application . new . run } ) . to match /missing, creating /
6565 ensure
66+ rm_r "config"
6667 mv "config-tmp" , "config"
6768 end
6869 end
You can’t perform that action at this time.
0 commit comments