subelsky_power_tools 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/Gemfile.lock +1 -1
- data/lib/subelsky_power_tools/environment.rb +8 -4
- data/lib/subelsky_power_tools/version.rb +1 -1
- data/spec/lib/environment_spec.rb +7 -1
- metadata +4 -4
data/CHANGELOG
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,11 +1,15 @@
|
|
1
|
+
require "subelsky_power_tools"
|
2
|
+
|
1
3
|
module SubelskyPowerTools::Environment
|
2
4
|
extend self
|
3
5
|
|
4
|
-
def
|
5
|
-
|
6
|
+
def extract(*keys)
|
7
|
+
keys.map! { |k| k.upcase.to_s }
|
8
|
+
msg = "Must specify #{keys.join(", ")}"
|
6
9
|
|
7
|
-
|
8
|
-
fail msg if ENV[
|
10
|
+
keys.inject([]) do |total,key|
|
11
|
+
fail msg if ENV[key].to_s.strip.empty?
|
12
|
+
total << ENV[key]
|
9
13
|
end
|
10
14
|
end
|
11
15
|
end
|
@@ -5,7 +5,7 @@ describe SubelskyPowerTools::Environment do
|
|
5
5
|
def conduct_test(val1 = "shaz",val2 = "bot")
|
6
6
|
ENV['_SPT_EE_TEST_VALUE1'] = val1
|
7
7
|
ENV['_SPT_EE_TEST_VALUE2'] = val2
|
8
|
-
SubelskyPowerTools::Environment.
|
8
|
+
SubelskyPowerTools::Environment.extract(:'_spt_ee_test_value1',:'_spt_ee_test_value2')
|
9
9
|
end
|
10
10
|
|
11
11
|
it "succeeds if all specified variables are non-blank" do
|
@@ -23,4 +23,10 @@ describe SubelskyPowerTools::Environment do
|
|
23
23
|
it "fails the program if any specified variable is nil" do
|
24
24
|
expect { conduct_test("",nil) }.to raise_error(RuntimeError)
|
25
25
|
end
|
26
|
+
|
27
|
+
it "returns the value of the extracted variables" do
|
28
|
+
val1, val2 = conduct_test("alpha","beta")
|
29
|
+
val1.should == "alpha"
|
30
|
+
val2.should == "beta"
|
31
|
+
end
|
26
32
|
end
|
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
|
4
|
+
version: 1.1.0
|
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-
|
12
|
+
date: 2011-08-14 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: &
|
17
|
+
requirement: &2160525580 !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: *
|
25
|
+
version_requirements: *2160525580
|
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"
|