8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/decko/commands/rspec_command/parser.rb', line 8
def initialize opts
super() do |parser|
parser.banner = "Usage: decko rspec [DECKO ARGS] -- [RSPEC ARGS]\n\n" \
"RSPEC ARGS"
parser.separator "\n DECKO ARGS\n\n You don't have to give a full path for FILENAME, the basename is enough\n If FILENAME does not include '_spec' rspec searches for the\n corresponding spec file.\n The line number always referes to example in the (corresponding) spec\n file.\n\n EOT\n\n parser.on(\"-d\", \"--spec FILENAME(:LINE)\",\n \"Run spec for a Decko deck file\") do |file|\n opts[:files] = find_spec_file(file, \"\#{Decko.root}/mod\")\n end\n parser.on(\"-c\", \"--core-spec FILENAME(:LINE)\",\n \"Run spec for a Decko core file\") do |file|\n opts[:files] = find_spec_file(file, Cardio.gem_root)\n end\n parser.on(\"-m\", \"--mod MODNAME\",\n \"Run all specs for a mod or matching a mod\") do |file|\n opts[:files] =\n if File.exist?(\"mod/\#{file}\")\n \"\#{Cardio.gem_root}/mod/\#{file}\"\n elsif File.exist?(\"\#{Cardio.gem_root}/mod/\#{file}\")\n \"\#{Cardio.gem_root}/mod/\#{file}\"\n elsif (files = find_spec_file(file, \"mod\")) && files.present?\n files\n else\n find_spec_file(file, \"\#{Cardio.gem_root}/mod\")\n end\n end\n parser.on(\"-s\", \"--[no-]simplecov\", \"Run with simplecov\") do |s|\n opts[:simplecov] = s ? \"\" : \"COVERAGE=false\"\n end\n parser.on(\"--rescue\", \"Run with pry-rescue\") do\n if opts[:executer] == \"spring\"\n puts \"Disabled pry-rescue. Not compatible with spring.\"\n else\n opts[:rescue] = \"rescue \"\n end\n end\n parser.on(\"--[no-]spring\", \"Run with spring\") do |spring|\n if spring\n opts[:executer] = \"spring\"\n if opts[:rescue]\n opts[:rescue] = \"\"\n puts \"Disabled pry-rescue. Not compatible with spring.\"\n end\n else\n opts[:executer] = \"bundle exec\"\n end\n end\n parser.separator \"\\n\"\n end\nend\n"
|