github_flo 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: 84f1c4779eae28a2884b3b74667232325dc2e91b
4
+ data.tar.gz: b40b8a29aed56a18f0ad1497009102843cbea4e1
5
+ SHA512:
6
+ metadata.gz: 8345acf803a14ed6cb7214af7f1403862d13fc8867b7f7fa8a1a452102a5bb840160c0d11aaf6e8cacd75b9e4a970b33f0c38215e3edbc1cbbc1e42ad9b0a3f9
7
+ data.tar.gz: 583e18bba6df3d54d2607b811d62f40a1f2502d32c6d8474232b19d0c29d7868234e34c08bf65a1730ad02c7d414b67076009e1c9b05bd252cd8c1827c838498
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/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ # Copyright © 2017, Salesforce.com, Inc.
2
+ # All Rights Reserved.
3
+ # Licensed under the BSD 3-Clause license.
4
+ # For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
5
+
6
+ source 'https://rubygems.org'
7
+
8
+ # Specify your gem's dependencies in github_flo.gemspec
9
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,12 @@
1
+ Copyright (c) 2017, Salesforce.com, Inc.
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5
+
6
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7
+
8
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9
+
10
+ * Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11
+
12
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md ADDED
@@ -0,0 +1,70 @@
1
+ # GithubFlo
2
+ [![Gem Version](https://badge.fury.io/rb/github_flo.svg)](https://badge.fury.io/rb/github_flo) [![Code Climate](https://codeclimate.com/github/salesforce/github_flo/badges/gpa.svg)](https://codeclimate.com/github/salesforce/github_flo) [![Build Status](https://semaphoreci.com/api/v1/justinpowers/github_flo/branches/master/shields_badge.svg)](https://semaphoreci.com/justinpowers/github_flo)
3
+
4
+ GithubFlo is a Salesforce plugin for the Flo workflow automation library. If you aren't familiar with Flo, then please start [here](https://github.com/salesforce/flo)
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'github_flo'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install github_flo
21
+
22
+ ## Configuration
23
+
24
+ In your Flo configuration file, configure salesforce inside the `config` block
25
+
26
+ ```ruby
27
+ config do |cfg|
28
+ cfg.provider :github_flo, { user: ENV['OCTOKIT_TEST_USER'], token: ENV['OCTOKIT_TEST_TOKEN'], repo: 'salesforce/github_flo' }
29
+ end
30
+ ```
31
+
32
+ See the [Octokit gem](https://github.com/octokit/octokit.rb#authentication) for information on setting up the client.
33
+
34
+ ## Usage
35
+
36
+ Specify the commands you wish to run in the `register_command` block. For example
37
+ ```ruby
38
+ # Updates a github issue
39
+ perform :github_flo, :update_issue, { number: number, assignee: assignee }
40
+
41
+ # Adds a label to an issue
42
+ perform :github_flo, :add_labels_to_an_issue, { number: number, labels: ["Work in progress"] }
43
+
44
+ # Idempotently creates a pull request
45
+ perform :github_flo, :create_pull_request, { base: 'master', branch: "issues/#{number}", title: "Fixes #{number}", body: 'Some important details' }
46
+ ```
47
+
48
+ ## Contributing
49
+
50
+ 1. Fork it (http://github.com/your-github-username/github_flo/fork )
51
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
52
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
53
+ 4. Push to the branch (`git push origin my-new-feature`)
54
+ 5. Create new Pull Request
55
+
56
+
57
+ ## License
58
+
59
+ >Copyright (c) 2017, Salesforce.com, Inc.
60
+ >All rights reserved.
61
+ >
62
+ >Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
63
+ >
64
+ >* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
65
+ >
66
+ >* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
67
+ >
68
+ >* Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
69
+ >
70
+ >THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/Rakefile ADDED
@@ -0,0 +1,15 @@
1
+ # Copyright © 2017, Salesforce.com, Inc.
2
+ # All Rights Reserved.
3
+ # Licensed under the BSD 3-Clause license.
4
+ # For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
5
+
6
+ require "bundler/gem_tasks"
7
+ require "rake/testtask"
8
+
9
+ Rake::TestTask.new(:test) do |t|
10
+ t.libs << "test"
11
+ t.libs << "lib"
12
+ t.test_files = FileList['test/**/*_test.rb']
13
+ end
14
+
15
+ task :default => :test
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ # Copyright © 2017, Salesforce.com, Inc.
3
+ # All Rights Reserved.
4
+ # Licensed under the BSD 3-Clause license.
5
+ # For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+
7
+ lib = File.expand_path('../lib', __FILE__)
8
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
9
+ require 'github_flo/version'
10
+
11
+ Gem::Specification.new do |spec|
12
+ spec.name = "github_flo"
13
+ spec.version = GithubFlo::VERSION
14
+ spec.authors = ['Justin Powers', 'John Tuley']
15
+ spec.email = ['justin.powers@salesforce.com', 'jtuley@salesforce.com']
16
+
17
+ spec.summary = %q{"Github plugin for Flo"}
18
+ spec.homepage = "https://github.com/salesforce/github_flo"
19
+ spec.license = "BSD-3-Clause"
20
+
21
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^test/}) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.10"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "minitest"
27
+ spec.add_development_dependency "pry"
28
+
29
+ spec.add_dependency 'octokit', '~> 4.0.1'
30
+ end
@@ -0,0 +1,69 @@
1
+ # Copyright © 2017, Salesforce.com, Inc.
2
+ # All Rights Reserved.
3
+ # Licensed under the BSD 3-Clause license.
4
+ # For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
5
+
6
+ require 'octokit'
7
+
8
+ module Flo
9
+ module Provider
10
+ class GithubFlo
11
+
12
+ # Creates a new GithubFlo Provider instance
13
+ #
14
+ # @param [Hash] opts The options needed to create the provider
15
+ # @option opts [String] :user The username of the github user
16
+ # @option opts [String] :token an access token for the user
17
+ # @option opts [String] :repo the name of the repo, e.g. 'salesforce/github_flo'
18
+ #
19
+ def initialize(opts={})
20
+ username = opts[:user]
21
+ token = opts[:token]
22
+ @repo = opts[:repo]
23
+
24
+ @client = opts[:client] || Octokit::Client.new(login: username, password: token)
25
+ end
26
+
27
+ # Updates a Github issue
28
+ #
29
+ # @param [Hash] opts Options for updating an issue
30
+ # @option opts [String] :number The issue number to update
31
+ #
32
+ # Remaining options will be passed to octokit. See octokit's documentation for updating issues
33
+ #
34
+ def update_issue(opts={})
35
+ options = {repo: @repo}.merge(opts)
36
+ @client.update_issue(options.delete(:repo), options.delete(:number), options)
37
+ OpenStruct.new(success?: true)
38
+ end
39
+
40
+ # Adds labels to a Github Issue
41
+ #
42
+ # @param [Hash] opts Options for updating an issue
43
+ # @option opts [String] :number The issue number to update
44
+ # @option opts [Array<String>] :labels A list of labels to add to the issue
45
+ #
46
+ # Remaining options will be passed to octokit. See octokit's documentation for updating issues
47
+ #
48
+ def add_labels_to_an_issue(opts={})
49
+ options = {repo: @repo}.merge(opts)
50
+ @client.add_labels_to_an_issue(options.delete(:repo), options.delete(:number), options[:labels])
51
+ OpenStruct.new(success?: true)
52
+ end
53
+
54
+ # Provides an Octokit issue. This is helpful when you want to take some other action based on
55
+ # the state of an issue.
56
+ #
57
+ # @param [Hash] opts Options for finding the issue
58
+ # @option opts [String] :number The issue number to fetch
59
+ #
60
+ # @return [Sawyer::Resource] The issue returned from octokit
61
+ #
62
+ def issue(opts={})
63
+ options = {repo: @repo}.merge(opts)
64
+ @client.issue(options[:repo], options[:number])
65
+ end
66
+
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,8 @@
1
+ # Copyright © 2017, Salesforce.com, Inc.
2
+ # All Rights Reserved.
3
+ # Licensed under the BSD 3-Clause license.
4
+ # For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
5
+
6
+ module GithubFlo
7
+ VERSION = "0.0.1"
8
+ end
data/lib/github_flo.rb ADDED
@@ -0,0 +1,10 @@
1
+ # Copyright © 2017, Salesforce.com, Inc.
2
+ # All Rights Reserved.
3
+ # Licensed under the BSD 3-Clause license.
4
+ # For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
5
+
6
+ require "github_flo/version"
7
+
8
+ module GithubFlo
9
+ # Your code goes here...
10
+ end
metadata ADDED
@@ -0,0 +1,125 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: github_flo
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Justin Powers
8
+ - John Tuley
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2017-05-24 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: minitest
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: pry
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: octokit
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: 4.0.1
77
+ type: :runtime
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: 4.0.1
84
+ description:
85
+ email:
86
+ - justin.powers@salesforce.com
87
+ - jtuley@salesforce.com
88
+ executables: []
89
+ extensions: []
90
+ extra_rdoc_files: []
91
+ files:
92
+ - ".gitignore"
93
+ - Gemfile
94
+ - LICENSE.txt
95
+ - README.md
96
+ - Rakefile
97
+ - github_flo.gemspec
98
+ - lib/flo/provider/github_flo.rb
99
+ - lib/github_flo.rb
100
+ - lib/github_flo/version.rb
101
+ homepage: https://github.com/salesforce/github_flo
102
+ licenses:
103
+ - BSD-3-Clause
104
+ metadata: {}
105
+ post_install_message:
106
+ rdoc_options: []
107
+ require_paths:
108
+ - lib
109
+ required_ruby_version: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
114
+ required_rubygems_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ requirements: []
120
+ rubyforge_project:
121
+ rubygems_version: 2.5.2
122
+ signing_key:
123
+ specification_version: 4
124
+ summary: '"Github plugin for Flo"'
125
+ test_files: []