subelsky_power_tools 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG ADDED
@@ -0,0 +1,7 @@
1
+ v1.0.2
2
+ ======
3
+ * Added environment variable enforcer; I use this all the time in rake tasks
4
+
5
+ v1.0.1
6
+ ======
7
+ * Added Kernel#retryable for exception retrying
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- subelsky_power_tools (1.0.0)
4
+ subelsky_power_tools (1.0.1)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
data/README.md CHANGED
@@ -17,6 +17,7 @@ added, by requiring them individually, e.g.:
17
17
 
18
18
  require 'subelsky_power_tools/ext/hash'
19
19
  require 'subelsky_power_tools/ext/exception'
20
+ require 'subelsky_power_tools/ext/kernel'
20
21
 
21
22
  See the individual extensions in `lib` or their tests in the `spec` directory.
22
23
 
@@ -0,0 +1,11 @@
1
+ module SubelskyPowerTools::Environment
2
+ extend self
3
+
4
+ def enforce_variables(*vals)
5
+ msg = "Must specify #{vals.map(&:upcase).join(",")}"
6
+
7
+ vals.each do |val|
8
+ fail msg if ENV[val].to_s.strip.empty?
9
+ end
10
+ end
11
+ end
@@ -1,3 +1,3 @@
1
1
  module SubelskyPowerTools
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
@@ -0,0 +1,26 @@
1
+ require "spec_helper"
2
+ require "subelsky_power_tools/environment"
3
+
4
+ describe SubelskyPowerTools::Environment do
5
+ def conduct_test(val1 = "shaz",val2 = "bot")
6
+ ENV['_SPT_EE_TEST_VALUE1'] = val1
7
+ ENV['_SPT_EE_TEST_VALUE2'] = val2
8
+ SubelskyPowerTools::Environment.enforce_variables('_SPT_EE_TEST_VALUE1','_SPT_EE_TEST_VALUE2')
9
+ end
10
+
11
+ it "succeeds if all specified variables are non-blank" do
12
+ expect { conduct_test }.not_to raise_error
13
+ end
14
+
15
+ it "fails the program if any specified variable is blank" do
16
+ expect { conduct_test(" ","bot") }.to raise_error(RuntimeError)
17
+ end
18
+
19
+ it "fails the program if any specified variable is zero-width" do
20
+ expect { conduct_test("shaz","") }.to raise_error(RuntimeError)
21
+ end
22
+
23
+ it "fails the program if any specified variable is nil" do
24
+ expect { conduct_test("",nil) }.to raise_error(RuntimeError)
25
+ end
26
+ end
File without changes
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: subelsky_power_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,12 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-08-01 00:00:00.000000000 -04:00
12
+ date: 2011-08-12 00:00:00.000000000 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
17
- requirement: &2153319800 !ruby/object:Gem::Requirement
17
+ requirement: &2156325000 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,7 +22,7 @@ dependencies:
22
22
  version: '0'
23
23
  type: :development
24
24
  prerelease: false
25
- version_requirements: *2153319800
25
+ version_requirements: *2156325000
26
26
  description: ! "This is a collection of Ruby extensions and utilities I've been carting
27
27
  around from project to project. \nMany are taken from the Facets project (I just
28
28
  don't want to include that whole gem in my codebases).\n"
@@ -35,6 +35,7 @@ files:
35
35
  - .gitignore
36
36
  - .rspec
37
37
  - .rvmrc
38
+ - CHANGELOG
38
39
  - Gemfile
39
40
  - Gemfile.lock
40
41
  - Guardfile
@@ -42,13 +43,15 @@ files:
42
43
  - README.md
43
44
  - Rakefile
44
45
  - lib/subelsky_power_tools.rb
46
+ - lib/subelsky_power_tools/environment.rb
45
47
  - lib/subelsky_power_tools/ext/exception.rb
46
48
  - lib/subelsky_power_tools/ext/hash.rb
47
49
  - lib/subelsky_power_tools/ext/kernel.rb
48
50
  - lib/subelsky_power_tools/version.rb
49
- - spec/exception_spec.rb
50
- - spec/hash_spec.rb
51
- - spec/kernel_spec.rb
51
+ - spec/lib/environment_spec.rb
52
+ - spec/lib/ext/exception_spec.rb
53
+ - spec/lib/ext/hash_spec.rb
54
+ - spec/lib/ext/kernel_spec.rb
52
55
  - spec/spec_helper.rb
53
56
  - subelsky_power_tools.gemspec
54
57
  has_rdoc: true
@@ -80,7 +83,8 @@ specification_version: 3
80
83
  summary: This is a collection of Ruby extensions and utilities I've been carting around
81
84
  from project to project.
82
85
  test_files:
83
- - spec/exception_spec.rb
84
- - spec/hash_spec.rb
85
- - spec/kernel_spec.rb
86
+ - spec/lib/environment_spec.rb
87
+ - spec/lib/ext/exception_spec.rb
88
+ - spec/lib/ext/hash_spec.rb
89
+ - spec/lib/ext/kernel_spec.rb
86
90
  - spec/spec_helper.rb