frank-cucumber 0.7.6 → 0.7.7
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/frank-skeleton +41 -14
- data/lib/frank-cucumber/version.rb +1 -1
- metadata +2 -2
data/bin/frank-skeleton
CHANGED
@@ -2,24 +2,51 @@
|
|
2
2
|
|
3
3
|
require 'fileutils'
|
4
4
|
|
5
|
-
|
5
|
+
TARGET_DIR = File.join( FileUtils.pwd, "Frank" )
|
6
|
+
SOURCE_DIR = File.join( File.dirname(__FILE__), '..', 'frank-skeleton' )
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
command = ARGV[0]
|
9
|
+
|
10
|
+
unless ["update-server",nil].include? command
|
11
|
+
puts "unrecognized command #{command}"
|
12
|
+
puts "the only valid command at the moment is update-server"
|
13
|
+
exit 10
|
14
|
+
end
|
15
|
+
|
16
|
+
update_mode = ARGV[0] == 'update-server'
|
17
|
+
|
18
|
+
def create_skeleton_dir
|
11
19
|
puts "I'm about to create a subdirectory called Frank which will contain the Frank server files and also your Cucumber tests. Please hit return to confirm that's what you want."
|
12
|
-
exit
|
20
|
+
exit 3 unless STDIN.gets.chomp == ''
|
21
|
+
|
22
|
+
FileUtils.mkdir_p( TARGET_DIR )
|
23
|
+
FileUtils.cp_r( Dir.glob( SOURCE_DIR+"/*" ), TARGET_DIR )
|
24
|
+
|
25
|
+
puts <<-EOS
|
26
|
+
Frank subdirectory created.
|
27
|
+
Your next step is to create a Frankified target for your app, and add the libFrank.a and frank_static_resources.bundle files inside the Frank directory to that target.
|
28
|
+
After that, you can build the target and try executing 'cucumber' from the Frank directory to see how your initial cucumber test runs.
|
29
|
+
EOS
|
13
30
|
end
|
14
31
|
|
15
|
-
|
32
|
+
def update_server_files
|
33
|
+
source_files = %w{libFrank.a frank_static_resources.bundle}.map{ |x| File.join( SOURCE_DIR, x ) }
|
34
|
+
FileUtils.cp_r( source_files, TARGET_DIR )
|
35
|
+
puts "All done. I've updated libFrank.a and frank_static_resources.bundle inside #{TARGET_DIR}"
|
36
|
+
end
|
16
37
|
|
17
|
-
|
38
|
+
frank_dir_already_exists = File.exists?( TARGET_DIR )
|
18
39
|
|
19
|
-
|
40
|
+
if frank_dir_already_exists && !update_mode
|
41
|
+
puts "A Frank subdirectory already exists. I don't want to mess with that. \n\nIf you want me to update the frank server code in that directory then run `frank-skeleton update-server`"
|
42
|
+
exit 1
|
43
|
+
elsif !frank_dir_already_exists && update_mode
|
44
|
+
puts "There isn't a Frank subdirectory here for me to update.\n\nIf you want to create a new Frank subdirectory containing the Frank server code and an initial Cucumber setup then you should run `frank-skeleton` with no arguments"
|
45
|
+
exit 2
|
46
|
+
end
|
20
47
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
48
|
+
if update_mode
|
49
|
+
update_server_files
|
50
|
+
else
|
51
|
+
create_skeleton_dir
|
52
|
+
end
|