asgit 0.0.2 → 0.0.3
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 +4 -4
- data/lib/asgit/config.rb +14 -4
- data/lib/asgit/version.rb +1 -1
- data/spec/asgit/config_spec.rb +24 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f65ffd8d253ea3d44fe78e58222c82634b21478
|
4
|
+
data.tar.gz: 79d2e45d7d8c0fcda2b7dcbb058e0d68a39c80be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 806b184a313a4eab9ca590693537b4e0c33cba0a521d160d3a55a3b95724278b7b2ff8c63c7cb31571e3c9366fe08ec9dce41d02371532edb063bcc291a26746
|
7
|
+
data.tar.gz: 3e00a8879e1155ee895d8b3c02db0130c40eadf8cece5ae0d11734c339b46c92fd144067aa0de51f84d99f1a35932840eee16f2e1e137802897525f0dd10f8de
|
data/lib/asgit/config.rb
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
module Asgit
|
2
2
|
class Config
|
3
|
+
|
4
|
+
attr_reader :service
|
3
5
|
attr_accessor :organization, :project
|
4
6
|
|
5
|
-
def service
|
6
|
-
@
|
7
|
+
def service= name
|
8
|
+
@service = Asgit::Services.send(name.to_sym)
|
7
9
|
end
|
8
10
|
|
9
|
-
def
|
10
|
-
|
11
|
+
def attributes
|
12
|
+
[ :service, :organization, :project ]
|
11
13
|
end
|
12
14
|
|
13
15
|
end
|
@@ -20,5 +22,13 @@ module Asgit
|
|
20
22
|
def config
|
21
23
|
@_config ||= Config.new
|
22
24
|
end
|
25
|
+
|
26
|
+
def configured?
|
27
|
+
config.attributes.each do |attr|
|
28
|
+
return false unless config.send(attr)
|
29
|
+
end
|
30
|
+
|
31
|
+
true
|
32
|
+
end
|
23
33
|
end
|
24
34
|
end
|
data/lib/asgit/version.rb
CHANGED
data/spec/asgit/config_spec.rb
CHANGED
@@ -34,4 +34,28 @@ describe Asgit::Config do
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
+
describe "::configured?" do
|
38
|
+
it "returns false if configuration hasn't been set" do
|
39
|
+
expect( Asgit.configured? ).to be_false
|
40
|
+
end
|
41
|
+
|
42
|
+
it "returns false if config is partially set" do
|
43
|
+
Asgit.configure do |c|
|
44
|
+
c.project = 'foo'
|
45
|
+
end
|
46
|
+
|
47
|
+
expect( Asgit.configured? ).to be_false
|
48
|
+
end
|
49
|
+
|
50
|
+
it "returns true if configuration has been set" do
|
51
|
+
Asgit.configure do |c|
|
52
|
+
c.project = 'foo'
|
53
|
+
c.organization = 'bar'
|
54
|
+
c.service = :github
|
55
|
+
end
|
56
|
+
|
57
|
+
expect( Asgit.configured? ).to be_true
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
37
61
|
end
|