lucid 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/lucid/app.rb CHANGED
@@ -14,7 +14,6 @@ module Lucid
14
14
  parser = Lucid::Parser.new(@options)
15
15
 
16
16
  @specs = parser.specs
17
- #puts "[App.initialize] After calling parser for specs, I have: #{@specs.inspect}"
18
17
  @tags = parser.tags
19
18
 
20
19
  @message = "No specs were found matching the pattern '#{@options[:pattern]}'." and return unless @specs
@@ -81,8 +80,6 @@ module Lucid
81
80
  end
82
81
 
83
82
  def construct_spec_file(path, file, file_name)
84
- #puts "[App.construct_spec_file] Path = #{path} || File = #{file} || File name = #{file_name}"
85
-
86
83
  construct = ""
87
84
 
88
85
  # If the file that is passed in matches the name of the specs path
@@ -99,8 +96,6 @@ module Lucid
99
96
  construct = "#{file_name}".gsub('//', '/')
100
97
  end
101
98
 
102
- #puts "[App.construct_spec_file] Construct = #{construct}"
103
-
104
99
  construct
105
100
  end
106
101
 
data/lib/lucid/options.rb CHANGED
@@ -5,6 +5,14 @@ require 'yaml'
5
5
  module Lucid
6
6
  class Options
7
7
  def self.parse(args)
8
+ orig_args = args.dup
9
+ name = nil
10
+
11
+ if orig_args.index("--name")
12
+ name_loc = orig_args.index("--name") + 1
13
+ name = orig_args[name_loc]
14
+ end
15
+
8
16
  default_options = self.get_options(:default)
9
17
  project_options = self.get_options(:project)
10
18
  combine_options = default_options.merge(project_options)
@@ -20,7 +28,11 @@ module Lucid
20
28
  end
21
29
 
22
30
  opts.on('-o', '--options OPTIONS', "Options to pass to the tool.") do |options|
23
- combine_options[:options] = options
31
+ if options =~ (/^--name/)
32
+ combine_options[:c_options] = "#{options} \"#{name}\""
33
+ else
34
+ combine_options[:c_options] = options
35
+ end
24
36
  end
25
37
 
26
38
  opts.on('-t', '--tags TAGS', "Tags to include or exclude.") do |tags|
@@ -42,8 +54,12 @@ module Lucid
42
54
 
43
55
  # This statement is necessary to get the spec execution pattern from
44
56
  # the command line. This will not be a switch and so it will be the
45
- # only actual command line argument.
46
- combine_options[:pattern] = args.first if args.any?
57
+ # only actual command line argument. However, account must be taken
58
+ # of the potential of using the --name option, which means that the
59
+ # argument to that option will be the first argument and thus the
60
+ # second argument will be the spec execution pattern.
61
+ combine_options[:pattern] = args.first if args.count == 1
62
+ combine_options[:pattern] = args[1] if args.count == 2
47
63
 
48
64
  return self.establish(combine_options)
49
65
  end
@@ -69,12 +85,12 @@ module Lucid
69
85
  project_options
70
86
  else
71
87
  {
72
- :command => 'cucumber', # :cuke_command
73
- :options => nil, # :cucumber
74
- :spec_path => 'features', # :feature_path
88
+ :command => 'cucumber',
89
+ :options => nil,
90
+ :spec_path => 'features',
75
91
  :step_path => 'features/step_definitions',
76
92
  :requires => [],
77
- :shared => 'true', # value was 'shared'
93
+ :shared => 'true',
78
94
  :print => false,
79
95
  :tags => nil,
80
96
  :spec_path_regex => nil,
@@ -86,9 +102,13 @@ module Lucid
86
102
  end
87
103
 
88
104
  def self.establish(options)
105
+ # The next statement makes sure that any project options and command
106
+ # line options are merged.
107
+ options[:options] += " #{options[:c_options]}"
108
+
89
109
  defaults = self.get_options(:default)
90
110
 
91
- current_set = options.dup # tmp_options
111
+ current_set = options.dup
92
112
 
93
113
  current_set[:spec_path] = current_set[:spec_path].gsub(/\\/, '/')
94
114
  current_set[:spec_path] = current_set[:spec_path].sub(/\/$/, '')
data/lib/lucid/parser.rb CHANGED
@@ -6,13 +6,10 @@ module Lucid
6
6
  end
7
7
 
8
8
  def specs
9
- #puts "[Parser.specs] Is @options[:pattern] nil? #{@options[:pattern].nil?}"
10
9
  return [] if @options[:pattern].nil?
11
10
 
12
11
  set_of_specs = gather_specs_by_glob
13
12
 
14
- #puts "[Parser.specs] Were there any specs? #{set_of_specs.any?}"
15
-
16
13
  return set_of_specs.any? ? set_of_specs : nil
17
14
  end
18
15
 
@@ -90,8 +87,6 @@ module Lucid
90
87
 
91
88
  pattern = @options[:pattern].dup
92
89
 
93
- #puts "[Parser.gather_specs_by_glob] The pattern is: #{pattern}"
94
-
95
90
  # Determine if some specs were indicated to be excluded
96
91
  # and mark those separately. This also handles when only
97
92
  # specific specs are to be executed.
@@ -109,32 +104,21 @@ module Lucid
109
104
  pattern = '**/*' if except.any?
110
105
  pattern = nil if only.any?
111
106
 
112
- #puts "[Parser.gather_specs_by_glob] Is the pattern after only/except nil?: #{pattern.nil?}"
113
- #puts "[Parser.gather_specs_by_glob] The @options[:spec_path] is: #{@options[:spec_path]}"
114
-
115
107
  if only.any?
116
108
  only.each do |f|
117
- #puts "[Parser.gather_specs_by_glob] There is an only and it is: #{f}"
118
-
119
109
  #specs_to_include += Dir.glob("#{@options[:spec_path]}/#{f}.feature")
120
110
  specs_to_include += Dir.glob("#{f}")
121
111
  end
122
112
  else
123
- #puts "[Parser.gather_specs_by_glob] There is no only so pattern is: #{pattern}"
124
113
  specs_to_include += Dir.glob("#{@options[:spec_path]}/#{pattern}.feature")
125
114
  end
126
115
 
127
- #puts "[Parser.gather_specs_by_glob] After checking only, specs_to_include is: #{specs_to_include}"
128
-
129
116
  if except.any?
130
117
  except.each do |f|
131
- #puts "[Parser.gather_specs_by_glob] There is an except and it is: #{f}"
132
118
  specs_to_exclude = Dir.glob("#{@options[:spec_path]}/#{f}.feature")
133
119
  end
134
120
  end
135
121
 
136
- #puts "[Parser.gather_specs_by_glob] Returning #{specs_to_include - specs_to_exclude}"
137
-
138
122
  (specs_to_include - specs_to_exclude).uniq
139
123
  end
140
124
 
data/lib/lucid/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lucid
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lucid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-26 00:00:00.000000000 Z
12
+ date: 2013-03-09 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Execution Wrapper for Cucumber
15
15
  email: