fail_fast 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. data/.gitignore +2 -0
  2. data/.rvmrc +1 -0
  3. data/CHANGELOG.txt +9 -0
  4. data/Gemfile +3 -0
  5. data/README.markdown +15 -1
  6. data/Rakefile +8 -36
  7. data/fail_fast.gemspec +22 -107
  8. data/lib/fail_fast/base/base.rb +1 -1
  9. data/lib/fail_fast/base/messaging.rb +1 -1
  10. data/lib/fail_fast/base/utils.rb +3 -2
  11. data/lib/fail_fast/base/z_only_for_tests.rb +2 -2
  12. data/lib/fail_fast/extensions/directory_exists.rb +41 -0
  13. data/lib/fail_fast/extensions/file_exists.rb +41 -0
  14. data/lib/fail_fast/extensions/{check_active_record_db.rb → has_active_record_db.rb} +4 -2
  15. data/lib/fail_fast/extensions/{check_email.rb → has_email.rb} +7 -5
  16. data/lib/fail_fast/extensions/{check_mongo_db.rb → has_mongo_db.rb} +13 -9
  17. data/lib/fail_fast/extensions/{check_url.rb → has_url.rb} +8 -6
  18. data/lib/fail_fast/extensions/{check_value.rb → has_value.rb} +3 -3
  19. data/lib/fail_fast/extensions/{check_is_on_path.rb → is_on_path.rb} +10 -6
  20. data/lib/fail_fast/main.rb +1 -1
  21. data/lib/fail_fast/support/error_db.rb +1 -1
  22. data/lib/fail_fast/support/error_details.rb +2 -2
  23. data/lib/fail_fast/support/z_only_for_tests.rb +1 -1
  24. data/spec/base/base_commands/fail_spec.rb +7 -0
  25. data/spec/base/base_commands/failed_spec.rb +19 -0
  26. data/spec/base/base_commands/only_if_spec.rb +15 -0
  27. data/spec/base/base_commands/skip_if_spec.rb +29 -0
  28. data/spec/base/errors_storage_spec.rb +1 -1
  29. data/spec/base/multiple_blocks_support_spec.rb +3 -3
  30. data/spec/base/{not_linked_to_a_file_spec.rb → not_linked_to_a_config_file_spec.rb} +3 -3
  31. data/spec/base/{file_is_empty_spec.rb → when_config_file_is_empty_spec.rb} +3 -3
  32. data/spec/base/{file_is_missing_spec.rb → when_config_file_is_missing_spec.rb} +2 -2
  33. data/spec/extensions/{check_file_system_spec.rb → file_or_directory_exists_spec.rb} +18 -2
  34. data/spec/extensions/{check_active_record_db_spec.rb → has_active_record_db_spec.rb} +11 -6
  35. data/spec/extensions/{check_email_spec.rb → has_email_spec.rb} +11 -6
  36. data/spec/extensions/{check_mongo_db_spec.rb → has_mongoDB_spec.rb} +28 -9
  37. data/spec/extensions/{check_url_spec.rb → has_url_spec.rb} +4 -1
  38. data/spec/extensions/{check_value_spec.rb → has_value_spec.rb} +15 -11
  39. data/spec/extensions/{check_is_on_path_spec.rb → is_on_path_spec.rb} +9 -5
  40. data/spec/spec_helper.rb +39 -4
  41. metadata +78 -55
  42. data/VERSION +0 -1
  43. data/lib/fail_fast/extensions/check_file_system.rb +0 -67
  44. data/spec/base/base_commands_spec.rb +0 -67
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fail_fast
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
5
- prerelease: false
4
+ hash: 15
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 1
10
- version: 0.5.1
9
+ - 2
10
+ version: 0.5.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Alain Ravet
@@ -15,29 +15,29 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-29 00:00:00 +02:00
19
- default_executable:
18
+ date: 2011-06-16 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
- name: rspec
23
21
  prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
22
+ name: rspec
23
+ type: :development
24
+ version_requirements: &id001 !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ">="
27
+ - - "="
28
28
  - !ruby/object:Gem::Version
29
- hash: 13
29
+ hash: 31
30
30
  segments:
31
31
  - 1
32
+ - 3
32
33
  - 2
33
- - 9
34
- version: 1.2.9
35
- type: :development
36
- version_requirements: *id001
34
+ version: 1.3.2
35
+ requirement: *id001
37
36
  - !ruby/object:Gem::Dependency
38
- name: activerecord
39
37
  prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
38
+ name: activerecord
39
+ type: :development
40
+ version_requirements: &id002 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - ">="
@@ -46,12 +46,12 @@ dependencies:
46
46
  segments:
47
47
  - 0
48
48
  version: "0"
49
- type: :development
50
- version_requirements: *id002
49
+ requirement: *id002
51
50
  - !ruby/object:Gem::Dependency
52
- name: mongo
53
51
  prerelease: false
54
- requirement: &id003 !ruby/object:Gem::Requirement
52
+ name: mongo
53
+ type: :development
54
+ version_requirements: &id003 !ruby/object:Gem::Requirement
55
55
  none: false
56
56
  requirements:
57
57
  - - ">="
@@ -60,10 +60,23 @@ dependencies:
60
60
  segments:
61
61
  - 0
62
62
  version: "0"
63
+ requirement: *id003
64
+ - !ruby/object:Gem::Dependency
65
+ prerelease: false
66
+ name: fakeweb
63
67
  type: :development
64
- version_requirements: *id003
65
- description: raises an error if the yaml contents of a config file does not pass a test script.
66
- email: alainravet@gmail.com
68
+ version_requirements: &id004 !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ hash: 3
74
+ segments:
75
+ - 0
76
+ version: "0"
77
+ requirement: *id004
78
+ description: raises an error if the yaml contents of a config file does pass a test script.
79
+ email: alain.ravet@gmail.com
67
80
  executables: []
68
81
 
69
82
  extensions: []
@@ -74,11 +87,12 @@ extra_rdoc_files:
74
87
  files:
75
88
  - .document
76
89
  - .gitignore
90
+ - .rvmrc
77
91
  - CHANGELOG.txt
92
+ - Gemfile
78
93
  - LICENSE
79
94
  - README.markdown
80
95
  - Rakefile
81
- - VERSION
82
96
  - fail_fast.gemspec
83
97
  - lib/fail_fast.rb
84
98
  - lib/fail_fast/base/base.rb
@@ -86,41 +100,44 @@ files:
86
100
  - lib/fail_fast/base/utils.rb
87
101
  - lib/fail_fast/base/z_only_for_tests.rb
88
102
  - lib/fail_fast/extensions/base_commands.rb
89
- - lib/fail_fast/extensions/check_active_record_db.rb
90
- - lib/fail_fast/extensions/check_email.rb
91
- - lib/fail_fast/extensions/check_file_system.rb
92
- - lib/fail_fast/extensions/check_is_on_path.rb
93
- - lib/fail_fast/extensions/check_mongo_db.rb
94
- - lib/fail_fast/extensions/check_url.rb
95
- - lib/fail_fast/extensions/check_value.rb
103
+ - lib/fail_fast/extensions/directory_exists.rb
104
+ - lib/fail_fast/extensions/file_exists.rb
105
+ - lib/fail_fast/extensions/has_active_record_db.rb
106
+ - lib/fail_fast/extensions/has_email.rb
107
+ - lib/fail_fast/extensions/has_mongo_db.rb
108
+ - lib/fail_fast/extensions/has_url.rb
109
+ - lib/fail_fast/extensions/has_value.rb
110
+ - lib/fail_fast/extensions/is_on_path.rb
96
111
  - lib/fail_fast/main.rb
97
112
  - lib/fail_fast/report.txt.erb
98
113
  - lib/fail_fast/support/error_db.rb
99
114
  - lib/fail_fast/support/error_details.rb
100
115
  - lib/fail_fast/support/z_only_for_tests.rb
101
116
  - show_all_errors.rb
102
- - spec/base/base_commands_spec.rb
117
+ - spec/base/base_commands/fail_spec.rb
118
+ - spec/base/base_commands/failed_spec.rb
119
+ - spec/base/base_commands/only_if_spec.rb
120
+ - spec/base/base_commands/skip_if_spec.rb
103
121
  - spec/base/error_details_spec.rb
104
122
  - spec/base/errors_storage_spec.rb
105
- - spec/base/file_is_empty_spec.rb
106
- - spec/base/file_is_missing_spec.rb
107
123
  - spec/base/multiple_blocks_support_spec.rb
108
- - spec/base/not_linked_to_a_file_spec.rb
124
+ - spec/base/not_linked_to_a_config_file_spec.rb
109
125
  - spec/base/report_printing_spec.rb
110
- - spec/extensions/check_active_record_db_spec.rb
111
- - spec/extensions/check_email_spec.rb
112
- - spec/extensions/check_file_system_spec.rb
113
- - spec/extensions/check_is_on_path_spec.rb
114
- - spec/extensions/check_mongo_db_spec.rb
115
- - spec/extensions/check_url_spec.rb
116
- - spec/extensions/check_value_spec.rb
126
+ - spec/base/when_config_file_is_empty_spec.rb
127
+ - spec/base/when_config_file_is_missing_spec.rb
128
+ - spec/extensions/file_or_directory_exists_spec.rb
129
+ - spec/extensions/has_active_record_db_spec.rb
130
+ - spec/extensions/has_email_spec.rb
131
+ - spec/extensions/has_mongoDB_spec.rb
132
+ - spec/extensions/has_url_spec.rb
133
+ - spec/extensions/has_value_spec.rb
134
+ - spec/extensions/is_on_path_spec.rb
117
135
  - spec/extensions/key_prefix_spec.rb
118
136
  - spec/fixtures/empty.yml
119
137
  - spec/fixtures/simple.yml
120
138
  - spec/how_to_use_spec.rb
121
139
  - spec/spec.opts
122
140
  - spec/spec_helper.rb
123
- has_rdoc: true
124
141
  homepage: http://github.com/alainravet/fail_fast
125
142
  licenses: []
126
143
 
@@ -150,26 +167,32 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
167
  requirements: []
151
168
 
152
169
  rubyforge_project:
153
- rubygems_version: 1.3.7
170
+ rubygems_version: 1.7.2
154
171
  signing_key:
155
172
  specification_version: 3
156
173
  summary: raises an error if the yaml contents of a config file does pass a test script.
157
174
  test_files:
158
- - spec/base/base_commands_spec.rb
175
+ - spec/base/base_commands/fail_spec.rb
176
+ - spec/base/base_commands/failed_spec.rb
177
+ - spec/base/base_commands/only_if_spec.rb
178
+ - spec/base/base_commands/skip_if_spec.rb
159
179
  - spec/base/error_details_spec.rb
160
180
  - spec/base/errors_storage_spec.rb
161
- - spec/base/file_is_empty_spec.rb
162
- - spec/base/file_is_missing_spec.rb
163
181
  - spec/base/multiple_blocks_support_spec.rb
164
- - spec/base/not_linked_to_a_file_spec.rb
182
+ - spec/base/not_linked_to_a_config_file_spec.rb
165
183
  - spec/base/report_printing_spec.rb
166
- - spec/extensions/check_active_record_db_spec.rb
167
- - spec/extensions/check_email_spec.rb
168
- - spec/extensions/check_file_system_spec.rb
169
- - spec/extensions/check_is_on_path_spec.rb
170
- - spec/extensions/check_mongo_db_spec.rb
171
- - spec/extensions/check_url_spec.rb
172
- - spec/extensions/check_value_spec.rb
184
+ - spec/base/when_config_file_is_empty_spec.rb
185
+ - spec/base/when_config_file_is_missing_spec.rb
186
+ - spec/extensions/file_or_directory_exists_spec.rb
187
+ - spec/extensions/has_active_record_db_spec.rb
188
+ - spec/extensions/has_email_spec.rb
189
+ - spec/extensions/has_mongoDB_spec.rb
190
+ - spec/extensions/has_url_spec.rb
191
+ - spec/extensions/has_value_spec.rb
192
+ - spec/extensions/is_on_path_spec.rb
173
193
  - spec/extensions/key_prefix_spec.rb
194
+ - spec/fixtures/empty.yml
195
+ - spec/fixtures/simple.yml
174
196
  - spec/how_to_use_spec.rb
197
+ - spec/spec.opts
175
198
  - spec/spec_helper.rb
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.5.1
@@ -1,67 +0,0 @@
1
- class FailFast
2
- module CheckFileSystem
3
-
4
- # Ensure the value is an existing directory
5
- #
6
- # Usage
7
- # directory_exists '/tmp'
8
- # directory_exists '/tmp', :message => 'custom message'
9
- #
10
- def directory_exists(path, options={})
11
- unless File.exists?(path) && File.directory?(path)
12
- add_error ErrorDetails.new(nil, :directory_not_found, path, options[:message])
13
- end
14
- end
15
-
16
- # Ensure the value is an existing file
17
- #
18
- # Usage
19
- # file_exists '~/.bash_profile'
20
- # file_exists '~/.bash_profile', :message => 'custom message'
21
- #
22
- def file_exists(path, options={})
23
- unless File.exists?(path) && File.file?(path)
24
- add_error ErrorDetails.new(nil, :file_not_found, path, options[:message])
25
- end
26
- end
27
-
28
- # Ensure the key value is an existing directory
29
- #
30
- # Usage
31
- # directory_exists_for 'foo/config'
32
- # directory_exists_for 'foo/config', :message => 'custom message'
33
- #
34
- def directory_exists_for(raw_key, *params)
35
- p = key_value_regexp_options(raw_key, params)
36
- key, options = p.key, p.options
37
-
38
- return unless has_value_for raw_key, :message => options[:message]
39
-
40
- path = value_for_deep_key(key)
41
- unless File.exists?(path) && File.directory?(path)
42
- add_error ErrorDetails.new(key, :directory_not_found, p.value, options[:message])
43
- end
44
- end
45
-
46
- # Ensure the key value is an existing file exists
47
- #
48
- # Usage
49
- # file_exists_for 'foo/config/app.yml'
50
- # file_exists_for 'foo/config/app.yml', :message => 'custom message'
51
- #
52
- def file_exists_for(raw_key, *params)
53
- p = key_value_regexp_options(raw_key, params)
54
- key, options = p.key, p.options
55
-
56
- return unless has_value_for raw_key, :message => options[:message]
57
-
58
- path = value_for_deep_key(key)
59
- unless File.exists?(path) && File.file?(path)
60
- add_error ErrorDetails.new(key, :file_not_found, p.value, options[:message])
61
- end
62
- end
63
-
64
- end
65
- end
66
-
67
- FailFast.send :include, FailFast::CheckFileSystem
@@ -1,67 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
-
3
- describe "fail()" do
4
- it_should_raise_a_direct_error('message-123', :fail, 'when fail() is called') {
5
- fail 'message-123'
6
- }
7
- end
8
-
9
- describe "only_if" do
10
- it_should_not_raise_an_error('only_if false does not run the block') {
11
- only_if false do
12
- fail 'never executed'
13
- end
14
- }
15
-
16
- it_should_raise_a_direct_error('message 456', :fail, 'only_if true runs the block') {
17
- only_if true do
18
- fail 'message 456'
19
- end
20
- }
21
- end
22
-
23
- describe "skip_if" do
24
- it_should_not_raise_an_error('skip_if(true) does not run the block') {
25
- skip_if true do
26
- fail 'never executed'
27
- end
28
- }
29
-
30
- it_should_raise_a_direct_error('message 456', :fail, 'skip_if(false) runs the block') {
31
- skip_if false do
32
- fail 'message 456'
33
- end
34
- }
35
- end
36
-
37
- describe "skip_if" do
38
- it_should_not_raise_an_error('skip_if(true) does not run the block') {
39
- skip_if true do
40
- fail 'never executed'
41
- end
42
- }
43
-
44
- it_should_raise_a_direct_error('message 456', :fail, 'skip_if(false) runs the block') {
45
- skip_if false do
46
- fail 'message 456'
47
- end
48
- }
49
- end
50
-
51
- describe 'failed?' do
52
- example "is false when there are no errors" do
53
- FailFast(SIMPLE_FILE_PATH ).check_now.but_fail_later {}
54
- FailFast.failed?.should be_false
55
- end
56
-
57
- example "is true when there is 1 block and 1 error" do
58
- FailFast(UNKNOWN_FILE_PATH).check_now.but_fail_later {} # <-- 1 error here
59
- FailFast.failed?.should be_true
60
- end
61
-
62
- example "is true when the error block is followed by and error-free empty file block (BUG FIX)" do
63
- FailFast(UNKNOWN_FILE_PATH).check_now.but_fail_later {} # <-- 1 error here
64
- FailFast(EMPTY_FILE_PATH ).check_now.but_fail_later {} #no errors in the last block
65
- FailFast.failed?.should be_true
66
- end
67
- end