cinch-lastactive 0.0.2 → 1.0.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
  !binary "U0hBMQ==":
3
- metadata.gz: 1038a7084112cee8178cc986209fc7dc8ab113fa
4
- data.tar.gz: 89a413dea4e523e856c534cab66079d2814446df
3
+ metadata.gz: af92730f5735c83a00d44083ae38290d282b81b8
4
+ data.tar.gz: ec75ab9cfaba4ff63ccddb88d48f9ff7270b3597
5
5
  SHA512:
6
- metadata.gz: 44bb8d0c3a42767e5fbaee8a717b742fcaea4383be21be1f8ab89741b9b36c807e4c80bafe001f2843498da5c7f82e41e3d20e4eba968c47524856f6770f45b4
7
- data.tar.gz: 19182e51ecb9e089639e854a9996c8a725d98108cc81e2352753e7610749dca053b651a3e11387c1db3cc85dcef066e9343cd85ecc889de0a6ff1f8b2699c0e9
6
+ metadata.gz: 4c652aabd45b647598144a953797209050fdafbafbaed8a200c7ff0549ac895554bb7ef02650fb55da3fe13a12ab4d307c279ac1ce777fad85d724016b72ecab
7
+ data.tar.gz: 7437b354ebb23795f81f8bf9be02b50f9b5319fd4725a0d3af9912275b0ed4596f2af94d93d37e52eadf46caf031c27c45d691a51b48ec75dee85250c0be9c91
data/Rakefile CHANGED
@@ -1 +1,7 @@
1
1
  require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new
5
+
6
+ task :default => :spec
7
+ task :test => :spec
@@ -12,18 +12,16 @@ Gem::Specification.new do |spec|
12
12
  spec.description = %q{Cinch Plugin to greet users with the time since last activity}
13
13
  spec.homepage = 'https://github.com/bhaberer/cinch-lastactive'
14
14
  spec.license = 'MIT'
15
-
16
15
  spec.files = `git ls-files -z`.split("\x0")
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
16
+ spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(/^(test|spec|features)\//)
19
18
  spec.require_paths = ['lib']
20
19
 
21
20
  spec.add_development_dependency 'bundler', '~> 1.5'
22
- spec.add_development_dependency 'rake'
23
- spec.add_development_dependency 'rspec'
24
- spec.add_development_dependency 'coveralls'
25
- spec.add_development_dependency 'cinch-test'
26
-
27
- spec.add_dependency 'cinch', '~> 2.0.12'
28
- spec.add_dependency 'cinch-toolbox'
21
+ spec.add_development_dependency 'rake', '~> 10'
22
+ spec.add_development_dependency 'rspec', '~> 3'
23
+ spec.add_development_dependency 'coveralls', '~> 0.7'
24
+ spec.add_development_dependency 'cinch-test', '~> 0.1', '>= 0.1.1'
25
+ spec.add_dependency 'cinch', '~> 2'
26
+ spec.add_dependency 'cinch-toolbox', '~> 1.1'
29
27
  end
@@ -1,32 +1,37 @@
1
1
  require 'cinch'
2
2
  require 'cinch/toolbox'
3
3
 
4
- module Cinch::Plugins
5
- class LastActive
6
- include Cinch::Plugin
4
+ module Cinch
5
+ module Plugins
6
+ # Cinch Plugin to informing joining users how long ago the last line
7
+ # of text was spoken.
8
+ class LastActive
9
+ include Cinch::Plugin
7
10
 
8
- listen_to :join, method: :join_respond
9
- listen_to :channel, method: :update_time
11
+ listen_to :join, method: :join_respond
12
+ listen_to :channel, method: :update_time
10
13
 
11
- def initialize(*args)
12
- super
13
- @times = Hash.new(Time.now)
14
- end
14
+ def initialize(*args)
15
+ super
16
+ @times = Hash.new(Time.now)
17
+ end
15
18
 
16
- def join_respond(m)
17
- return if m.user.nick == @bot.nick
18
- m.reply "Hello, #{m.user.nick}. The last activity was "\
19
- "#{time_passed(m.channel.name)} ago."
20
- end
19
+ def join_respond(m)
20
+ return if m.user.nick == @bot.nick
21
+ return if m.channel.nil?
22
+ m.reply "Hello, #{m.user.nick}. The last activity was " \
23
+ "#{time_passed(m.channel.name)} ago."
24
+ end
21
25
 
22
- def update_time(m)
23
- @times[m.channel.name] = Time.now
24
- end
26
+ def update_time(m)
27
+ @times[m.channel.name] = Time.now
28
+ end
25
29
 
26
- private
30
+ private
27
31
 
28
- def time_passed(channel)
29
- Cinch::Toolbox.time_format(Time.now - @times[channel])
32
+ def time_passed(channel)
33
+ Cinch::Toolbox.time_format(Time.now - @times[channel])
34
+ end
30
35
  end
31
36
  end
32
37
  end
@@ -1,7 +1,8 @@
1
1
  module Cinch
2
2
  module Plugins
3
+ # Versioning Information
3
4
  class LastActive
4
- VERSION = '0.0.2'
5
+ VERSION = '1.0.0'
5
6
  end
6
7
  end
7
8
  end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe Cinch::Plugins::LastActive do
4
+ include Cinch::Test
5
+
6
+ before(:each) do
7
+ @bot = make_bot(Cinch::Plugins::LastActive, { filename: '/dev/null' })
8
+ end
9
+
10
+ it 'should not respond to activiy via pm' do
11
+ msg = make_message(@bot, '')
12
+ expect(get_replies(msg, :join))
13
+ .to be_empty
14
+ end
15
+
16
+ it 'should not respond to activiy via pm' do
17
+ msg = make_message(@bot, '', { channel: '#foo' })
18
+ expect(get_replies(msg, :join).first.text)
19
+ .to match(/Hello, test. The last activity was \d seconds ago/)
20
+ end
21
+ end
@@ -0,0 +1,11 @@
1
+ require 'coveralls'
2
+ require 'simplecov'
3
+
4
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
5
+ SimpleCov::Formatter::HTMLFormatter,
6
+ Coveralls::SimpleCov::Formatter
7
+ ]
8
+ SimpleCov.start
9
+
10
+ require 'cinch-lastactive'
11
+ require 'cinch/test'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cinch-lastactive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Haberer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-12 00:00:00.000000000 Z
11
+ date: 2014-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -28,86 +28,92 @@ dependencies:
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '10'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: '10'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '3'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ! '>='
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '3'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: coveralls
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ! '>='
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '0.7'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ! '>='
66
+ - - ~>
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: '0.7'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: cinch-test
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: '0.1'
73
76
  - - ! '>='
74
77
  - !ruby/object:Gem::Version
75
- version: '0'
78
+ version: 0.1.1
76
79
  type: :development
77
80
  prerelease: false
78
81
  version_requirements: !ruby/object:Gem::Requirement
79
82
  requirements:
83
+ - - ~>
84
+ - !ruby/object:Gem::Version
85
+ version: '0.1'
80
86
  - - ! '>='
81
87
  - !ruby/object:Gem::Version
82
- version: '0'
88
+ version: 0.1.1
83
89
  - !ruby/object:Gem::Dependency
84
90
  name: cinch
85
91
  requirement: !ruby/object:Gem::Requirement
86
92
  requirements:
87
93
  - - ~>
88
94
  - !ruby/object:Gem::Version
89
- version: 2.0.12
95
+ version: '2'
90
96
  type: :runtime
91
97
  prerelease: false
92
98
  version_requirements: !ruby/object:Gem::Requirement
93
99
  requirements:
94
100
  - - ~>
95
101
  - !ruby/object:Gem::Version
96
- version: 2.0.12
102
+ version: '2'
97
103
  - !ruby/object:Gem::Dependency
98
104
  name: cinch-toolbox
99
105
  requirement: !ruby/object:Gem::Requirement
100
106
  requirements:
101
- - - ! '>='
107
+ - - ~>
102
108
  - !ruby/object:Gem::Version
103
- version: '0'
109
+ version: '1.1'
104
110
  type: :runtime
105
111
  prerelease: false
106
112
  version_requirements: !ruby/object:Gem::Requirement
107
113
  requirements:
108
- - - ! '>='
114
+ - - ~>
109
115
  - !ruby/object:Gem::Version
110
- version: '0'
116
+ version: '1.1'
111
117
  description: Cinch Plugin to greet users with the time since last activity
112
118
  email:
113
119
  - bhaberer@gmail.com
@@ -124,6 +130,8 @@ files:
124
130
  - lib/cinch-lastactive.rb
125
131
  - lib/cinch/plugins/lastactive.rb
126
132
  - lib/cinch/plugins/lastactive/version.rb
133
+ - spec/cinch-lastactive_spec.rb
134
+ - spec/spec_helper.rb
127
135
  homepage: https://github.com/bhaberer/cinch-lastactive
128
136
  licenses:
129
137
  - MIT
@@ -148,4 +156,6 @@ rubygems_version: 2.2.2
148
156
  signing_key:
149
157
  specification_version: 4
150
158
  summary: Cinch Plugin to greet vistors.
151
- test_files: []
159
+ test_files:
160
+ - spec/cinch-lastactive_spec.rb
161
+ - spec/spec_helper.rb