@@ -15,36 +15,38 @@ def run
15
15
end
16
16
17
17
class Autotest
18
- def self . generate
19
- create_autotest_directory
20
- create_discover_file
21
- puts "autotest/discover.rb has been added"
22
- end
18
+ class << self
19
+ def generate
20
+ create_autotest_directory
21
+ create_discover_file
22
+ puts "autotest/discover.rb has been added"
23
+ end
23
24
24
- def self . create_autotest_directory
25
- Dir . mkdir ( 'autotest' ) unless File . exist? ( 'autotest' )
26
- end
25
+ def create_autotest_directory
26
+ Dir . mkdir ( 'autotest' ) unless File . exist? ( 'autotest' )
27
+ end
27
28
28
- def self . create_discover_file
29
- optionally_remove_discover_file if discover_file_exists?
29
+ def create_discover_file
30
+ optionally_remove_discover_file if discover_file_exists?
30
31
31
- File . open ( discover_file_path , 'w' ) do |file |
32
- file << 'Autotest.add_discovery { "rspec2" }'
32
+ File . open ( discover_file_path , 'w' ) do |file |
33
+ file << 'Autotest.add_discovery { "rspec2" }'
34
+ end
33
35
end
34
- end
35
36
36
- def optionally_remove_discover_file
37
- print "Discover file already exists, overwrite [Y/n ]? "
38
- exit if gets != 'Y'
39
- FileUtils . rm_rf ( discover_file_path )
40
- end
37
+ def optionally_remove_discover_file
38
+ print "Discover file already exists, overwrite [y/N ]? "
39
+ exit if gets !~ /y/i
40
+ FileUtils . rm_rf ( discover_file_path )
41
+ end
41
42
42
- def self . discover_file_exists?
43
- File . exist? ( discover_file_path )
44
- end
43
+ def discover_file_exists?
44
+ File . exist? ( discover_file_path )
45
+ end
45
46
46
- def self . discover_file_path
47
- File . join ( 'autotest' , 'discover.rb' )
47
+ def discover_file_path
48
+ File . join ( 'autotest' , 'discover.rb' )
49
+ end
48
50
end
49
51
end
50
52
end
0 commit comments