cmd_executable 0.1.4 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/gem-push.yml +42 -0
- data/README.md +15 -2
- data/cmd_executable.gemspec +15 -10
- data/exe/cmd_executable +3 -1
- data/lib/cmd_executable.rb +5 -6
- data/lib/cmd_executable/parser.rb +96 -0
- data/lib/cmd_executable/runner.rb +56 -0
- data/lib/cmd_executable/version.rb +1 -1
- metadata +60 -30
- data/.github/workflows/release.yml +0 -50
- data/.travis.yml +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 946605fbae86fd31435538a3a032333fd66673b5667e11f20d8c5c5001a5f7f7
|
4
|
+
data.tar.gz: 85ddeaf7c6f07a9d95dbf6d634967c5ad863660c4fa545fe64181d1d27712de8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 788cf46157ad006a44a6df48d5981393660be6c4b12c62b34afbb58e3864c8ac5e6085b31c942cb49f33d60fc7a6efdab9862e571c41a94d671e6842c3ba284d
|
7
|
+
data.tar.gz: 45a773c916e5a7b5b6d2db49f4806307d0920be70303f837c5c6269c72132723e734b9ca9e4b88b291d464c3023f666e2cfda7de63d783ec596b67f9ca5c62ac
|
@@ -0,0 +1,42 @@
|
|
1
|
+
name: Ruby Gem
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ master ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
build:
|
11
|
+
name: Build + Publish
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
|
14
|
+
steps:
|
15
|
+
- uses: actions/checkout@v2
|
16
|
+
- name: Set up Ruby 2.6
|
17
|
+
uses: actions/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
version: 2.6.x
|
20
|
+
|
21
|
+
- name: Publish to GPR
|
22
|
+
run: |
|
23
|
+
mkdir -p $HOME/.gem
|
24
|
+
touch $HOME/.gem/credentials
|
25
|
+
chmod 0600 $HOME/.gem/credentials
|
26
|
+
printf -- "---\n:github: Bearer ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
27
|
+
gem build *.gemspec
|
28
|
+
gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
|
29
|
+
env:
|
30
|
+
GEM_HOST_API_KEY: ${{secrets.GPR_AUTH_TOKEN}}
|
31
|
+
OWNER: toshiki670
|
32
|
+
|
33
|
+
- name: Publish to RubyGems
|
34
|
+
run: |
|
35
|
+
mkdir -p $HOME/.gem
|
36
|
+
touch $HOME/.gem/credentials
|
37
|
+
chmod 0600 $HOME/.gem/credentials
|
38
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
39
|
+
gem build *.gemspec
|
40
|
+
gem push *.gem
|
41
|
+
env:
|
42
|
+
GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}}
|
data/README.md
CHANGED
@@ -14,13 +14,14 @@ gem 'cmd_executable'
|
|
14
14
|
|
15
15
|
And then execute:
|
16
16
|
|
17
|
-
|
17
|
+
`$ bundle install`
|
18
18
|
|
19
19
|
Or install it yourself as:
|
20
20
|
|
21
|
-
|
21
|
+
`$ gem install cmd_executable`
|
22
22
|
|
23
23
|
## Usage
|
24
|
+
### as Module
|
24
25
|
```
|
25
26
|
require 'cmd_executable'
|
26
27
|
|
@@ -32,6 +33,18 @@ class Klass
|
|
32
33
|
end
|
33
34
|
end
|
34
35
|
```
|
36
|
+
### as CLI
|
37
|
+
Check executable? :
|
38
|
+
|
39
|
+
`$ cmd_executable -c [/path/to/command]`
|
40
|
+
or
|
41
|
+
`$ cmd_executable -c [../path/to/command]`
|
42
|
+
or
|
43
|
+
`$ cmd_executable -c [command]`
|
44
|
+
|
45
|
+
Show help :
|
46
|
+
|
47
|
+
`$ cmd_executable -h`
|
35
48
|
|
36
49
|
## Development
|
37
50
|
|
data/cmd_executable.gemspec
CHANGED
@@ -9,12 +9,14 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.email = ['toshiki.dev@protonmail.ch']
|
10
10
|
|
11
11
|
spec.summary = 'The command executable module.'
|
12
|
-
spec.description = '
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
spec.description = <<-'DESC'
|
13
|
+
This module adds a method "executable?(command)".
|
14
|
+
it's return true if given command usable on Linux.
|
15
|
+
DESC
|
16
16
|
|
17
|
-
spec.
|
17
|
+
spec.homepage = 'https://github.com/toshiki670/cmd_executable'
|
18
|
+
spec.license = 'MIT'
|
19
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.7.0')
|
18
20
|
|
19
21
|
spec.metadata['homepage_uri'] = spec.homepage
|
20
22
|
spec.metadata['source_code_uri'] = 'https://github.com/toshiki670/cmd_executable'
|
@@ -29,9 +31,12 @@ Gem::Specification.new do |spec|
|
|
29
31
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
30
32
|
spec.require_paths = ['lib']
|
31
33
|
|
32
|
-
spec.add_development_dependency 'bundler'
|
33
|
-
spec.add_development_dependency 'pry'
|
34
|
-
spec.add_development_dependency '
|
35
|
-
spec.add_development_dependency '
|
36
|
-
spec.add_development_dependency '
|
34
|
+
spec.add_development_dependency 'bundler', '~> 2.1'
|
35
|
+
spec.add_development_dependency 'pry', '~> 0.13.1'
|
36
|
+
spec.add_development_dependency 'pry-doc', '~> 1.1'
|
37
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
38
|
+
spec.add_development_dependency 'rspec', '~> 3.9'
|
39
|
+
spec.add_development_dependency 'rubocop', '~> 0.85.0'
|
40
|
+
|
41
|
+
spec.add_dependency 'thor', '~> 1.0'
|
37
42
|
end
|
data/exe/cmd_executable
CHANGED
data/lib/cmd_executable.rb
CHANGED
@@ -23,6 +23,8 @@
|
|
23
23
|
# THE SOFTWARE.
|
24
24
|
|
25
25
|
require 'English'
|
26
|
+
require 'cmd_executable/parser'
|
27
|
+
require 'cmd_executable/runner'
|
26
28
|
require 'cmd_executable/version'
|
27
29
|
|
28
30
|
# Command Executable
|
@@ -41,13 +43,10 @@ module CmdExecutable
|
|
41
43
|
class CmdExecutableError < StandardError; end
|
42
44
|
|
43
45
|
def executable?(command)
|
44
|
-
|
45
|
-
|
46
|
-
dirname += File::SEPARATOR if dirname.rindex(File::SEPARATOR)
|
47
|
-
dirname + basename.split.first
|
48
|
-
end
|
46
|
+
parsed = CmdExecutable::Parser.new(command)
|
47
|
+
raise ArgumentError unless parsed.validate?
|
49
48
|
|
50
|
-
`type '#{
|
49
|
+
`type '#{parsed.command}' > /dev/null 2>&1`.yield_self do
|
51
50
|
$CHILD_STATUS.success?
|
52
51
|
end
|
53
52
|
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The MIT License (MIT)
|
4
|
+
#
|
5
|
+
# Copyright (c) 2020 Toshiki
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included in
|
15
|
+
# all copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23
|
+
# THE SOFTWARE.
|
24
|
+
|
25
|
+
require 'English'
|
26
|
+
|
27
|
+
module CmdExecutable
|
28
|
+
class ParserError < StandardError; end
|
29
|
+
|
30
|
+
# Parser for CmdExecutable
|
31
|
+
class Parser
|
32
|
+
def initialize(raw)
|
33
|
+
@raw = raw
|
34
|
+
@raw.freeze
|
35
|
+
end
|
36
|
+
|
37
|
+
def validate?
|
38
|
+
!@raw.nil? &&
|
39
|
+
command_class_validate? &&
|
40
|
+
!@raw.empty?
|
41
|
+
end
|
42
|
+
|
43
|
+
def command
|
44
|
+
parse if @command.nil?
|
45
|
+
@command
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def command_class_validate?
|
51
|
+
@raw.is_a?(String) ||
|
52
|
+
@raw.is_a?(Symbol)
|
53
|
+
end
|
54
|
+
|
55
|
+
def parse
|
56
|
+
raise CmdExecutable::ParserError unless validate?
|
57
|
+
|
58
|
+
path = @raw.to_s.chomp
|
59
|
+
@dirname = parse_dirname(path)
|
60
|
+
@basename = parse_basename(path)
|
61
|
+
@command = @dirname + @basename
|
62
|
+
self
|
63
|
+
end
|
64
|
+
|
65
|
+
def no_separator_at_the_right_end_regex
|
66
|
+
/(?<!#{File::SEPARATOR})\Z/
|
67
|
+
end
|
68
|
+
|
69
|
+
def a_dot_only_regex
|
70
|
+
/\A\.\Z/
|
71
|
+
end
|
72
|
+
|
73
|
+
def basename_exist?(path)
|
74
|
+
path.match?(no_separator_at_the_right_end_regex)
|
75
|
+
end
|
76
|
+
|
77
|
+
def no_right_separator_exists?(dir)
|
78
|
+
dir.match?(no_separator_at_the_right_end_regex)
|
79
|
+
end
|
80
|
+
|
81
|
+
def parse_dirname(path)
|
82
|
+
return path unless basename_exist?(path)
|
83
|
+
|
84
|
+
dir = File.dirname(path)
|
85
|
+
return '' if dir.match?(a_dot_only_regex)
|
86
|
+
|
87
|
+
no_right_separator_exists?(dir) ? (dir + File::SEPARATOR) : dir
|
88
|
+
end
|
89
|
+
|
90
|
+
def parse_basename(path)
|
91
|
+
return '' unless basename_exist?(path)
|
92
|
+
|
93
|
+
File.basename(path).split.first
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The MIT License (MIT)
|
4
|
+
#
|
5
|
+
# Copyright (c) 2020 Toshiki
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included in
|
15
|
+
# all copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23
|
+
# THE SOFTWARE.
|
24
|
+
|
25
|
+
require 'cmd_executable'
|
26
|
+
require 'thor'
|
27
|
+
|
28
|
+
module CmdExecutable
|
29
|
+
# CLI Runner
|
30
|
+
#
|
31
|
+
# Usage on CLI:
|
32
|
+
# $ cmd_executable ls
|
33
|
+
# > OK
|
34
|
+
class Runner < Thor
|
35
|
+
include CmdExecutable
|
36
|
+
|
37
|
+
map '-c' => :check
|
38
|
+
|
39
|
+
desc '-c [/path/to/command]', "It's return true if given command usable on Linux."
|
40
|
+
def check(command = '')
|
41
|
+
if executable?(command)
|
42
|
+
puts 'OK'
|
43
|
+
exit 0
|
44
|
+
else
|
45
|
+
puts 'NOT FOUND'
|
46
|
+
exit 1
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
map %w[-v --version] => :version
|
51
|
+
desc '-v --version', 'Show version.'
|
52
|
+
def version
|
53
|
+
STDOUT.puts CmdExecutable::VERSION
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
metadata
CHANGED
@@ -1,86 +1,116 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cmd_executable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toshiki
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.1'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: pry
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 0.13.1
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 0.13.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry-doc
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.1'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.1'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rake
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- - "
|
59
|
+
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
61
|
+
version: '13.0'
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- - "
|
66
|
+
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
68
|
+
version: '13.0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rspec
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
|
-
- - "
|
73
|
+
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
75
|
+
version: '3.9'
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
|
-
- - "
|
80
|
+
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
82
|
+
version: '3.9'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: rubocop
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
|
-
- - "
|
87
|
+
- - "~>"
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
89
|
+
version: 0.85.0
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
|
-
- - "
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.85.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: thor
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '1.0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
81
109
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
description:
|
110
|
+
version: '1.0'
|
111
|
+
description: |2
|
112
|
+
This module adds a method "executable?(command)".
|
113
|
+
it's return true if given command usable on Linux.
|
84
114
|
email:
|
85
115
|
- toshiki.dev@protonmail.ch
|
86
116
|
executables:
|
@@ -88,11 +118,10 @@ executables:
|
|
88
118
|
extensions: []
|
89
119
|
extra_rdoc_files: []
|
90
120
|
files:
|
91
|
-
- ".github/workflows/
|
121
|
+
- ".github/workflows/gem-push.yml"
|
92
122
|
- ".github/workflows/ruby_check.yml"
|
93
123
|
- ".gitignore"
|
94
124
|
- ".rubocop.yml"
|
95
|
-
- ".travis.yml"
|
96
125
|
- CODE_OF_CONDUCT.md
|
97
126
|
- Gemfile
|
98
127
|
- LICENSE
|
@@ -103,13 +132,14 @@ files:
|
|
103
132
|
- cmd_executable.gemspec
|
104
133
|
- exe/cmd_executable
|
105
134
|
- lib/cmd_executable.rb
|
135
|
+
- lib/cmd_executable/parser.rb
|
136
|
+
- lib/cmd_executable/runner.rb
|
106
137
|
- lib/cmd_executable/version.rb
|
107
|
-
homepage: https://github.com/toshiki670/cmd_executable
|
138
|
+
homepage: https://github.com/toshiki670/cmd_executable
|
108
139
|
licenses:
|
109
140
|
- MIT
|
110
141
|
metadata:
|
111
|
-
|
112
|
-
homepage_uri: https://github.com/toshiki670/cmd_executable/wiki
|
142
|
+
homepage_uri: https://github.com/toshiki670/cmd_executable
|
113
143
|
source_code_uri: https://github.com/toshiki670/cmd_executable
|
114
144
|
changelog_uri: https://github.com/toshiki670/cmd_executable/releases
|
115
145
|
post_install_message:
|
@@ -120,14 +150,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
120
150
|
requirements:
|
121
151
|
- - ">="
|
122
152
|
- !ruby/object:Gem::Version
|
123
|
-
version: 2.
|
153
|
+
version: 2.7.0
|
124
154
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
155
|
requirements:
|
126
156
|
- - ">="
|
127
157
|
- !ruby/object:Gem::Version
|
128
158
|
version: '0'
|
129
159
|
requirements: []
|
130
|
-
rubygems_version: 3.
|
160
|
+
rubygems_version: 3.0.3
|
131
161
|
signing_key:
|
132
162
|
specification_version: 4
|
133
163
|
summary: The command executable module.
|
@@ -1,50 +0,0 @@
|
|
1
|
-
# This workflow uses actions that are not certified by GitHub.
|
2
|
-
# They are provided by a third-party and are governed by
|
3
|
-
# separate terms of service, privacy policy, and support
|
4
|
-
# documentation.
|
5
|
-
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
-
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
-
|
8
|
-
name: Release
|
9
|
-
|
10
|
-
on:
|
11
|
-
push:
|
12
|
-
branches: [ master ]
|
13
|
-
pull_request:
|
14
|
-
branches: [ master ]
|
15
|
-
|
16
|
-
jobs:
|
17
|
-
release:
|
18
|
-
|
19
|
-
runs-on: ubuntu-latest
|
20
|
-
|
21
|
-
steps:
|
22
|
-
- uses: actions/checkout@v2
|
23
|
-
- name: Set up Ruby
|
24
|
-
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
25
|
-
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
26
|
-
# uses: ruby/setup-ruby@v1
|
27
|
-
uses: ruby/setup-ruby@ec106b438a1ff6ff109590de34ddc62c540232e0
|
28
|
-
with:
|
29
|
-
ruby-version: 2.7
|
30
|
-
- name: Install dependencies
|
31
|
-
run: |
|
32
|
-
bundle config set path 'vendor/bundle'
|
33
|
-
bundle install --jobs=8
|
34
|
-
- name: Create credentials
|
35
|
-
run: |
|
36
|
-
mkdir -p ~/.gem
|
37
|
-
echo '---' > ~/.gem/credentials
|
38
|
-
echo ":rubygems_api_key: $RUBYGEMS_API_ACCESS_KEY" >> ~/.gem/credentials
|
39
|
-
chmod 0600 ~/.gem/credentials
|
40
|
-
- name: Setup git
|
41
|
-
run: |
|
42
|
-
git config push.default current
|
43
|
-
git config user.email "toshiki.dev@protonmail.ch"
|
44
|
-
git config user.name "Toshiki"
|
45
|
-
- name: Release
|
46
|
-
run: |
|
47
|
-
bundle exec rake build
|
48
|
-
bundle exec rake release
|
49
|
-
- name: Remove credentials
|
50
|
-
run: shred -u ~/.gem/credentials
|