Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
sheldonrampton committed May 20, 2017
0 parents commit ded5fb0
Showing 33 changed files with 1,935 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.env
68 changes: 68 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
AllCops:
Exclude:
- 'db/**/*'
- 'Vagrantfile'
- 'vendor/**/*'
TargetRubyVersion: 2.1
Style/SingleLineBlockParams:
Enabled: false
Rails/TimeZone:
Enabled: false
Rails/Date:
Enabled: false
Style/MultilineBlockChain:
Enabled: false
Metrics/LineLength:
Enabled: false
Metrics/ClassLength:
Enabled: false
Rails/Output:
Enabled: false
Documentation:
Enabled: false
Style/ClassAndModuleChildren:
Enabled: false
Metrics/ParameterLists:
Enabled: false
Style/CommentAnnotation:
Enabled: false
Style/FileName:
Enabled: false
Style/Semicolon:
Enabled: false
Style/GuardClause:
Enabled: false
Style/PredicateName:
Enabled: false
Style/EachWithObject:
Enabled: false
Metrics/CyclomaticComplexity:
Enabled: false
Metrics/PerceivedComplexity:
Enabled: false
Metrics/AbcSize:
Enabled: false
Style/RaiseArgs:
Enabled: false
Style/DoubleNegation:
Enabled: false
Metrics/MethodLength:
Enabled: false
Style/AccessorMethodName:
Enabled: false
Style/SignalException:
Enabled: false
Style/RegexpLiteral:
Enabled: false
Style/Next:
Enabled: false
Lint/AssignmentInCondition:
Enabled: false
Style/PercentLiteralDelimiters:
Enabled: false
Style/StringLiterals:
Enabled: false
Style/SpaceAroundEqualsInParameterDefault:
Enabled: false
Style/ConditionalAssignment:
Enabled: false
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.3.3
29 changes: 29 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
source 'http://rubygems.org'
ruby '2.3.3'

gem 'celluloid-io'
gem 'dotenv'
gem 'jira-ruby', '1.2.0', :require => 'jira-ruby'
gem 'json'
gem 'puma'
gem 'redis'
gem 'sinatra'
gem 'slack-ruby-bot'
gem 'whenever'
gem 'faraday'
gem 'sanitize'

group :development, :test do
gem 'dpl'
gem 'foreman'
gem 'heroku-api'
gem 'rake'
gem 'rendezvous'
end

group :test do
gem 'pry'
gem 'rack-test'
gem 'rspec'
gem 'rubocop'
end
167 changes: 167 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
GEM
remote: http://rubygems.org/
specs:
activesupport (5.0.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7)
minitest (~> 5.1)
tzinfo (~> 1.1)
ast (2.3.0)
celluloid (0.17.3)
celluloid-essentials
celluloid-extras
celluloid-fsm
celluloid-pool
celluloid-supervision
timers (>= 4.1.1)
celluloid-essentials (0.20.5)
timers (>= 4.1.1)
celluloid-extras (0.20.5)
timers (>= 4.1.1)
celluloid-fsm (0.20.5)
timers (>= 4.1.1)
celluloid-io (0.17.3)
celluloid (>= 0.17.2)
nio4r (>= 1.1)
timers (>= 4.1.1)
celluloid-pool (0.20.5)
timers (>= 4.1.1)
celluloid-supervision (0.20.6)
timers (>= 4.1.1)
chronic (0.10.2)
coderay (1.1.1)
concurrent-ruby (1.0.4)
crass (1.0.2)
diff-lcs (1.2.5)
dotenv (2.1.1)
dpl (1.8.29)
excon (0.54.0)
faraday (0.10.0)
multipart-post (>= 1.2, < 3)
faraday_middleware (0.10.1)
faraday (>= 0.7.4, < 1.0)
foreman (0.82.0)
thor (~> 0.19.1)
gli (2.14.0)
hashie (3.4.6)
heroku-api (0.4.2)
excon (~> 0.45)
multi_json (~> 1.8)
hitimes (1.2.4)
i18n (0.7.0)
jira-ruby (1.2.0)
activesupport
oauth (~> 0.5, >= 0.5.0)
json (2.0.2)
method_source (0.8.2)
mini_portile2 (2.1.0)
minitest (5.10.1)
multi_json (1.12.1)
multipart-post (2.0.0)
nio4r (2.0.0)
nokogiri (1.7.0.1)
mini_portile2 (~> 2.1.0)
nokogumbo (1.4.10)
nokogiri
oauth (0.5.1)
parser (2.3.3.1)
ast (~> 2.2)
powerpack (0.1.1)
pry (0.10.4)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
puma (3.6.2)
rack (1.6.5)
rack-protection (1.5.3)
rack
rack-test (0.6.3)
rack (>= 1.0)
rainbow (2.2.1)
rake (12.0.0)
redis (3.3.2)
rendezvous (0.1.2)
rspec (3.5.0)
rspec-core (~> 3.5.0)
rspec-expectations (~> 3.5.0)
rspec-mocks (~> 3.5.0)
rspec-core (3.5.4)
rspec-support (~> 3.5.0)
rspec-expectations (3.5.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.5.0)
rspec-mocks (3.5.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.5.0)
rspec-support (3.5.0)
rubocop (0.46.0)
parser (>= 2.3.1.1, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.8.1)
sanitize (4.4.0)
crass (~> 1.0.2)
nokogiri (>= 1.4.4)
nokogumbo (~> 1.4.1)
sinatra (1.4.7)
rack (~> 1.5)
rack-protection (~> 1.4)
tilt (>= 1.3, < 3)
slack-ruby-bot (0.9.0)
hashie
slack-ruby-client (>= 0.6.0)
slack-ruby-client (0.7.7)
activesupport
faraday
faraday_middleware
gli
hashie
json
websocket-driver
slop (3.6.0)
thor (0.19.4)
thread_safe (0.3.5)
tilt (2.0.5)
timers (4.1.2)
hitimes
tzinfo (1.2.2)
thread_safe (~> 0.1)
unicode-display_width (1.1.2)
websocket-driver (0.6.4)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)
whenever (0.9.7)
chronic (>= 0.6.3)

PLATFORMS
ruby

DEPENDENCIES
celluloid-io
dotenv
dpl
faraday
foreman
heroku-api
jira-ruby (= 1.2.0)
json
pry
puma
rack-test
rake
redis
rendezvous
rspec
rubocop
sanitize
sinatra
slack-ruby-bot
whenever

RUBY VERSION
ruby 2.3.3p222

BUNDLED WITH
1.13.7
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: bundle exec puma -p $PORT
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Welcome to the SlackJiraBot

## Getting Started

### Install Dependencies

- Ruby 2.3.3
- Redis

#### Mac

- If you don't have homebrew, [install it now](http://brew.sh/).
- If you haven't installed ruby before, we recommend rbenv `brew install rbenv && rbenv install 2.3.3`
- If you don't have redis installed locally: `brew install redis && brew services start redis`

### App Setup

- Clone: `git clone https://github.com/sheldonrampton/slackjirabot.git`
- CD: `cd slackjirabot`
- Bundler: `gem install bundler && bundle install`
- Create a .env file, copy the example and get the correct tokens: `cp example.env .env`

#### Getting a Slack Token

- [Visit the Slack integrations page for your team, e.g., https://myteam.slack.com/apps/build/custom-integration
- Click on Bots
- Give your bot a name like `yourname_test_bot`
- Copy the api Token and put it in your .env file

### Running the App

- `foreman start`

### Running Tests

All merge requests run both specs and a linter, make sure they both pass before you push code up unless you want failures.

- Specs: `bundle exec rspec`
- Lint: `bundle exec rubocop`

### Contributing

We encourage you to contribute to SlackJiraBot! Send us your pull requests!
44 changes: 44 additions & 0 deletions config.ru
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# frozen_string_literal: true
$LOAD_PATH.unshift(File.dirname(__FILE__))

require 'dotenv'
Dotenv.load

require 'slackjirabot'
require 'web'

Thread.abort_on_exception = true

Thread.new do
begin
SlackJiraBot::Bot.run
rescue StandardError => e
STDERR.puts "ERROR: #{e}"
STDERR.puts e.backtrace
raise e
end
end

# Turn off debug logging
Slack.configure do |config|
# your logger
config.logger = Logger.new(STDOUT)
config.logger.level = Logger::WARN
end

SlackRubyBot::Client.logger.level = Logger::WARN

if ENV['HEROKU_URL']
Thread.new do
require 'net/http'
require "uri"
loop do
sleep 5 * 60
uri = URI.parse(ENV['HEROKU_URL'])
Net::HTTP.get_response(uri)
end
end
end

run SlackJiraBot::Web

7 changes: 7 additions & 0 deletions example.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
SLACK_API_TOKEN=see_the_readme
JIRA_USERNAME=
JIRA_PASSWORD=
JIRA_SITE=
CONFLUENCE_USERNAME=
CONFLUENCE_PASSWORD=
CONFLUENCE_SITE=
Loading

0 comments on commit ded5fb0

Please sign in to comment.