taglob 1.0.2 → 1.1.1

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/History.txt CHANGED
@@ -1,3 +1,12 @@
1
+ === 1.1.1 / 2008-11-25
2
+ * Minor Changes
3
+ * Dir.taglob will now act like a regular glob if tags passed in is nil
4
+
5
+ === 1.1.0 / 2008-11-17
6
+ * New Feature
7
+ * TagHtmlFormatter opens up the RSpec HTML Formatter to print the tags environment variable which useful if you do something like:
8
+ $ rake spec_tag tags="foo,bar,baz" SPEC_OPTS='-r rubygems,taglob/spec/tag_html_formatter'
9
+
1
10
  === 1.0.2 / 2008-11-04
2
11
 
3
12
  * Minor Changes
data/Manifest.txt CHANGED
@@ -12,6 +12,7 @@ lib/taglob/rake.rb
12
12
  lib/taglob/rake/check_tags_task.rb
13
13
  lib/taglob/rake/tasks.rb
14
14
  lib/taglob/rake/test_tags_task.rb
15
+ lib/taglob/spec/tag_html_formatter.rb
15
16
  spec/check_tags_task_spec.rb
16
17
  spec/dir_tagor_spec.rb
17
18
  spec/missing_tags.txt
data/lib/taglob.rb CHANGED
@@ -18,7 +18,7 @@
18
18
  require 'taglob/extensions'
19
19
 
20
20
  module Taglob
21
- VERSION = '1.0.2'
21
+ VERSION = '1.1.1'
22
22
 
23
23
  def self.invalid_tags(pattern,valid_tags)
24
24
  invalids = {}
@@ -10,11 +10,9 @@ class Dir
10
10
  end
11
11
 
12
12
  def self.taglob(pattern,tags)
13
- if(tags.include?('|'))
14
- Dir.tag_or(pattern,*tags.split('|'))
15
- else
16
- Dir.tag_and(pattern,*tags.split(','))
17
- end
13
+ return glob(pattern) if tags.nil?
14
+ return Dir.tag_or(pattern,*tags.split('|')) if tags.include?('|')
15
+ Dir.tag_and(pattern,*tags.split(','))
18
16
  end
19
17
 
20
18
  def self.tag_and(pattern, *tags)
@@ -0,0 +1,24 @@
1
+ # To display tag information while running the specs
2
+ # USAGE : Set the tags first if using in command line
3
+ # $ export tags=foo then run spec with following options
4
+ #["--require rubygems,taglob/spec/tag_html_formatter --format TagHtmlFormatter:#{file_name}"]
5
+ # Example:
6
+ # $ spec --require rubygems,taglob/spec/tag_html_formatter --format TagHtmlFormatter:#{file_name}.html
7
+
8
+ require 'spec/runner/formatter/html_formatter'
9
+
10
+ class Spec::Runner::Formatter::HtmlFormatter
11
+ alias :original_report_header :report_header
12
+ alias :original_global_styles :global_styles
13
+ def report_header
14
+ if ENV['tags'].nil?
15
+ original_report_header
16
+ else
17
+ original_report_header + "<div id='tag-header'><h3>These specs contain the following tags: #{ENV['tags']}</h3></div>"
18
+ end
19
+ end
20
+
21
+ def global_styles
22
+ original_global_styles + ".rspec-report h3 {margin: 0px 10px 0px 10px; padding: 10px;font: normal 11px ,'Lucida Grande', Helvetica, sans-serif;font-size: 1.2em;}"
23
+ end
24
+ end
data/spec/taglob_spec.rb CHANGED
@@ -41,6 +41,13 @@ describe Dir do
41
41
  tagged_files.should include('spec/tagged_files/epic_lulz.rb')
42
42
  end
43
43
 
44
+ it "should act like a regular glob if tags are nil" do
45
+ pattern = 'spec/tagged_files/*.rb'
46
+ globbed_files = Dir.glob(pattern)
47
+ tagged_files = Dir.taglob('spec/tagged_files/*.rb',nil)
48
+ (tagged_files - globbed_files).should be_empty
49
+ end
50
+
44
51
  end
45
52
 
46
53
  describe File do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: taglob
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Anderson
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-11-13 00:00:00 -08:00
12
+ date: 2008-11-25 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -49,6 +49,7 @@ files:
49
49
  - lib/taglob/rake/check_tags_task.rb
50
50
  - lib/taglob/rake/tasks.rb
51
51
  - lib/taglob/rake/test_tags_task.rb
52
+ - lib/taglob/spec/tag_html_formatter.rb
52
53
  - spec/check_tags_task_spec.rb
53
54
  - spec/dir_tagor_spec.rb
54
55
  - spec/missing_tags.txt
@@ -83,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
84
  requirements: []
84
85
 
85
86
  rubyforge_project: taglob
86
- rubygems_version: 1.3.1
87
+ rubygems_version: 1.3.0
87
88
  signing_key:
88
89
  specification_version: 2
89
90
  summary: Dir.taglob selects tagged Ruby files