slack_trello 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: dafd966edd57f44cbec9282ecbe21920b6ef609c
4
+ data.tar.gz: 72664ccf8318fc8b261a5be852c292a247a8ddda
5
+ SHA512:
6
+ metadata.gz: aa25b2adeaf65022335de5b00653992cffc133c7cd4c2f577a505bbc777a695e7d06daf84830cd831f986b393f2ad1fe28c61c413a4f507b2d767a262fe3e782
7
+ data.tar.gz: faa2f7d53179285989750e813696dad3c809ddf2cfd80cdf80653dfa65b7b8ec5b0397b6cd167ccb2b023a7454a3b0bb979ce5ea765f4b0c1ca44de8c11cc724
data/.gitignore ADDED
@@ -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
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in slack_trello.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Matthew Powers
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.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # SlackTrello
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/slack_trello`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'slack_trello'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install slack_trello
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ 1. Fork it ( https://github.com/[my-github-username]/slack_trello/fork )
36
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
37
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
38
+ 4. Push to the branch (`git push origin my-new-feature`)
39
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "slack_trello"
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
data/bin/setup ADDED
@@ -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,14 @@
1
+ module SlackTrello; class ResponseParser
2
+
3
+ attr_reader :args
4
+
5
+ def initialize(args)
6
+ @args = args
7
+ end
8
+
9
+ def method_missing(name)
10
+ super unless args.has_key?(name.to_s)
11
+ args.fetch(name.to_s)
12
+ end
13
+
14
+ end; end
@@ -0,0 +1,34 @@
1
+ module SlackTrello; class TextParser
2
+
3
+ attr_reader :text
4
+
5
+ def initialize(text, options = {})
6
+ @text = text
7
+ @required_arguments = options.fetch(:required_arguments, nil)
8
+ end
9
+
10
+ def args
11
+ matched_text[1].strip.split(" ")
12
+ end
13
+
14
+ def text_message
15
+ matched_text[2].strip
16
+ end
17
+
18
+ def valid_text_format?
19
+ !!matched_text
20
+ end
21
+
22
+ private
23
+
24
+ def regex
25
+ /\((.+?)\)(.+)?/
26
+ end
27
+
28
+ def matched_text
29
+ text.match(regex)
30
+ end
31
+
32
+ end; end
33
+
34
+
@@ -0,0 +1,3 @@
1
+ module SlackTrello
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,68 @@
1
+ module SlackTrello; class WorkCommand
2
+
3
+ attr_accessor :trello_card
4
+
5
+ attr_reader :parser
6
+
7
+ def initialize(args)
8
+ @parser = ResponseParser.new(args)
9
+ end
10
+
11
+ def run
12
+ return board_not_found_message unless trello_board
13
+ return list_not_found_message unless trello_list
14
+
15
+ create_trello_card
16
+ #slacky.speak success_message
17
+ "You should see a notification with a link. If not, the card might not have been created."
18
+ end
19
+
20
+ private
21
+
22
+ def trello_board
23
+ @trello_board ||= Trello::Board.all.find do |b|
24
+ b.name.downcase == trello_board_name.downcase
25
+ end
26
+ end
27
+
28
+ def trello_list
29
+ @trello_list ||= trello_board.lists.find do |l|
30
+ l.name == "From Chat"
31
+ end
32
+ end
33
+
34
+ def trello_board_name
35
+ "#{parser.channel_name.titleize} Backlog"
36
+ end
37
+
38
+ def board_not_found_message
39
+ "A Trello board named '#{trello_board_name}' must be created and the Trello user in the codebase must be added to the board for the work command to function for this Slack room."
40
+ end
41
+
42
+ def list_not_found_message
43
+ "A Trello list named 'From Chat' must be added to the '#{trello_board_name}' board for the work command to function."
44
+ end
45
+
46
+ #def success_message
47
+ #":trello: [#{slack_name}] has created a new work card: <#{trello_card.short_url}|#{text.strip}>"
48
+ #end
49
+
50
+ def card_title
51
+ size = "(UNSIZED)"
52
+ title = parser.text.strip
53
+ tag = "{tag???}"
54
+ [size, title, tag].join(" ")
55
+ end
56
+
57
+ def create_trello_card
58
+ card = Trello::Card.new
59
+ card.name = card_title
60
+ card.list_id = trello_list.id
61
+ card.save
62
+ card.due = Time.now + 30.days
63
+ card.pos = "bottom"
64
+ card.save
65
+ self.trello_card = card
66
+ end
67
+
68
+ end; end
@@ -0,0 +1,7 @@
1
+ require "slack_trello/version"
2
+ require "slack_trello/response_parser"
3
+ require "slack_trello/text_parser"
4
+
5
+ module SlackTrello
6
+ # Your code goes here...
7
+ end
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'slack_trello/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "slack_trello"
8
+ spec.version = SlackTrello::VERSION
9
+ spec.authors = ["Matthew Powers"]
10
+ spec.email = ["matthewkevinpowers@gmail.com"]
11
+
12
+ spec.summary = %q{Using Slack slash commands to make cards on Trello boards.}
13
+ spec.description = %q{Helper methods to effectively use Slack & Trello with your team's Scrum processes.}
14
+ spec.homepage = "https://github.com/MrPowers/slack_trello"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ if spec.respond_to?(:metadata)
23
+ spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com' to prevent pushes to rubygems.org, or delete to allow pushes to any server."
24
+ end
25
+
26
+ spec.add_development_dependency "bundler", "~> 1.8"
27
+ spec.add_development_dependency "rake", "~> 10.0"
28
+ spec.add_dependency "ruby-trello"
29
+ end
metadata ADDED
@@ -0,0 +1,104 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: slack_trello
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Matthew Powers
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-05-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.8'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.8'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: ruby-trello
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Helper methods to effectively use Slack & Trello with your team's Scrum
56
+ processes.
57
+ email:
58
+ - matthewkevinpowers@gmail.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - .gitignore
64
+ - .rspec
65
+ - .travis.yml
66
+ - Gemfile
67
+ - LICENSE.txt
68
+ - README.md
69
+ - Rakefile
70
+ - bin/console
71
+ - bin/setup
72
+ - lib/slack_trello.rb
73
+ - lib/slack_trello/response_parser.rb
74
+ - lib/slack_trello/text_parser.rb
75
+ - lib/slack_trello/version.rb
76
+ - lib/slack_trello/work_command.rb
77
+ - slack_trello.gemspec
78
+ homepage: https://github.com/MrPowers/slack_trello
79
+ licenses:
80
+ - MIT
81
+ metadata:
82
+ allowed_push_host: 'TODO: Set to ''http://mygemserver.com'' to prevent pushes to
83
+ rubygems.org, or delete to allow pushes to any server.'
84
+ post_install_message:
85
+ rdoc_options: []
86
+ require_paths:
87
+ - lib
88
+ required_ruby_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - '>='
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - '>='
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ requirements: []
99
+ rubyforge_project:
100
+ rubygems_version: 2.0.0
101
+ signing_key:
102
+ specification_version: 4
103
+ summary: Using Slack slash commands to make cards on Trello boards.
104
+ test_files: []