ruboty-github_create_deployment 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: cd38ef12adf8f254a7d7d3fa13a1c293098c1a3cc632105d3565a27f93aa01d7
4
+ data.tar.gz: 960bbbc9cc38f305a439b3f7a03253ba2aaa4f0caaa5741a631e9f83040d0e74
5
+ SHA512:
6
+ metadata.gz: 21a507d2f6ddb6745754e28fb09da24b5a785776f98cb1ce3f709e3c7a77ea5cc5cf4c3a9addccac4164390d3d879acdf0addbe9e0fb80a3367771857707355d
7
+ data.tar.gz: 7ead62ccddc05eaeb03386e813704f8bfe4eac1f08a167c0a8ce6fa2fa19c63deb6522dba019d0e7525a49d6fe002913f95571b5a623e918012c12e6cbebf97d
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /Gemfile.lock
data/.rakeTasks ADDED
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Settings><!--This file was automatically generated by Ruby plugin.
3
+ You are allowed to:
4
+ 1. Remove rake task
5
+ 2. Add existing rake tasks
6
+ To add existing rake tasks automatically delete this file and reload the project.
7
+ --><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in ruboty-github_create_deployment.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # Ruboty::GithubCreateDeployment
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/ruboty/github_create_deployment`. 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 'ruboty-github_create_deployment'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install ruboty-github_create_deployment
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. You can also 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`, which will 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
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/ruboty-github_create_deployment.
36
+
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "ruboty/github_create_deployment"
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(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "ruboty/github"
4
+ require "ruboty/github_create_deployment/version"
5
+ require "ruboty/github_create_deployment/actions/create_deployment"
6
+ require "ruboty/handlers/github_create_deployment"
7
+
8
+ module Ruboty
9
+ module GithubCreateDeployment
10
+ class Error < StandardError; end
11
+ # Your code goes here...
12
+ end
13
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ruboty
4
+ module GithubCreateDeployment
5
+ module Actions
6
+ class CreateDeployment < Ruboty::Github::Actions::Base
7
+ def call
8
+ if has_access_token?
9
+ create
10
+ else
11
+ require_access_token
12
+ end
13
+ end
14
+
15
+ private def create
16
+ client.create_deployment(
17
+ repository,
18
+ ref,
19
+ {
20
+ auto_merge: false,
21
+ environment: message[:environment],
22
+ }.compact,
23
+ )
24
+
25
+ message.reply("Created!")
26
+ rescue Octokit::Unauthorized
27
+ message.reply("Failed in authentication (401)")
28
+ rescue Octokit::NotFound
29
+ message.reply("Could not find that repository")
30
+ rescue => exception
31
+ message.reply("Failed by #{exception.class}")
32
+ end
33
+
34
+ private def git_ref
35
+ message[:git_ref]
36
+ end
37
+
38
+ private def repository
39
+ git_ref.split(":").first
40
+ end
41
+
42
+ private def ref
43
+ git_ref.split(":").last
44
+ end
45
+
46
+ private def environment
47
+ message[:environment]
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,5 @@
1
+ module Ruboty
2
+ module GithubCreateDeployment
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ruboty
4
+ module Handlers
5
+ class GithubCreateDeployment < Base
6
+ on(
7
+ /create deployment of (?<git_ref>.+)( to (?<environment>.+))?\z/,
8
+ name: "create_deployment",
9
+ description: "Generate deployment on GitHub",
10
+ )
11
+
12
+ def create_deployment(message)
13
+ Ruboty::GithubCreateDeployment::Actions::CreateDeployment.new(message).call
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,38 @@
1
+ require_relative 'lib/ruboty/github_create_deployment/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "ruboty-github_create_deployment"
5
+ spec.version = Ruboty::GithubCreateDeployment::VERSION
6
+ spec.authors = ["Kouhei Suzuki"]
7
+ spec.email = ["kouhei.szk@gmail.com"]
8
+
9
+ spec.summary = "Ruboty plugin for create a GitHub deployment"
10
+ spec.description = "Ruboty plugin for create a GitHub deployment"
11
+ spec.homepage = "https://github.com/refcome/ruboty-github_create_deployment"
12
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
13
+
14
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
15
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
16
+ if spec.respond_to?(:metadata)
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = spec.homepage
19
+ spec.metadata["changelog_uri"] = spec.homepage
20
+ else
21
+ raise "RubyGems 2.0 or newer is required to protect against " \
22
+ "public gem pushes."
23
+ end
24
+
25
+ # Specify which files should be added to the gem when it is released.
26
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
27
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
28
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
29
+ end
30
+ spec.bindir = "exe"
31
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
32
+ spec.require_paths = ["lib"]
33
+
34
+ spec.add_dependency "ruboty-github"
35
+
36
+ spec.add_development_dependency "bundler"
37
+ spec.add_development_dependency "rake"
38
+ end
metadata ADDED
@@ -0,0 +1,99 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruboty-github_create_deployment
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Kouhei Suzuki
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-04-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ruboty-github
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Ruboty plugin for create a GitHub deployment
56
+ email:
57
+ - kouhei.szk@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rakeTasks"
64
+ - Gemfile
65
+ - README.md
66
+ - Rakefile
67
+ - bin/console
68
+ - bin/setup
69
+ - lib/ruboty/github_create_deployment.rb
70
+ - lib/ruboty/github_create_deployment/actions/create_deployment.rb
71
+ - lib/ruboty/github_create_deployment/version.rb
72
+ - lib/ruboty/handlers/github_create_deployment.rb
73
+ - ruboty-github_create_deployment.gemspec
74
+ homepage: https://github.com/refcome/ruboty-github_create_deployment
75
+ licenses: []
76
+ metadata:
77
+ homepage_uri: https://github.com/refcome/ruboty-github_create_deployment
78
+ source_code_uri: https://github.com/refcome/ruboty-github_create_deployment
79
+ changelog_uri: https://github.com/refcome/ruboty-github_create_deployment
80
+ post_install_message:
81
+ rdoc_options: []
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: 2.3.0
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ requirements: []
95
+ rubygems_version: 3.0.3
96
+ signing_key:
97
+ specification_version: 4
98
+ summary: Ruboty plugin for create a GitHub deployment
99
+ test_files: []