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 CHANGED
@@ -2,24 +2,51 @@
2
2
 
3
3
  require 'fileutils'
4
4
 
5
- frank_dir = File.join( FileUtils.pwd, "Frank" )
5
+ TARGET_DIR = File.join( FileUtils.pwd, "Frank" )
6
+ SOURCE_DIR = File.join( File.dirname(__FILE__), '..', 'frank-skeleton' )
6
7
 
7
- if File.exists?( frank_dir )
8
- puts "A Frank directory already exists. I won't overwrite it. Giving up."
9
- exit 1
10
- else
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 2 unless STDIN.gets.chomp == ''
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
- FileUtils.mkdir_p( frank_dir )
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
- source_dir = File.join( File.dirname(__FILE__), '..', 'frank-skeleton' )
38
+ frank_dir_already_exists = File.exists?( TARGET_DIR )
18
39
 
19
- FileUtils.cp_r( Dir.glob( source_dir+"/*" ), frank_dir )
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
- puts <<-EOS
22
- Frank subdirectory created.
23
- 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.
24
- After that, you can build the target and try executing 'cucumber' from the Frank directory to see how your initial cucumber test runs.
25
- EOS
48
+ if update_mode
49
+ update_server_files
50
+ else
51
+ create_skeleton_dir
52
+ end
@@ -1,5 +1,5 @@
1
1
  module Frank
2
2
  module Cucumber
3
- VERSION = "0.7.6"
3
+ VERSION = "0.7.7"
4
4
  end
5
5
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 7
8
- - 6
9
- version: 0.7.6
8
+ - 7
9
+ version: 0.7.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Pete Hodgson