alvid 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 880ceb639ab19b1a6eed98d9ec684c802a0fe0f9
4
+ data.tar.gz: c0ceccc792d5850e643a9e9b3bb13db4077d1a51
5
+ SHA512:
6
+ metadata.gz: 79821070f18dfcbc4dfc4148dc6d6408d1cec223e9c79137573d2b293f765401398380638ebcbcaa810fdfeef9828b78e0c9a4c2f3af290cbf713688dd81e320
7
+ data.tar.gz: f8a0f6023ff54d67976fd63c9486937247a967e1662e031a95fffd64b750efe80df055a83388edd3caad13d34769818c3506357eec1a5ee47c95bcdca5ddd9f1
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.2
4
+ before_install: gem install bundler -v 1.10.1
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in alvid.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Alan Moran
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,11 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
7
+
8
+ desc "Open an irb session preloaded with this library"
9
+ task :console do
10
+ sh "irb -I lib -r alvid.rb"
11
+ end
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'alvid/version'
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "alvid"
8
+ s.version = Alvid::VERSION
9
+ s.authors = ["Alan Moran", "David Brock"]
10
+ s.email = ["bonzofenix@gmail.com", "dbrockjr@gmail.com"]
11
+
12
+ s.summary = %q{Alvid is an advanced AI bot that integrates with slack.}
13
+ s.homepage = "http://bonzofenix.github.io/alvid"
14
+ s.license = "MIT"
15
+
16
+
17
+ s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|s|features)/}) }
18
+ s.bindir = "exe"
19
+ s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+
22
+ s.add_development_dependency "bundler", "~> 1.10"
23
+ s.add_development_dependency "rake", "~> 10.0"
24
+ s.add_development_dependency 'rack'
25
+ s.add_development_dependency 'thin', '>= 1.2.0'
26
+ s.add_development_dependency "rspec"
27
+ s.add_development_dependency "factory_girl"
28
+ s.add_dependency "dm-sqlite-adapter"
29
+ s.add_dependency "data_mapper"
30
+ end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "alvid"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,19 @@
1
+ require 'data_mapper'
2
+ require 'json'
3
+
4
+ module Alvid
5
+ def self.init
6
+ db_uri = if ENV['VCAP_SERVICES'].nil? || JSON.parse(ENV['VCAP_SERVICES']).empty?
7
+ require 'dm-sqlite-adapter'
8
+ 'sqlite::memory:'
9
+ else
10
+ JSON.parse(ENV['VCAP_SERVICES']).first[1].first.first[1]['uri']
11
+ end
12
+ DataMapper.setup(:default, db_uri)
13
+ end
14
+ end
15
+
16
+ Alvid.init
17
+
18
+ require "alvid/version"
19
+ require "alvid/retro"
@@ -0,0 +1,19 @@
1
+ class Alvid::Retro
2
+ include DataMapper::Resource
3
+ property :message, String
4
+ property :id, Serial
5
+
6
+ def self.add(message)
7
+ create(message: message)
8
+ end
9
+
10
+ def self.list
11
+ Alvid::Retro.all.map(&:message).join("\n")
12
+ end
13
+
14
+ def self.clear
15
+ Alvid::Retro.destroy
16
+ end
17
+ end
18
+
19
+ DataMapper.auto_upgrade!
@@ -0,0 +1,3 @@
1
+ module Alvid
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,35 @@
1
+ require 'spec_helper'
2
+
3
+ describe Alvid do
4
+ it 'has a version number' do
5
+ expect(Alvid::VERSION).not_to be nil
6
+ end
7
+
8
+ describe 'init' do
9
+ describe 'when VCAP_SERVICES provided' do
10
+ it 'uses provided db' do
11
+ ENV["VCAP_SERVICES"] = '{ "p-mysql-n/a": [ { "credentials": { "uri":"cool-mysql-uri" }, "label": "p-mysql-n/a", "name": "p-mysql", "syslog_drain_url": "", "tags": ["postgres","postgresql","relational"] } ] } '
12
+ expect(DataMapper).to receive(:setup).with(:default, "cool-mysql-uri")
13
+ Alvid.init
14
+ ENV.clear
15
+ end
16
+ end
17
+
18
+ describe 'when VCAP_SERVICES is empty' do
19
+ it 'uses provided db' do
20
+ ENV["VCAP_SERVICES"] = '{ }'
21
+ expect(DataMapper).to receive(:setup).with(:default, 'sqlite::memory:')
22
+ Alvid.init
23
+ ENV.clear
24
+ end
25
+ end
26
+
27
+ describe "when VCAP_SERVICES is not provided" do
28
+ it "uses inmemory db" do
29
+ ENV.clear
30
+ expect(DataMapper).to receive(:setup).with(:default, 'sqlite::memory:')
31
+ Alvid.init
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,5 @@
1
+ FactoryGirl.define do
2
+ factory :retro , class: Alvid::Retro do
3
+ message "banana"
4
+ end
5
+ end
@@ -0,0 +1,35 @@
1
+ require 'spec_helper'
2
+
3
+ describe Alvid::Retro do
4
+ describe 'add' do
5
+ it 'creates a retro item' do
6
+ expect{
7
+ Alvid::Retro.add 'banana'
8
+ }.to change{ described_class.count }.by(1)
9
+ end
10
+ end
11
+
12
+ describe 'list' do
13
+ before do
14
+ create(:retro, message: 'banana 1')
15
+ create(:retro, message: 'banana 2')
16
+ end
17
+
18
+ it 'show all retro items' do
19
+ expect( Alvid::Retro.list).to eq("banana 1\nbanana 2")
20
+ end
21
+ end
22
+
23
+ describe 'clear' do
24
+ before do
25
+ create(:retro, message: 'banana 1')
26
+ create(:retro, message: 'banana 2')
27
+ end
28
+
29
+ it 'clear all retro items' do
30
+ expect{
31
+ Alvid::Retro.clear
32
+ }.to change{ described_class.count }.to(0)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,10 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'factory_girl'
3
+ require 'alvid'
4
+
5
+ RSpec.configure do |config|
6
+ config.include FactoryGirl::Syntax::Methods
7
+ config.before(:suite) { FactoryGirl.reload }
8
+ config.before(:each) { DataMapper.auto_migrate! }
9
+ end
10
+
metadata ADDED
@@ -0,0 +1,175 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: alvid
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Alan Moran
8
+ - David Brock
9
+ autorequire:
10
+ bindir: exe
11
+ cert_chain: []
12
+ date: 2015-11-29 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '1.10'
21
+ type: :development
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '1.10'
28
+ - !ruby/object:Gem::Dependency
29
+ name: rake
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '10.0'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '10.0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: rack
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: thin
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 1.2.0
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: 1.2.0
70
+ - !ruby/object:Gem::Dependency
71
+ name: rspec
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: factory_girl
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ - !ruby/object:Gem::Dependency
99
+ name: dm-sqlite-adapter
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ type: :runtime
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ - !ruby/object:Gem::Dependency
113
+ name: data_mapper
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ type: :runtime
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ description:
127
+ email:
128
+ - bonzofenix@gmail.com
129
+ - dbrockjr@gmail.com
130
+ executables: []
131
+ extensions: []
132
+ extra_rdoc_files: []
133
+ files:
134
+ - ".gitignore"
135
+ - ".rspec"
136
+ - ".travis.yml"
137
+ - Gemfile
138
+ - LICENSE.txt
139
+ - README.md
140
+ - Rakefile
141
+ - alvid.gemspec
142
+ - bin/console
143
+ - bin/setup
144
+ - lib/alvid.rb
145
+ - lib/alvid/retro.rb
146
+ - lib/alvid/version.rb
147
+ - spec/alvid_spec.rb
148
+ - spec/factories.rb
149
+ - spec/retro_spec.rb
150
+ - spec/spec_helper.rb
151
+ homepage: http://bonzofenix.github.io/alvid
152
+ licenses:
153
+ - MIT
154
+ metadata: {}
155
+ post_install_message:
156
+ rdoc_options: []
157
+ require_paths:
158
+ - lib
159
+ required_ruby_version: !ruby/object:Gem::Requirement
160
+ requirements:
161
+ - - ">="
162
+ - !ruby/object:Gem::Version
163
+ version: '0'
164
+ required_rubygems_version: !ruby/object:Gem::Requirement
165
+ requirements:
166
+ - - ">="
167
+ - !ruby/object:Gem::Version
168
+ version: '0'
169
+ requirements: []
170
+ rubyforge_project:
171
+ rubygems_version: 2.4.5
172
+ signing_key:
173
+ specification_version: 4
174
+ summary: Alvid is an advanced AI bot that integrates with slack.
175
+ test_files: []