hiroshimarb 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.
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ rvm:
3
+ - "1.9.2"
4
+ - "1.9.3"
5
+ - jruby-19mode # JRuby in 1.9 mode
6
+ - rbx-19mode
7
+ script: bundle exec rspec spec
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Hiroshima.rb
1
+ # Hiroshima.rb [![Build Status](https://secure.travis-ci.org/hiroshimarb/hiroshimarb-gem.png)](http://travis-ci.org/hiroshimarb/hiroshimarb-gem)
2
2
 
3
3
  この gem は Hiroshima.rb が提供する gem です。
4
4
  基本的にネタです。
@@ -10,7 +10,26 @@
10
10
 
11
11
  ## Usage
12
12
 
13
+ ### open コマンド
13
14
 
14
15
  $ hiroshimarb open
15
16
 
16
17
  ブラウザで Hiroshima.rb のウェブサイトを表示します。
18
+
19
+ `open` コマンドにはサブコマンドが用意されていて、指定するサブコマンドによって開くサイトが変化します。
20
+ 用意されているサブコマンドは以下の通りです。
21
+
22
+ <table>
23
+ <tr>
24
+ <td>hiroshimarb</td><td>Hiroshima.rb</td>
25
+ </tr>
26
+ <tr>
27
+ <td>oc-h</td><td>おしい広島県</td>
28
+ </tr>
29
+ </table>
30
+
31
+ ### member コマンド
32
+
33
+ $ hiroshimarb member
34
+
35
+ Hiroshima.rb のメンバー一覧を表示します。
data/hiroshimarb.gemspec CHANGED
@@ -1,8 +1,10 @@
1
1
  # -*- coding: utf-8 -*-
2
- require File.expand_path('../lib/hiroshimarb/version', __FILE__)
2
+ $LOAD_PATH << File.expand_path('../lib', __FILE__)
3
+ require 'hiroshimarb/version'
4
+ require 'hiroshimarb/member'
3
5
 
4
6
  Gem::Specification.new do |gem|
5
- gem.authors = ["Tomohiko Himura"]
7
+ gem.authors = Hiroshimarb::Member.all.map(&:name)
6
8
  gem.email = ["eiel.hal@gmail.com"]
7
9
  gem.description = %q{provide `hiroshimarb` command. hiroshimarb is Hiroshima.rb. Hiroshima.rb is local community of Ruby in Hiroshima/Japan}
8
10
  gem.summary = %q{provide `hiroshimarb` command. hiroshimarb is Hiroshima.rb}
@@ -1,3 +1,4 @@
1
+ # -*- coding: utf-8 -*-
1
2
  require 'hiroshimarb/member'
2
3
  require 'rubygems'
3
4
  require 'launchy'
@@ -6,13 +7,20 @@ module Hiroshimarb
6
7
  # コマンドラインから呼びだされる場合のサブコマンドを実装する
7
8
  module CLI
8
9
  # Hiroshim.rbのウェブサイトをブラウザで開く
9
- def open
10
- Launchy.open 'http://hiroshimarb.github.com'
10
+ def open(key = nil)
11
+ key ||= 'hiroshimarb'
12
+ url = case key
13
+ when 'hiroshimarb'
14
+ 'http://hiroshimarb.github.com'
15
+ when 'oc-h'
16
+ 'http://oc-h.jp'
17
+ end
18
+ Launchy.open url
11
19
  end
12
20
 
13
21
  # Hiroshim.rbの情報を標準出力へ表示
14
22
  def info
15
- help
23
+ puts Information.information
16
24
  end
17
25
 
18
26
  # Hiroshima.rbのメンバーを標準出力へ表示
@@ -28,7 +36,10 @@ module Hiroshimarb
28
36
  puts <<EOD
29
37
  Usage: hiroshimarb command
30
38
  Available commands:
31
- open : open the Hiroshima.rb website in a web browser
39
+ open : open the website relevant to Hiroshima in a web browser
40
+ : subcommands
41
+ : hiroshimarb - Hiroshim.rb [default]
42
+ : oc-h - おしい広島県
32
43
  member : display the member of Hiroshima.rb
33
44
  EOD
34
45
  end
@@ -0,0 +1,38 @@
1
+ # -*- coding: utf-8 -*-
2
+ module Hiroshimarb
3
+ class Information
4
+ class << self
5
+ def information
6
+ <<EOD
7
+ #{about}
8
+ イベント
9
+ ================================================================================
10
+
11
+ 5月と1月を除いた毎月第一土曜日に勉強会やもくもくする会を行っています。
12
+
13
+ 参加資格
14
+ ================================================================================
15
+
16
+ * Rubyが好きな人
17
+ * Rubyを使っている人
18
+ * Rubyに興味ある人
19
+ * Rubyで作られたアプリを使用している人
20
+ * Ruby以外のLL(Lightweight Language)に興味があったり、使っている人
21
+ * プログラミングに関係なくRubyが好きな人
22
+ * とにかく広島を盛り上げたい人- 広島に限らず地域コミュニティーを盛り上げたい人
23
+ EOD
24
+ end
25
+
26
+ def about
27
+ <<EOD
28
+ Hiroshima.rbについて
29
+ ================================================================================
30
+
31
+ 「Hiroshima.rb」はプログラミング言語Rubyの地域コミュニティです。
32
+ 広島はもちろん、地域に関係なくRubyをもっと盛り上げることを目標に、「ついでに情報交換やスキル向上ができたらいいなぁ。」ぐらいのゆるいコミュニティです。
33
+ 「楽しいRuby」をモットーに参加者みんなで育ていくコミュニティを目指してます。
34
+ EOD
35
+ end
36
+ end
37
+ end
38
+ end
@@ -1,3 +1,3 @@
1
1
  module Hiroshimarb
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/hiroshimarb.rb CHANGED
@@ -4,6 +4,8 @@ require 'hiroshimarb/cli'
4
4
  module Hiroshimarb
5
5
  extend CLI
6
6
 
7
+ autoload(:Information, "hiroshimarb/information")
8
+
7
9
  class << self
8
10
  def execute(argv)
9
11
  return help if argv.count == 0
@@ -11,7 +13,7 @@ module Hiroshimarb
11
13
  command = argv.shift
12
14
  case command
13
15
  when 'open'
14
- open
16
+ open *argv
15
17
  when 'info'
16
18
  info
17
19
  when 'member'
@@ -6,30 +6,62 @@ describe Hiroshimarb::CLI do
6
6
  Object.new.extend Hiroshimarb::CLI
7
7
  end
8
8
 
9
+ let(:stdout) do
10
+ $stdout.seek 0
11
+ $stdout.read
12
+ end
13
+
14
+ before :each do
15
+ $stdout = StringIO.new
16
+ end
17
+
9
18
  describe '#open' do
10
- subject { cli.open }
11
- it "Hiroshima.rbのウェブサイトを表示" do
12
- Launchy.should_receive(:open).with('http://hiroshimarb.github.com')
13
- subject
19
+ subject { cli.open(arg) }
20
+
21
+ context '引数なし' do
22
+ let(:arg) { nil }
23
+ it "Hiroshima.rbのウェブサイトを表示" do
24
+ Launchy.should_receive(:open).with('http://hiroshimarb.github.com')
25
+ subject
26
+ end
27
+ end
28
+
29
+ context '引数 "oc-h"' do
30
+ let(:arg) { "oc-h" }
31
+ it "おしい広島県のウェブサイトを表示" do
32
+ Launchy.should_receive(:open).with('http://oc-h.jp')
33
+ subject
34
+ end
14
35
  end
15
36
  end
16
37
 
17
38
  describe '#info' do
18
- it 'Hiroshim.rbの情報を出力'
39
+ subject { cli.info }
40
+ it "Hiroshima.rbについて出力される" do
41
+ subject
42
+ expect(stdout).to match("Hiroshima.rbについて")
43
+ end
44
+
45
+ it "イベントについて出力される" do
46
+ subject
47
+ expect(stdout).to match("勉強会やもくもくする会")
48
+ end
19
49
  end
20
50
 
21
51
  describe '#member' do
22
52
  subject { cli.member }
23
53
  it 'Hiroshim.rbのメンバーを出力' do
24
54
  Hiroshimarb::Member.stub(:all) { %W{hoge mogu} }
25
- $stdout = StringIO.new
26
55
  subject
27
- $stdout.seek 0
28
- expect($stdout.read).to eq("hoge\n" + '-'*80 + "\nmogu\n")
56
+ expect(stdout).to eq("hoge\n" + '-'*80 + "\nmogu\n")
29
57
  end
30
58
  end
31
59
 
32
60
  describe '#help' do
33
- it '使い方を出力'
61
+ subject { cli.help }
62
+ it '使い方を出力' do
63
+ subject
64
+ expect(stdout).to match("Usage")
65
+ end
34
66
  end
35
67
  end
@@ -0,0 +1,26 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'hiroshimarb/information'
3
+
4
+ module Hiroshimarb
5
+ describe Information do
6
+ describe '.information' do
7
+ subject { Information.information }
8
+
9
+ it "Hiroshima.rbについて" do
10
+ should match("Hiroshima.rb")
11
+ end
12
+
13
+ it "イベントの日程" do
14
+ should match("毎月第一土曜日")
15
+ end
16
+ end
17
+
18
+ describe '.about' do
19
+ subject { Information.about }
20
+
21
+ it "Hiroshima.rbについて" do
22
+ should match("Hiroshima.rbについて")
23
+ end
24
+ end
25
+ end
26
+ end
@@ -5,10 +5,10 @@ describe Hiroshimarb do
5
5
  describe '.execute' do
6
6
  subject { Hiroshimarb.execute argv }
7
7
  context "when 第1引数が 'open'" do
8
- let(:argv) { ['open'] }
8
+ let(:argv) { ['open', 'hiroshimarb'] }
9
9
 
10
10
  it "open メソッドが呼ばれる" do
11
- Hiroshimarb.should_receive(:open)
11
+ Hiroshimarb.should_receive(:open).with('hiroshimarb')
12
12
  subject
13
13
  end
14
14
  end
@@ -40,4 +40,9 @@ describe Hiroshimarb do
40
40
  end
41
41
  end
42
42
  end
43
+
44
+ describe "Infomation" do
45
+ subject { Hiroshimarb::Information }
46
+ its(:class) { should eq(Class) }
47
+ end
43
48
  end
metadata CHANGED
@@ -1,15 +1,24 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiroshimarb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Tomohiko Himura
9
+ - KITADAI, Yukinori
10
+ - John Mettraux
11
+ - Akira345
12
+ - Tatsuya Furukido
13
+ - Takanobu Kamada
14
+ - Takashi Akagi
15
+ - Hidetoshi Kawaguchi
16
+ - Kazuya Matsubara
17
+ - Tomohiro Morishita
9
18
  autorequire:
10
19
  bindir: bin
11
20
  cert_chain: []
12
- date: 2012-09-15 00:00:00.000000000 Z
21
+ date: 2012-09-24 00:00:00.000000000 Z
13
22
  dependencies:
14
23
  - !ruby/object:Gem::Dependency
15
24
  name: launchy
@@ -53,6 +62,7 @@ extensions: []
53
62
  extra_rdoc_files: []
54
63
  files:
55
64
  - .gitignore
65
+ - .travis.yml
56
66
  - Gemfile
57
67
  - LICENSE
58
68
  - README.md
@@ -62,11 +72,13 @@ files:
62
72
  - lib/hiroshimarb.rb
63
73
  - lib/hiroshimarb/cli.rb
64
74
  - lib/hiroshimarb/dsl.rb
75
+ - lib/hiroshimarb/information.rb
65
76
  - lib/hiroshimarb/member.rb
66
77
  - lib/hiroshimarb/version.rb
67
78
  - resource/member.rb
68
79
  - spec/hiroshimarb/cli_spec.rb
69
80
  - spec/hiroshimarb/dsl_spec.rb
81
+ - spec/hiroshimarb/information_spec.rb
70
82
  - spec/hiroshimarb/member_spec.rb
71
83
  - spec/hiroshimarb_spec.rb
72
84
  homepage: http://github.com/hiroshimarb/hiroshimarb-gem
@@ -96,6 +108,7 @@ summary: provide `hiroshimarb` command. hiroshimarb is Hiroshima.rb
96
108
  test_files:
97
109
  - spec/hiroshimarb/cli_spec.rb
98
110
  - spec/hiroshimarb/dsl_spec.rb
111
+ - spec/hiroshimarb/information_spec.rb
99
112
  - spec/hiroshimarb/member_spec.rb
100
113
  - spec/hiroshimarb_spec.rb
101
114
  has_rdoc: