hiroshimarb 0.2.13 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dff1bf9c792e724d5585194e1b7d52fc227e602e
4
- data.tar.gz: 12288ce6868bf93db8b79fc3d28afc931fb0ea10
3
+ metadata.gz: 82f42f5be71aa7f008b0af4abf206b4f4a6c402a
4
+ data.tar.gz: 8717344f41d7c97941de2bab2192b4b1f9047cea
5
5
  SHA512:
6
- metadata.gz: 4ec1b9c279b7421defd37e3be4d771ca8d737e452765fbae97e1bf5027346a895c2fa7a4e0fc0809ed7b862fbd9e8d7097c6fb8fa0b9bfc3e6e129b7cd9baa63
7
- data.tar.gz: 1b78313fa2e7307974248c2b5e613215c8eca201365712b552232abafdc5398766e844fac8d319d923161cf9673ca66ab9ab9bf6fc726a73fdd02897daba50ed
6
+ metadata.gz: f64e356d9806d22cac9d2d639f710041e0f116a95d7ca15993784366da520eb8956b51b1cf83c4dfa8570f2cda979f4c9c2d5353b5dd320d471e25ff6cd9d69f
7
+ data.tar.gz: 972832b38e1a127791885c3667beec14538db743fcfaf409bd856c11d8f4d9dc789e5c80026bf07f8c2a6f53234d99134f9e20f733e2035272e091539bb054f2
@@ -13,5 +13,6 @@ end
13
13
  end
14
14
 
15
15
  前提 /^イベントの情報源は"(.*?)"$/ do |filename|
16
- ENV['resource'] = filename
16
+ root_path = File.join(File.dirname(__FILE__),"..", "..")
17
+ ENV['resource'] = File.join(root_path, filename)
17
18
  end
@@ -1,6 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  require 'date'
3
3
  require 'yaml'
4
+ require 'open-uri'
4
5
 
5
6
  module Hiroshimarb
6
7
  # イベントを表現するクラス
@@ -17,12 +18,7 @@ module Hiroshimarb
17
18
  end
18
19
 
19
20
  def resource_file_path
20
- root = File.join(File.dirname(__FILE__), "..", "..")
21
- File.join(root, filename)
22
- end
23
-
24
- def filename
25
- ENV["resource"] || File.join("resource", "event.yaml")
21
+ ENV["resource"] || 'https://raw.github.com/hiroshimarb/hiroshimarb-gem/master/resource/event.yaml'
26
22
  end
27
23
 
28
24
  def new_with_hash(hash)
@@ -35,8 +31,12 @@ module Hiroshimarb
35
31
 
36
32
  def load_yaml
37
33
  resource_file = resource_file_path
38
- events = YAML.parse_file(resource_file).to_ruby.map do |event_hash|
39
- Event.new_with_hash event_hash
34
+ events = nil
35
+ open(resource_file) do |io|
36
+ events = YAML.parse(io.read).to_ruby.map do |event_hash|
37
+ Event.new_with_hash event_hash
38
+ end
39
+ events
40
40
  end
41
41
  events.sort { |a,b| a.start_datetime <=> b.end_datetime }
42
42
  end
@@ -1,3 +1,3 @@
1
1
  module Hiroshimarb
2
- VERSION = "0.2.13"
2
+ VERSION = "0.3.0"
3
3
  end
data/resource/event.yaml CHANGED
@@ -1,4 +1,13 @@
1
1
  ---
2
+ - date: '2014-03-06 19:00 - 21:00'
3
+ title: 'Hiroshima.rb #040'
4
+ url: 'http://hiroshimarb.doorkeeper.jp/events/9946'
5
+ - date: '2014-03-14 19:30 - 22:00'
6
+ title: 'Twilio API 勉強会 @広島'
7
+ url: 'http://twiliomeetup.doorkeeper.jp/events/9078'
8
+ - date: '2014-03-06 19:00 - 21:00'
9
+ title: 'Hiroshima.rb #037'
10
+ url: 'http://hiroshimarb.doorkeeper.jp/events/9604'
2
11
  - date: '2014-02-20 18:00 - 20:00'
3
12
  title: 'Hiroshima.rb #036'
4
13
  url: 'http://hiroshimarb.doorkeeper.jp/events/8558'
@@ -4,17 +4,37 @@ require 'hiroshimarb/event'
4
4
 
5
5
  module Hiroshimarb
6
6
  describe Event do
7
- describe '.all' do
8
- subject { Event.all }
9
- it { should have(12).items }
7
+ let(:root_path) do
8
+ File.join(File.dirname(__FILE__), '..', '..')
10
9
  end
11
10
 
12
- describe '.recent' do
13
- subject { Event.recent }
14
- its(:title) { should eq('Hiroshima.rb #036') }
15
- it '日付は2014年 2月1日' do
16
- date = subject.start_datetime
17
- expect(date.strftime('%Y-%m-%d')).to eq('2014-02-20')
11
+ describe 'ローカルデータで' do
12
+ before :each do
13
+ ENV['resource'] = File.join(root_path, 'resource', 'event.yaml')
14
+ end
15
+
16
+ it do
17
+ expect { Event.all }.to_not raise_error
18
+ end
19
+ end
20
+
21
+ describe 'テストデータで' do
22
+ before :each do
23
+ ENV['resource'] = File.join(root_path, 'spec', 'resource', 'event.yaml')
24
+ end
25
+
26
+ describe '.all' do
27
+ subject { Event.all }
28
+ it { should have(4).items }
29
+ end
30
+
31
+ describe '.recent' do
32
+ subject { Event.recent }
33
+ its(:title) { should eq('Hiroshima.rb #037') }
34
+ it '日付は2014年 3月14日' do
35
+ date = subject.start_datetime
36
+ expect(date.strftime('%Y-%m-%d')).to eq('2014-03-06')
37
+ end
18
38
  end
19
39
  end
20
40
  end
@@ -0,0 +1,13 @@
1
+ ---
2
+ - date: '2014-03-06 19:00 - 21:00'
3
+ title: 'Hiroshima.rb #037'
4
+ url: 'http://hiroshimarb.doorkeeper.jp/events/9604'
5
+ - date: '2014-02-20 18:00 - 20:00'
6
+ title: 'Hiroshima.rb #036'
7
+ url: 'http://hiroshimarb.doorkeeper.jp/events/8558'
8
+ - date: '2014-02-01 10:00 - 17:30'
9
+ title: 'オープンセミナー2014@広島'
10
+ url: 'http://hiroshimarb.github.io/blog/2013/11/02/osh-2014/'
11
+ - date: '2012-11-03 14:00 - 18:00'
12
+ title: '広島 Ruby 勉強会 #025'
13
+ url: 'http://hiroshimarb.github.com/blog/2012/10/15/hiroshimarb-25/'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiroshimarb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.13
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomohiko Himura
@@ -25,7 +25,7 @@ authors:
25
25
  autorequire:
26
26
  bindir: bin
27
27
  cert_chain: []
28
- date: 2014-02-05 00:00:00.000000000 Z
28
+ date: 2014-03-19 00:00:00.000000000 Z
29
29
  dependencies:
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: launchy
@@ -132,6 +132,7 @@ files:
132
132
  - spec/hiroshimarb/information_spec.rb
133
133
  - spec/hiroshimarb/member_spec.rb
134
134
  - spec/hiroshimarb_spec.rb
135
+ - spec/resource/event.yaml
135
136
  - spec/spec_helper.rb
136
137
  homepage: http://github.com/hiroshimarb/hiroshimarb-gem
137
138
  licenses:
@@ -153,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
153
154
  version: '0'
154
155
  requirements: []
155
156
  rubyforge_project: github
156
- rubygems_version: 2.2.0
157
+ rubygems_version: 2.2.2
157
158
  signing_key:
158
159
  specification_version: 4
159
160
  summary: provide `hiroshimarb` command. hiroshimarb is Hiroshima.rb
@@ -171,4 +172,5 @@ test_files:
171
172
  - spec/hiroshimarb/information_spec.rb
172
173
  - spec/hiroshimarb/member_spec.rb
173
174
  - spec/hiroshimarb_spec.rb
175
+ - spec/resource/event.yaml
174
176
  - spec/spec_helper.rb