lita-fortune 0.0.6 → 0.0.7

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
  SHA256:
3
- metadata.gz: 0ffe8b7acc7951a1a3803e25e4c13d493d471be28fbd67290d248b686d7847dd
4
- data.tar.gz: 2d6a67224733f24efa020de1f5f68033d55b0391a4031832fa3c839003d4266d
3
+ metadata.gz: ee0b49aebb79cd1ec9b1e1ec13212ede36fd66c842ec409f34a40c3f8f7ff578
4
+ data.tar.gz: 63c2c9c6ac49c6b246b3090abd924612c2c736c83ce2c6857c675482d77ae145
5
5
  SHA512:
6
- metadata.gz: e56a249bb1322005594ed569d4ab527abe6f920c8741d802c933e85fce783defaebacded30669998ab3138e3102731033bd3ae2311e6fba635c7e3d34ddd8ebd
7
- data.tar.gz: d0414dbeba3aa892c362578276fdf9fec4dc4e131eba45bb2b1592b9cf4678ff11e143a86acbb0829bfd254bc859ffdb0c12fe0a03e4fa0ae23a6366b0b3b992
6
+ metadata.gz: e0b68fb7195da9bf440d4d6be962116fd26b99a3d9e94fbc0cc0cb6069fa326d7fce0c2e830e322daa5f63311a2ea34bb9afe1d86d53deb15a5bc53f894d04e0
7
+ data.tar.gz: 98c1f1ef8b707e87e39aa6d71cdc7e3159b67c7b155f540ecbf643d861ec196c88ff60789c95e76e90199daea068e6e5ff3aaa2a1fd37f7d260b243bb923b0a5
@@ -0,0 +1,20 @@
1
+ name: Ruby
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ build:
7
+
8
+ runs-on: ubuntu-latest
9
+
10
+ steps:
11
+ - uses: actions/checkout@v1
12
+ - name: Set up Ruby 2.6
13
+ uses: actions/setup-ruby@v1
14
+ with:
15
+ ruby-version: 2.6.x
16
+ - name: Build and test with Rake
17
+ run: |
18
+ gem install bundler
19
+ bundle install --jobs 4 --retry 3
20
+ bundle exec rake
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lita-fortune (0.0.6)
4
+ lita-fortune (0.0.7)
5
5
  i18n (~> 0.9)
6
6
  lita (>= 2.0)
7
7
 
@@ -38,24 +38,24 @@ GEM
38
38
  puma (4.3.3)
39
39
  nio4r (~> 2.0)
40
40
  rack (1.6.13)
41
- rake (12.3.3)
41
+ rake (13.0.1)
42
42
  rb-readline (0.5.5)
43
43
  redis (4.0.1)
44
44
  redis-namespace (1.7.0)
45
45
  redis (>= 3.0.4)
46
- rspec (3.7.0)
47
- rspec-core (~> 3.7.0)
48
- rspec-expectations (~> 3.7.0)
49
- rspec-mocks (~> 3.7.0)
50
- rspec-core (3.7.1)
51
- rspec-support (~> 3.7.0)
52
- rspec-expectations (3.7.0)
46
+ rspec (3.9.0)
47
+ rspec-core (~> 3.9.0)
48
+ rspec-expectations (~> 3.9.0)
49
+ rspec-mocks (~> 3.9.0)
50
+ rspec-core (3.9.1)
51
+ rspec-support (~> 3.9.1)
52
+ rspec-expectations (3.9.1)
53
53
  diff-lcs (>= 1.2.0, < 2.0)
54
- rspec-support (~> 3.7.0)
55
- rspec-mocks (3.7.0)
54
+ rspec-support (~> 3.9.0)
55
+ rspec-mocks (3.9.1)
56
56
  diff-lcs (>= 1.2.0, < 2.0)
57
- rspec-support (~> 3.7.0)
58
- rspec-support (3.7.1)
57
+ rspec-support (~> 3.9.0)
58
+ rspec-support (3.9.2)
59
59
  thor (1.0.1)
60
60
  url_mount (0.2.1)
61
61
  rack
@@ -64,10 +64,10 @@ PLATFORMS
64
64
  ruby
65
65
 
66
66
  DEPENDENCIES
67
- bundler (~> 1.15)
67
+ bundler (> 1.17)
68
68
  fakeredis (~> 0.7.0)
69
69
  lita-fortune!
70
- rake (~> 12.3)
70
+ rake (>= 12.3.3)
71
71
  rspec (~> 3.5)
72
72
 
73
73
  BUNDLED WITH
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
- [![CircleCI](https://circleci.com/gh/hortoncd/lita-fortune.svg?style=svg)](https://circleci.com/gh/hortoncd/lita-fortune)
2
-
3
1
  # lita-fortune
4
2
 
3
+ ![](https://github.com/hortoncd/lita-fortune/workflows/Ruby/badge.svg)
4
+
5
5
  `lita-fortune` is a handler for [Lita](https://github.com/jimmycuadra/lita) that returns a fortune cookie using the \*nix 'fortune' program.
6
6
 
7
7
  ## Installation
@@ -10,6 +10,9 @@ module Lita
10
10
  def self.default_config(handler_config)
11
11
  end
12
12
 
13
+ def run_cmd(cmd)
14
+ `#{cmd}`
15
+ end
13
16
 
14
17
  def fortune(response)
15
18
  if File.exist?('/usr/bin/fortune')
@@ -22,8 +25,8 @@ module Lita
22
25
  cmd = 'fortune'
23
26
  end
24
27
 
25
- f = `#{cmd}`
26
- f = "No fortune for you!" unless f
28
+ f = run_cmd(cmd)
29
+ f = "No fortune for you!" if ! f || f.empty?
27
30
  response.reply f
28
31
  end
29
32
  end
data/lita-fortune.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'lita-fortune'
3
- spec.version = '0.0.6'
3
+ spec.version = '0.0.7'
4
4
  spec.authors = ['Chris Horton']
5
5
  spec.email = ['hortoncd@gmail.com']
6
6
  spec.description = %q{A Lita handler for fortune cookies.}
@@ -17,8 +17,8 @@ Gem::Specification.new do |spec|
17
17
  spec.add_runtime_dependency 'lita', '>= 2.0'
18
18
  spec.add_runtime_dependency 'i18n', '~> 0.9'
19
19
 
20
- spec.add_development_dependency 'bundler', '~> 1.15'
21
- spec.add_development_dependency "rake", "~> 12.3"
20
+ spec.add_development_dependency 'bundler', '> 1.17'
21
+ spec.add_development_dependency "rake", ">= 12.3.3"
22
22
  spec.add_development_dependency "rspec", "~> 3.5"
23
23
  spec.add_development_dependency "fakeredis", "~> 0.7.0"
24
24
  end
@@ -5,8 +5,27 @@ describe Lita::Handlers::Fortune, lita_handler: true do
5
5
 
6
6
  describe 'fortune' do
7
7
  it "replies to a 'fortune' command" do
8
+ allow(File).to receive(:exist?).with('/usr/bin/fortune').and_return(true)
9
+ allow_any_instance_of(Lita::Handlers::Fortune).to receive(:run_cmd).with('/usr/bin/fortune').and_return("A magical fortune!")
8
10
  send_command('fortune')
9
11
  expect(replies.last).to be_kind_of(String)
12
+ expect(replies.last).to eq("A magical fortune!")
13
+ end
14
+
15
+ it "replies to a 'fortune' command when fortune is empty" do
16
+ allow(File).to receive(:exist?).with('/usr/bin/fortune').and_return(true)
17
+ allow_any_instance_of(described_class).to receive(:run_cmd).with('/usr/bin/fortune').and_return("")
18
+ send_command('fortune')
19
+ expect(replies.last).to be_kind_of(String)
20
+ expect(replies.last).to eq("No fortune for you!")
21
+ end
22
+
23
+ it "replies to a 'fortune' command when no fortune is received" do
24
+ allow(File).to receive(:exist?).with('/usr/bin/fortune').and_return(true)
25
+ allow_any_instance_of(described_class).to receive(:run_cmd).with('/usr/bin/fortune').and_return(nil)
26
+ send_command('fortune')
27
+ expect(replies.last).to be_kind_of(String)
28
+ expect(replies.last).to eq("No fortune for you!")
10
29
  end
11
30
  end
12
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-fortune
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Horton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-02 00:00:00.000000000 Z
11
+ date: 2020-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita
@@ -42,30 +42,30 @@ dependencies:
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.15'
47
+ version: '1.17'
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: '1.15'
54
+ version: '1.17'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '12.3'
61
+ version: 12.3.3
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: '12.3'
68
+ version: 12.3.3
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -101,7 +101,7 @@ executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
- - ".circleci/config.yml"
104
+ - ".github/workflows/ruby.yml"
105
105
  - ".gitignore"
106
106
  - Gemfile
107
107
  - Gemfile.lock
data/.circleci/config.yml DELETED
@@ -1,48 +0,0 @@
1
- version: 2
2
- jobs:
3
- build:
4
- working_directory: ~/hortoncd/lita-fortune
5
- parallelism: 1
6
- shell: /bin/bash --login
7
- environment:
8
- CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
9
- CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
10
- docker:
11
- - image: circleci/ruby:2.6.5
12
- steps:
13
- - checkout
14
- - run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS
15
- - restore_cache:
16
- keys:
17
- # This branch if available
18
- - v1-dep-{{ .Branch }}-
19
- # Default branch if not
20
- - v1-dep-master-
21
- # Any branch if there are none on the default branch - this should be unnecessary if you have your default branch configured correctly
22
- - v1-dep-
23
- - run: 'sudo apt-get install fortune-mod'
24
- - run: echo -e "export RAILS_ENV=test\nexport RACK_ENV=test" >> $BASH_ENV
25
- - run: 'gem install bundler --version=1.15'
26
- - run: 'bundle check --path=vendor/bundle || bundle install --path=vendor/bundle
27
- --jobs=4 --retry=3 '
28
- - save_cache:
29
- key: v1-dep-{{ .Branch }}-{{ epoch }}
30
- paths:
31
- - vendor/bundle
32
- - ~/virtualenvs
33
- - ~/.m2
34
- - ~/.ivy2
35
- - ~/.bundle
36
- - ~/.go_workspace
37
- - ~/.gradle
38
- - ~/.cache/bower
39
- - run:
40
- command: bundle exec rspec --format progress spec
41
- environment:
42
- RAILS_ENV: test
43
- RACK_ENV: test
44
- - store_test_results:
45
- path: /tmp/circleci-test-results
46
- # Save artifacts
47
- - store_artifacts:
48
- path: /tmp/circleci-artifacts