git-contest 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ODQ5ZTNkNDU1NGQ2ZDRjMzNmZGFiMDA4MGRjZWZhOTAyOWMxY2IzNA==
4
+ MjRlYzRhYjdlNmFhMTFkNjc3ZmM2MWFjNTYyODM5MmNmNmYzNzdhNQ==
5
5
  data.tar.gz: !binary |-
6
- N2IxY2NlNTE3YzM4ZTZkODczNGVkY2ZkMjgzZmZlN2Q4ZjQ3N2EyZg==
6
+ Mjk1M2JlNTdjY2RiZjM1ZjM5NDczYTQyNDE0ZmY1ZjJlZjZmODZiYQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OTc0NzdjODQ1Y2YxZWE4MDQ4OGUxOWZlNzU1NDVhYTE4OTAwNTU4MzlmMThl
10
- NDY5Nzg2MDIzY2M0OWIxNTA4MTE0YTZhNTVjZWQwMDE3NmE5NDQzNDU0MjVj
11
- YTU3YmY3NGQxNzE2ZGI1ZWRmZjRlMGE1MTU4YjhjYzM4MDNmNWU=
9
+ ZDEyMGUwZmNjNzcxMzZhMmM2YzM0MzhmNzY4NWMzMWJkYzgxYWZhMjZlZDZm
10
+ Nzg3Mzk4MzUzZmM2MWE0Mzg4ZmM0ZDE3YTE2ZGI5YjI2YmNlZGNkNzg2YTI4
11
+ OGY0ZjJkZjg0ZjA0Njk0OWQ5MmRjMjZiMDhiZGRjZDc2MmU1YTk=
12
12
  data.tar.gz: !binary |-
13
- YmViMThlMmExYmI5ZTY1Zjc3MGI0ZDJiNTQ4ZTMyNDdkYzY2NWY5Nzc3Njcy
14
- M2ViODNjMWMzNTkzNzQwY2RjZWIyYmQwYmZjNTJkNzUzNDNiN2IxNTI4Zjk2
15
- YTkzNWNhZmY1ZGJiOGM5M2I0NzE5NDRhNGM0YjMzOWI4NzJhZDk=
13
+ ODc4YjM4MTM3MmY5MGNiYTliZmNjNzYzZDVmYWE3NDc1ODdlZmI1ZTgzN2Uw
14
+ MDA0ZThkZGJjODExZmY4MmFjYjEwM2M3MzJiMTZkZmNkMjg2MmZkMzVmN2Zj
15
+ OTAzMmVkZTUxY2QyZGM2OWI4ZjZjNDQ5NWFhMzEzYTAyYjM3MmQ=
@@ -43,6 +43,8 @@ end
43
43
 
44
44
  def get_config
45
45
  config_path = File.expand_path($git_contest_config)
46
- YAML.load_file config_path
46
+ res = YAML.load_file(config_path) || {}
47
+ res["sites"] ||= {}
48
+ res
47
49
  end
48
50
 
@@ -7,6 +7,6 @@
7
7
 
8
8
  module Git
9
9
  module Contest
10
- VERSION = "0.2.5"
10
+ VERSION = "0.2.6"
11
11
  end
12
12
  end
@@ -0,0 +1,50 @@
1
+ require "spec_helper"
2
+
3
+ describe "Common" do
4
+
5
+ describe "get_config" do
6
+
7
+ let(:tmp_dir) { ::Dir.mktmpdir }
8
+
9
+ before do
10
+ $git_contest_config = File.join(tmp_dir, "config.yml")
11
+ end
12
+
13
+ after do
14
+ ::FileUtils.rm_r tmp_dir
15
+ end
16
+
17
+ context "empty file" do
18
+
19
+ before do
20
+ ::FileUtils.touch $git_contest_config
21
+ end
22
+
23
+ example do
24
+ expect do
25
+ config = get_config
26
+ config["sites"]["foo"] = "bar"
27
+ end.to_not raise_error
28
+ end
29
+
30
+ end
31
+
32
+ context "valid yaml" do
33
+
34
+ before do
35
+ ::File.write $git_contest_config, {
36
+ }.to_yaml
37
+ end
38
+
39
+ example do
40
+ expect do
41
+ config = get_config
42
+ config["sites"]["foo"] = "bar"
43
+ end.to_not raise_error
44
+ end
45
+
46
+ end
47
+
48
+ end
49
+
50
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-contest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroyuki Sano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-12 00:00:00.000000000 Z
11
+ date: 2015-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mechanize
@@ -232,6 +232,7 @@ files:
232
232
  - spec/contest_driver/t003_uva_online_judge_spec.rb
233
233
  - spec/contest_driver/t010_kattis_spec.rb
234
234
  - spec/contest_driver/t011_utils_spec.rb
235
+ - spec/lib/common_spec.rb
235
236
  - spec/mock/default_config/config.yml
236
237
  - spec/mock/default_config/plugins/dummy_driver.rb
237
238
  - spec/mock/t001/002.status_log.xml
@@ -297,6 +298,7 @@ test_files:
297
298
  - spec/contest_driver/t003_uva_online_judge_spec.rb
298
299
  - spec/contest_driver/t010_kattis_spec.rb
299
300
  - spec/contest_driver/t011_utils_spec.rb
301
+ - spec/lib/common_spec.rb
300
302
  - spec/mock/default_config/config.yml
301
303
  - spec/mock/default_config/plugins/dummy_driver.rb
302
304
  - spec/mock/t001/002.status_log.xml