speckle 0.1.3 → 0.1.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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- N2UzZDM1NWI2ZDUzYWRiM2M0MDk3OWUwYzc1Zjc0ZGVlYjQ2NzYxNg==
4
+ MzY3MDJkNzRiOWQ1NWQ5YTQ1NjQyYzVlNjFiN2NlYjM2ZDc2YWJmZQ==
5
5
  data.tar.gz: !binary |-
6
- ZjFiNmMyNGZkODFkYjA4YmFlMzUxMjYyMjI1NTczZmFjNDljYWEyYg==
6
+ ZGMxNTE2MDI2NDQ5OGE3MTUwNjE3MWQ3ZTk4ZjRjZmYyMjgzMDUyMA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NDVmMjVlZTZkZTcxYjZlMjExZDgzNTQ2NzUxZWQxNTc0ZjA0ZWU1NGM1ODk2
10
- OTA2MDgwNWRhMmFiMWVjNDBlM2M3Y2M2N2U5YjZlMjYxMjI1NGQ2MTlmMDFl
11
- YzlhOTFlYzgxZTQ2NGZhZjRiYjE1ODhlYTIxMDFjY2M5YjU3ZjM=
9
+ YjA5M2I4ZmUzMmQwYjk2ZjdjNmZjODE1ZmZiMzhiODljYTBjNDIxNTZlYTdh
10
+ NzMyOTE3YjFhOTgxNGMyYjMwOTM0NWVlNmVhYWEyNDdjODFlNDU4OTRiNGJh
11
+ ZTY5MDBmZmMzNjE5MWVkOWEzN2Y0ZGFkYzdhZWFkMjY1NjY0YmI=
12
12
  data.tar.gz: !binary |-
13
- NDJjZGY1Y2YyNGI0M2I3OTE1ZTA4OTRjNzg0MjczYTExNmIwMGZiOWQ4ZWUx
14
- MzM4NGZhZTc1MGJlZjY3ODQyODQ1MTQ2ZGRkYWZmOTZmN2I1NGEyZWMxNWQ4
15
- YWZkYmI0NDcyMDc5YzM2NzBhMDE1OTQzNGNkZDA0NWJkNDc0MjQ=
13
+ Mjk4MDM3N2NlMWEyMzk3NDJhMDY3ZTNhYTYwYzE3MjhlOTcwZjI3YzE0MDE3
14
+ MmRlMjU1MTBkOGZiYWZlNjZkNTAwNDU5MzM0Mzg3MjJkNjBmYTg3YmU1MmIz
15
+ Y2JkYjQ0YjUyNTgyMTg4NzU5NzA5NWRlMTAwNzg5OWFiODNjMjE=
data/Rakefile CHANGED
@@ -34,6 +34,8 @@ namespace :speckle do
34
34
  SKIP_VIMRC = ENV['SKIP_VIMRC'] == '1' || false
35
35
  COLORIZE = ENV['COLORIZE'] || 1
36
36
  BAIL = ENV['BAIL'] || 0
37
+ TAG = ENV['TAG'] || false
38
+ CI = ENV['CI'] || false
37
39
 
38
40
  # speckle sources
39
41
  SPECKLE_DIR = File.dirname(__FILE__)
@@ -61,6 +63,7 @@ namespace :speckle do
61
63
  TEST_VIM = ENV['TEST_VIM'] || 'vim'
62
64
  TEST_REPORTER = ENV['TEST_REPORTER'] || 'spec'
63
65
  TEST_LOG = "#{BUILD_DIR}/speckle.log"
66
+ DEBUG_LOG = "#{BUILD_DIR}/debug.log"
64
67
  TEST_SOURCES = FileList.new do |fl|
65
68
  sources = ENV['TEST_SOURCES']
66
69
  if sources
@@ -72,7 +75,6 @@ namespace :speckle do
72
75
  fl.include('spec/**/*_spec.riml')
73
76
  end
74
77
  end
75
-
76
78
  TEST_COMPILED = FileList.new do |fl|
77
79
  fl.exclude("#{SPECKLE_OUTPUT}")
78
80
  compiled = ENV['TEST_COMPILED']
@@ -86,6 +88,22 @@ namespace :speckle do
86
88
  end
87
89
  end
88
90
 
91
+ TAGGED_TEST_SOURCES = FileList.new do |fl|
92
+ TEST_SOURCES.each do |s|
93
+ if TAG and File.readlines(s).grep(Regexp.new(TAG)).size > 0
94
+ fl.include(s)
95
+ end
96
+ end
97
+ end
98
+
99
+ TAGGED_TEST_COMPILED = FileList.new do |fl|
100
+ TEST_SOURCES.each do |s|
101
+ if TAG and File.readlines(s).grep(Regexp.new(TAG)).size > 0
102
+ fl.include("#{BUILD_DIR}/#{s.ext('vim')}")
103
+ end
104
+ end
105
+ end
106
+
89
107
  desc 'All tasks'
90
108
  task :all => [:clean, :compile, :compile_tests, :test]
91
109
 
@@ -122,7 +140,7 @@ namespace :speckle do
122
140
 
123
141
  desc "Compile specs"
124
142
  task :compile_tests => [:build] do
125
- TEST_SOURCES.each do |t|
143
+ get_test_sources.each do |t|
126
144
  verbose VERBOSE do
127
145
  puts "Compiling: #{t} "
128
146
  sh "bundle exec riml -c #{t} -I #{TEST_LIBS}"
@@ -147,7 +165,9 @@ namespace :speckle do
147
165
 
148
166
  desc 'Shows vim --version'
149
167
  task :vim_version do
150
- sh "#{TEST_VIM} --version"
168
+ if CI
169
+ sh "#{TEST_VIM} --version"
170
+ end
151
171
  end
152
172
 
153
173
  desc "Launch test runner"
@@ -167,6 +187,22 @@ namespace :speckle do
167
187
  puts '--- TODO ---'
168
188
  end
169
189
 
190
+ def get_test_sources
191
+ if TAG
192
+ return TAGGED_TEST_SOURCES
193
+ else
194
+ return TEST_SOURCES
195
+ end
196
+ end
197
+
198
+ def get_test_compiled
199
+ if TAG
200
+ return TAGGED_TEST_COMPILED
201
+ else
202
+ return TEST_COMPILED
203
+ end
204
+ end
205
+
170
206
  def get_vim_options
171
207
  cmd = ''
172
208
  if SKIP_VIMRC
@@ -198,19 +234,28 @@ namespace :speckle do
198
234
  source #{SPECKLE_OUTPUT}
199
235
  CMD
200
236
 
201
- TEST_COMPILED.each do |t|
237
+ get_test_compiled.each do |t|
202
238
  launch_cmd += <<CMD
203
239
  source #{t}
204
240
  CMD
205
241
  end
206
242
 
207
243
  launch_cmd += <<CMD
244
+ let &verbosefile = '#{DEBUG_LOG}'
208
245
  let g:speckle_file_mode = 1
209
246
  let g:speckle_output_file = '#{TEST_LOG}'
210
247
  let g:speckle_reporter_name = '#{TEST_REPORTER}'
211
248
  let g:speckle_slow_threshold = #{SLOW_THRESHOLD}
212
249
  let g:speckle_colorize = #{COLORIZE}
213
250
  let g:speckle_bail = #{BAIL}
251
+ CMD
252
+ if TAG
253
+ launch_cmd += <<CMD
254
+ let g:speckle_tag = '#{TAG}'
255
+ CMD
256
+ end
257
+
258
+ launch_cmd += <<CMD
214
259
  let speckle = g:SpeckleConstructor()
215
260
  :autocmd VimEnter * :call speckle.run()
216
261
  :q!
@@ -4,6 +4,7 @@ class Runner
4
4
  self.halt = false
5
5
  self.stopped = false
6
6
  self.bail = false
7
+ self.tag = ''
7
8
  end
8
9
 
9
10
  defm set_bail(bail)
@@ -14,6 +15,14 @@ class Runner
14
15
  return self.bail
15
16
  end
16
17
 
18
+ defm set_tag(tag)
19
+ self.tag = tag
20
+ end
21
+
22
+ defm get_tag()
23
+ return self.tag
24
+ end
25
+
17
26
  defm add(spec)
18
27
  add(self.specs, spec)
19
28
  end
@@ -31,6 +40,7 @@ class Runner
31
40
 
32
41
  spec_runner = new SpecRunner(spec)
33
42
  spec_runner.set_bail(self.get_bail())
43
+ spec_runner.set_tag(self.get_tag())
34
44
  spec_runner.start(reporter, stats)
35
45
 
36
46
  if spec_runner.has_bailed()
@@ -5,12 +5,17 @@ class SpecRunner
5
5
  self.stopped = false
6
6
  self.bail = false
7
7
  self.bailed = false
8
+ self.tag = ''
8
9
  end
9
10
 
10
11
  defm set_bail(bail)
11
12
  self.bail = bail
12
13
  end
13
14
 
15
+ defm set_tag(tag)
16
+ self.tag = tag
17
+ end
18
+
14
19
  defm has_bailed()
15
20
  return self.bailed
16
21
  end
@@ -27,7 +32,7 @@ class SpecRunner
27
32
  break
28
33
  end
29
34
 
30
- if method =~ '^it'
35
+ if self.can_run_test_for(method)
31
36
  timer = new SpecTimer()
32
37
  meta = new SpecMeta(context, method)
33
38
 
@@ -93,4 +98,20 @@ class SpecRunner
93
98
  self.stopped = true
94
99
  end
95
100
 
101
+ defm is_test_method(method)
102
+ return method =~ '^it'
103
+ end
104
+
105
+ defm is_method_tagged(method)
106
+ return method =~ "_#{self.tag}$"
107
+ end
108
+
109
+ defm can_run_test_for(method)
110
+ if self.tag == ''
111
+ return self.is_test_method(method)
112
+ else
113
+ return self.is_test_method(method) && self.is_method_tagged(method)
114
+ end
115
+ end
116
+
96
117
  end
@@ -25,6 +25,7 @@ module Speckle
25
25
  options.slow_threshold = 10
26
26
  options.colorize = true
27
27
  options.bail = false
28
+ options.tag = nil
28
29
 
29
30
  parser = OptionParser.new do |opts|
30
31
  options.opts = opts
@@ -58,6 +59,10 @@ module Speckle
58
59
  options.grep_invert = true
59
60
  end
60
61
 
62
+ opts.on('--tag <tag>', 'Only run tests matching tag') do |tag|
63
+ options.tag = tag
64
+ end
65
+
61
66
  opts.on('-r', '--reporter <reporter>', 'Specify the reporter to use (spec, min, dot, tap)') do |reporter|
62
67
  options.reporter = reporter.strip
63
68
  end
@@ -58,6 +58,7 @@ module Speckle
58
58
  rake_env('SKIP_VIMRC', to_int(@options.skip_vimrc))
59
59
  rake_env('COLORIZE', to_int(@options.colorize))
60
60
  rake_env('BAIL', to_int(@options.bail))
61
+ rake_env('TAG', @options.tag)
61
62
 
62
63
  if @options.verbose
63
64
  rake_env('VERBOSE', 'yes')
@@ -1,3 +1,3 @@
1
1
  module Speckle
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
data/lib/speckle.riml CHANGED
@@ -52,7 +52,8 @@ class Speckle
52
52
  \ 'reporter_name': '"spec"',
53
53
  \ 'slow_threshold': '10',
54
54
  \ 'colorize': '1',
55
- \ 'bail': '0'
55
+ \ 'bail': '0',
56
+ \ 'tag': '""'
56
57
  \}
57
58
 
58
59
  self.options(options_map)
@@ -112,6 +113,10 @@ class Speckle
112
113
  defm get_bail
113
114
  return g:speckle_bail
114
115
  end
116
+
117
+ defm get_tag
118
+ return g:speckle_tag
119
+ end
115
120
 
116
121
  defm run()
117
122
  self.configure()
@@ -120,10 +125,12 @@ class Speckle
120
125
  stats = new Statistician()
121
126
  reporter = self.get_reporter(writer)
122
127
  reporter.set_colorize_output(self.get_colorize())
128
+
123
129
  runner = new Runner()
124
130
  runner.set_bail(self.get_bail())
125
- functions = ''
131
+ runner.set_tag(self.get_tag())
126
132
 
133
+ functions = ''
127
134
  :redir => functions
128
135
  :silent function /SpecConstructor$/
129
136
  :redir END
@@ -257,6 +257,14 @@ module Speckle
257
257
  expect(['--reporter', 'min']).to yield_option_value('reporter', 'min')
258
258
  end
259
259
 
260
+ it 'does not have tag by default' do
261
+ expect('').to_not have_default_option('tag')
262
+ end
263
+
264
+ it 'takes tag fram --tag' do
265
+ expect(['--tag', 'focus']).to yield_option_value('tag', 'focus')
266
+ end
267
+
260
268
  end
261
269
 
262
270
  describe 'Complete CLI options' do
@@ -0,0 +1,11 @@
1
+ riml_include 'dsl.riml'
2
+
3
+ class TaggedSpec
4
+ defm describe
5
+ return 'TaggedSpec'
6
+ end
7
+
8
+ defm it_has_a_tag_focus
9
+ expect(true).to_be_true()
10
+ end
11
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: speckle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Darshan Sawardekar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-09 00:00:00.000000000 Z
11
+ date: 2013-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: riml
@@ -166,6 +166,7 @@ files:
166
166
  - spec/matchers/within_matcher_spec.riml
167
167
  - spec/spec_helper.rb
168
168
  - spec/speckle/cli/environment_spec.rb
169
+ - spec/tagged_spec.riml
169
170
  - speckle.gemspec
170
171
  homepage: http://github.com/dsawardekar/speckle
171
172
  licenses:
@@ -209,3 +210,4 @@ test_files:
209
210
  - spec/matchers/within_matcher_spec.riml
210
211
  - spec/spec_helper.rb
211
212
  - spec/speckle/cli/environment_spec.rb
213
+ - spec/tagged_spec.riml