scc-foundation 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.standard.yml +3 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +17 -0
- data/Gemfile.lock +107 -0
- data/LICENSE.txt +21 -0
- data/README.md +33 -0
- data/Rakefile +10 -0
- data/exe/scc-build-deploy-manifest-from-git +5 -0
- data/lib/scc/commands/build_manifest_from_git.rb +72 -0
- data/lib/scc/deploy_info/extractor/dummy.rb +19 -0
- data/lib/scc/deploy_info/extractor/error.rb +12 -0
- data/lib/scc/deploy_info/extractor/file.rb +45 -0
- data/lib/scc/deploy_info/extractor/git.rb +53 -0
- data/lib/scc/deploy_info.rb +91 -0
- data/lib/scc/utils.rb +19 -0
- data/lib/scc/version.rb +5 -0
- data/lib/scc.rb +7 -0
- data/scc.gemspec +38 -0
- metadata +66 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: '092e1a02ccd4f53cd7473a1fb1cc05ccbc4d4367645e7fc50b61723cccd8d99b'
|
4
|
+
data.tar.gz: f02e560aaee184a3b52b90e3f96c9c5088d9f9a5af8cd817d2ae668d133e732d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8132e3bb90970b5eaa7c67b32026f513fb5b738a84b3574a9d4c954c75b4c5996d84752c6b557e8511cac4b3fdb18e658506434dcc6eaca88cc6f0d39063859d
|
7
|
+
data.tar.gz: 895dc6a721d3c933f737e745674c8d115d385874a3bda68098e8e588b6b0695310674a6e423d003db87b1a1c1d41b848f9c5c6c95eca089b73d595df53e8f28b
|
data/.rspec
ADDED
data/.standard.yml
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in scc.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
gem "rake", "~> 13.0"
|
9
|
+
|
10
|
+
group :development, :test do
|
11
|
+
gem "rspec", "~> 3.0"
|
12
|
+
gem "standard", "~> 1.3"
|
13
|
+
gem "brakeman", require: false
|
14
|
+
gem "simplecov", require: false
|
15
|
+
gem "simplecov-cobertura", require: false
|
16
|
+
gem "debug"
|
17
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
scc-foundation (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
ast (2.4.2)
|
10
|
+
brakeman (6.1.1)
|
11
|
+
racc
|
12
|
+
debug (1.9.1)
|
13
|
+
irb (~> 1.10)
|
14
|
+
reline (>= 0.3.8)
|
15
|
+
diff-lcs (1.5.0)
|
16
|
+
docile (1.4.0)
|
17
|
+
io-console (0.7.2)
|
18
|
+
irb (1.11.1)
|
19
|
+
rdoc
|
20
|
+
reline (>= 0.4.2)
|
21
|
+
json (2.7.1)
|
22
|
+
language_server-protocol (3.17.0.3)
|
23
|
+
lint_roller (1.1.0)
|
24
|
+
parallel (1.24.0)
|
25
|
+
parser (3.2.2.4)
|
26
|
+
ast (~> 2.4.1)
|
27
|
+
racc
|
28
|
+
psych (5.1.2)
|
29
|
+
stringio
|
30
|
+
racc (1.7.3)
|
31
|
+
rainbow (3.1.1)
|
32
|
+
rake (13.1.0)
|
33
|
+
rdoc (6.6.2)
|
34
|
+
psych (>= 4.0.0)
|
35
|
+
regexp_parser (2.8.3)
|
36
|
+
reline (0.4.2)
|
37
|
+
io-console (~> 0.5)
|
38
|
+
rexml (3.2.6)
|
39
|
+
rspec (3.12.0)
|
40
|
+
rspec-core (~> 3.12.0)
|
41
|
+
rspec-expectations (~> 3.12.0)
|
42
|
+
rspec-mocks (~> 3.12.0)
|
43
|
+
rspec-core (3.12.2)
|
44
|
+
rspec-support (~> 3.12.0)
|
45
|
+
rspec-expectations (3.12.3)
|
46
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
47
|
+
rspec-support (~> 3.12.0)
|
48
|
+
rspec-mocks (3.12.6)
|
49
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
50
|
+
rspec-support (~> 3.12.0)
|
51
|
+
rspec-support (3.12.1)
|
52
|
+
rubocop (1.57.2)
|
53
|
+
json (~> 2.3)
|
54
|
+
language_server-protocol (>= 3.17.0)
|
55
|
+
parallel (~> 1.10)
|
56
|
+
parser (>= 3.2.2.4)
|
57
|
+
rainbow (>= 2.2.2, < 4.0)
|
58
|
+
regexp_parser (>= 1.8, < 3.0)
|
59
|
+
rexml (>= 3.2.5, < 4.0)
|
60
|
+
rubocop-ast (>= 1.28.1, < 2.0)
|
61
|
+
ruby-progressbar (~> 1.7)
|
62
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
63
|
+
rubocop-ast (1.30.0)
|
64
|
+
parser (>= 3.2.1.0)
|
65
|
+
rubocop-performance (1.19.1)
|
66
|
+
rubocop (>= 1.7.0, < 2.0)
|
67
|
+
rubocop-ast (>= 0.4.0)
|
68
|
+
ruby-progressbar (1.13.0)
|
69
|
+
simplecov (0.22.0)
|
70
|
+
docile (~> 1.1)
|
71
|
+
simplecov-html (~> 0.11)
|
72
|
+
simplecov_json_formatter (~> 0.1)
|
73
|
+
simplecov-cobertura (2.1.0)
|
74
|
+
rexml
|
75
|
+
simplecov (~> 0.19)
|
76
|
+
simplecov-html (0.12.3)
|
77
|
+
simplecov_json_formatter (0.1.4)
|
78
|
+
standard (1.32.0)
|
79
|
+
language_server-protocol (~> 3.17.0.2)
|
80
|
+
lint_roller (~> 1.0)
|
81
|
+
rubocop (~> 1.57.2)
|
82
|
+
standard-custom (~> 1.0.0)
|
83
|
+
standard-performance (~> 1.2)
|
84
|
+
standard-custom (1.0.2)
|
85
|
+
lint_roller (~> 1.0)
|
86
|
+
rubocop (~> 1.50)
|
87
|
+
standard-performance (1.2.1)
|
88
|
+
lint_roller (~> 1.1)
|
89
|
+
rubocop-performance (~> 1.19.1)
|
90
|
+
stringio (3.1.0)
|
91
|
+
unicode-display_width (2.5.0)
|
92
|
+
|
93
|
+
PLATFORMS
|
94
|
+
x86_64-linux
|
95
|
+
|
96
|
+
DEPENDENCIES
|
97
|
+
brakeman
|
98
|
+
debug
|
99
|
+
rake (~> 13.0)
|
100
|
+
rspec (~> 3.0)
|
101
|
+
scc-foundation!
|
102
|
+
simplecov
|
103
|
+
simplecov-cobertura
|
104
|
+
standard (~> 1.3)
|
105
|
+
|
106
|
+
BUNDLED WITH
|
107
|
+
2.4.10
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2024 Jose D. Gomez R.
|
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,33 @@
|
|
1
|
+
# Scc Foundation Helpers
|
2
|
+
|
3
|
+
Foundational helpers for SCC Rails applications
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
|
8
|
+
|
9
|
+
Install the gem and add to the application's Gemfile by executing:
|
10
|
+
|
11
|
+
$ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
|
12
|
+
|
13
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
14
|
+
|
15
|
+
$ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
TODO: Write usage instructions here
|
20
|
+
|
21
|
+
## Development
|
22
|
+
|
23
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
24
|
+
|
25
|
+
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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
26
|
+
|
27
|
+
## Contributing
|
28
|
+
|
29
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/scc.
|
30
|
+
|
31
|
+
## License
|
32
|
+
|
33
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "optionparser"
|
4
|
+
require "yaml"
|
5
|
+
require "scc/deploy_info"
|
6
|
+
|
7
|
+
module Scc
|
8
|
+
module Commands
|
9
|
+
class BuildManifestFromGit
|
10
|
+
def parse_args(argv)
|
11
|
+
options = {}
|
12
|
+
OptionParser.new do |opts|
|
13
|
+
opts.banner = "Usage: scc-build-deploy-manifest-from-git [options]"
|
14
|
+
|
15
|
+
opts.on("-o", "--output FILE", "Output file") do |file|
|
16
|
+
options[:output_file] = file
|
17
|
+
end
|
18
|
+
|
19
|
+
opts.on("-d", "--git-dir PATH", "Git root") do |git_root|
|
20
|
+
options[:git_root] = git_root
|
21
|
+
end
|
22
|
+
|
23
|
+
opts.on("-h", "--help", "Prints this help") do
|
24
|
+
options[:early_exit] = true
|
25
|
+
puts opts
|
26
|
+
end
|
27
|
+
|
28
|
+
opts.on("-v", "--version", "Prints gem version") do
|
29
|
+
options[:early_exit] = true
|
30
|
+
puts Scc::VERSION
|
31
|
+
end
|
32
|
+
end.parse!(argv)
|
33
|
+
|
34
|
+
options
|
35
|
+
end
|
36
|
+
|
37
|
+
def call(argv)
|
38
|
+
argv = %w[-h] if argv.empty?
|
39
|
+
options = parse_args(argv)
|
40
|
+
|
41
|
+
# early exits
|
42
|
+
return options[:early_exit] if options[:early_exit]
|
43
|
+
|
44
|
+
deploy_info = Scc::DeployInfo.from_git(root: options[:git_root])
|
45
|
+
deploy_info.extract!
|
46
|
+
|
47
|
+
open_and_yield(options[:output_file]) do |f|
|
48
|
+
f.puts(YAML.dump(deploy_info.to_poro))
|
49
|
+
end
|
50
|
+
|
51
|
+
0
|
52
|
+
rescue Scc::DeployInfo::Extractor::Git::NotAGitRootError => e
|
53
|
+
puts e.message
|
54
|
+
1
|
55
|
+
end
|
56
|
+
|
57
|
+
private
|
58
|
+
|
59
|
+
def open_and_yield(filepath)
|
60
|
+
output_file = $stdout
|
61
|
+
|
62
|
+
unless filepath.nil? || filepath == "-"
|
63
|
+
output_file = File.open(filepath, "w+")
|
64
|
+
end
|
65
|
+
|
66
|
+
yield output_file
|
67
|
+
|
68
|
+
output_file.close
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Scc
|
4
|
+
class DeployInfo
|
5
|
+
module Extractor
|
6
|
+
class Dummy
|
7
|
+
def call
|
8
|
+
{
|
9
|
+
origin: "UNKNOWN",
|
10
|
+
deploy_ref: "UNKNOWN",
|
11
|
+
commit_sha: "UNKNOWN",
|
12
|
+
commit_date: "UNKNOWN",
|
13
|
+
commit_subject: "UNKNOWN"
|
14
|
+
}
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "date"
|
4
|
+
require "time"
|
5
|
+
require "yaml"
|
6
|
+
|
7
|
+
module Scc
|
8
|
+
class DeployInfo
|
9
|
+
module Extractor
|
10
|
+
class File < Dummy
|
11
|
+
class ManifestNotFound < Error
|
12
|
+
end
|
13
|
+
|
14
|
+
class ManifestEmpty < Error
|
15
|
+
end
|
16
|
+
|
17
|
+
class ManifestInvalid < Error
|
18
|
+
end
|
19
|
+
|
20
|
+
def initialize(filename: "deploy_info.yml")
|
21
|
+
@filename = filename
|
22
|
+
@origin = "file"
|
23
|
+
end
|
24
|
+
|
25
|
+
def call
|
26
|
+
loaded_yaml = YAML.safe_load_file(@filename, permitted_classes: [::Date, ::Time, ::DateTime],
|
27
|
+
symbolize_names: true)
|
28
|
+
|
29
|
+
raise ManifestEmpty, "Deploy manifest is empty" unless loaded_yaml
|
30
|
+
raise ManifestInvalid, "Deploy manifest is not a hash" unless loaded_yaml.is_a?(Hash)
|
31
|
+
|
32
|
+
deploy_info = super.merge(loaded_yaml.compact)
|
33
|
+
|
34
|
+
deploy_info[:origin] = "FILE"
|
35
|
+
deploy_info[:commit_date] = Scc::Utils.try_parse_date(deploy_info[:commit_date])
|
36
|
+
deploy_info
|
37
|
+
rescue ::Errno::ENOENT, Errno::EISDIR
|
38
|
+
raise ManifestNotFound, "Could not find manifest file in #{@filename}"
|
39
|
+
rescue ::Psych::Exception # YAML parsing errors
|
40
|
+
raise ManifestInvalid, "Could not parse YAML from manifest file"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "scc/utils"
|
4
|
+
require "English"
|
5
|
+
|
6
|
+
module Scc
|
7
|
+
class DeployInfo
|
8
|
+
module Extractor
|
9
|
+
class Git < Dummy
|
10
|
+
GIT_SHOW_SEPARATOR = "|-*-|"
|
11
|
+
GIT_SHOW_FORMAT = %w[%D %H %s %aI].join(GIT_SHOW_SEPARATOR).freeze
|
12
|
+
|
13
|
+
class NotAGitRootError < Error
|
14
|
+
end
|
15
|
+
|
16
|
+
attr_reader :root
|
17
|
+
|
18
|
+
def initialize(root: ".")
|
19
|
+
@root = root
|
20
|
+
end
|
21
|
+
|
22
|
+
def call
|
23
|
+
parts = Dir.chdir(root) do
|
24
|
+
IO.popen(git_show_command, err: "/dev/null", &:read).strip.split(GIT_SHOW_SEPARATOR)
|
25
|
+
end
|
26
|
+
|
27
|
+
raise NotAGitRootError, "'#{root}' is not a git repo" unless $CHILD_STATUS.success?
|
28
|
+
|
29
|
+
deploy_ref, commit_sha, commit_subject, commit_date = parts
|
30
|
+
deploy_ref = deploy_ref.split(" ")[2].to_s.tr(",", "")
|
31
|
+
|
32
|
+
commit_date = Utils.try_parse_date(commit_date)
|
33
|
+
|
34
|
+
super.merge({
|
35
|
+
deploy_ref: deploy_ref,
|
36
|
+
commit_sha: commit_sha,
|
37
|
+
commit_date: commit_date,
|
38
|
+
commit_subject: commit_subject,
|
39
|
+
origin: :git
|
40
|
+
}.compact)
|
41
|
+
rescue Errno::ENOENT
|
42
|
+
raise NotAGitRootError, "git root not found at '#{root}'"
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def git_show_command
|
48
|
+
%w[git show -s].append("--format=tformat:#{GIT_SHOW_FORMAT}", "@")
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../scc"
|
4
|
+
require_relative "../scc/utils"
|
5
|
+
require_relative "deploy_info/extractor/error"
|
6
|
+
|
7
|
+
module Scc
|
8
|
+
class DeployInfo
|
9
|
+
NULLABLE_ATTRS = %i[deploy_ref commit_sha commit_date commit_subject origin]
|
10
|
+
SENTINEL = "UNKNOWN"
|
11
|
+
attr_reader(*NULLABLE_ATTRS)
|
12
|
+
attr_reader :formatted_date
|
13
|
+
|
14
|
+
def initialize(extractor: nil)
|
15
|
+
@deploy_ref = deploy_ref
|
16
|
+
@commit_sha = commit_sha
|
17
|
+
@commit_date = commit_date
|
18
|
+
@commit_subject = commit_subject
|
19
|
+
@origin = origin
|
20
|
+
@extractor = extractor || Extractor::Dummy.new
|
21
|
+
end
|
22
|
+
|
23
|
+
def short_sha = commit_sha.to_s[..7]
|
24
|
+
|
25
|
+
def version_string
|
26
|
+
"#{deploy_ref}/#{short_sha} @ #{formatted_date}"
|
27
|
+
end
|
28
|
+
|
29
|
+
def to_poro
|
30
|
+
{
|
31
|
+
"deploy_ref" => deploy_ref,
|
32
|
+
"commit_sha" => commit_sha,
|
33
|
+
"commit_date" => commit_date,
|
34
|
+
"commit_subject" => commit_subject,
|
35
|
+
"origin" => origin
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
def extract!
|
40
|
+
attrs = @extractor.call
|
41
|
+
NULLABLE_ATTRS.each do |key|
|
42
|
+
value = attrs[key]
|
43
|
+
value = SENTINEL if value.nil? || (value.is_a?(String) && value.empty?)
|
44
|
+
|
45
|
+
send("#{key}=".to_sym, value)
|
46
|
+
end
|
47
|
+
|
48
|
+
self
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.from_git(root: nil)
|
52
|
+
root ||= "."
|
53
|
+
new(extractor: Extractor::Git.new(root: root))
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.from_file(filename: nil)
|
57
|
+
filename ||= "deploy_info.yml"
|
58
|
+
new(extractor: Extractor::File.new(filename: filename))
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.for_env(env, root: nil, filename: nil)
|
62
|
+
if %w[test development].include?(env)
|
63
|
+
return from_git(root: root).extract!
|
64
|
+
end
|
65
|
+
from_file(filename: filename).extract!
|
66
|
+
rescue DeployInfo::Extractor::Error
|
67
|
+
new.extract!
|
68
|
+
end
|
69
|
+
|
70
|
+
private
|
71
|
+
|
72
|
+
attr_writer(*NULLABLE_ATTRS)
|
73
|
+
|
74
|
+
def commit_date=(value)
|
75
|
+
if value.respond_to?(:strftime)
|
76
|
+
@formatted_date = value.strftime("%d %b %Y %H:%M")
|
77
|
+
elsif value.is_a?(String) || value.nil?
|
78
|
+
@formatted_date = value
|
79
|
+
else
|
80
|
+
raise ArgumentError.new("value is not a Date-like nor a String type")
|
81
|
+
end
|
82
|
+
|
83
|
+
@commit_date = value
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
# require_relative './deploy_info/base'
|
89
|
+
require_relative "deploy_info/extractor/dummy"
|
90
|
+
require_relative "deploy_info/extractor/git"
|
91
|
+
require_relative "deploy_info/extractor/file"
|
data/lib/scc/utils.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "date"
|
4
|
+
require "time"
|
5
|
+
|
6
|
+
module Scc
|
7
|
+
module Utils
|
8
|
+
module_function
|
9
|
+
|
10
|
+
def try_parse_date(date)
|
11
|
+
return nil if date.nil?
|
12
|
+
return date if date.is_a?(Date) || date.is_a?(Time) || date.is_a?(DateTime)
|
13
|
+
|
14
|
+
DateTime.parse(date)
|
15
|
+
rescue Date::Error
|
16
|
+
nil
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/scc/version.rb
ADDED
data/lib/scc.rb
ADDED
data/scc.gemspec
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/scc/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "scc-foundation"
|
7
|
+
spec.version = Scc::VERSION
|
8
|
+
# TODO: change this to a more generic SCC Team
|
9
|
+
spec.authors = ["Jose D. Gomez R."]
|
10
|
+
spec.email = ["jose.gomez@suse.com"]
|
11
|
+
|
12
|
+
spec.summary = "Foundational helpers for our Rails applications"
|
13
|
+
spec.description = "A set of helper classes to share across workloads"
|
14
|
+
spec.homepage = "https://scc.suse.com/team"
|
15
|
+
spec.license = "MIT"
|
16
|
+
spec.required_ruby_version = ">= 3.2.0"
|
17
|
+
|
18
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
19
|
+
spec.metadata["source_code_uri"] = "https://github.com/SUSE/scc-foundation"
|
20
|
+
spec.metadata["changelog_uri"] = "https://github.com/SUSE/scc-foundation/blob/master/CHANGELOG.md"
|
21
|
+
|
22
|
+
# Specify which files should be added to the gem when it is released.
|
23
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
24
|
+
spec.files = Dir.chdir(__dir__) do
|
25
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
26
|
+
(File.expand_path(f) == __FILE__) || f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor])
|
27
|
+
end
|
28
|
+
end
|
29
|
+
spec.bindir = "exe"
|
30
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
31
|
+
spec.require_paths = ["lib"]
|
32
|
+
|
33
|
+
# Uncomment to register a new dependency of your gem
|
34
|
+
# spec.add_dependency "example-gem", "~> 1.0"
|
35
|
+
|
36
|
+
# For more information and examples about making a new gem, check out our
|
37
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
38
|
+
end
|
metadata
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: scc-foundation
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jose D. Gomez R.
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-02-06 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A set of helper classes to share across workloads
|
14
|
+
email:
|
15
|
+
- jose.gomez@suse.com
|
16
|
+
executables:
|
17
|
+
- scc-build-deploy-manifest-from-git
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- ".rspec"
|
22
|
+
- ".standard.yml"
|
23
|
+
- CHANGELOG.md
|
24
|
+
- Gemfile
|
25
|
+
- Gemfile.lock
|
26
|
+
- LICENSE.txt
|
27
|
+
- README.md
|
28
|
+
- Rakefile
|
29
|
+
- exe/scc-build-deploy-manifest-from-git
|
30
|
+
- lib/scc.rb
|
31
|
+
- lib/scc/commands/build_manifest_from_git.rb
|
32
|
+
- lib/scc/deploy_info.rb
|
33
|
+
- lib/scc/deploy_info/extractor/dummy.rb
|
34
|
+
- lib/scc/deploy_info/extractor/error.rb
|
35
|
+
- lib/scc/deploy_info/extractor/file.rb
|
36
|
+
- lib/scc/deploy_info/extractor/git.rb
|
37
|
+
- lib/scc/utils.rb
|
38
|
+
- lib/scc/version.rb
|
39
|
+
- scc.gemspec
|
40
|
+
homepage: https://scc.suse.com/team
|
41
|
+
licenses:
|
42
|
+
- MIT
|
43
|
+
metadata:
|
44
|
+
homepage_uri: https://scc.suse.com/team
|
45
|
+
source_code_uri: https://github.com/SUSE/scc-foundation
|
46
|
+
changelog_uri: https://github.com/SUSE/scc-foundation/blob/master/CHANGELOG.md
|
47
|
+
post_install_message:
|
48
|
+
rdoc_options: []
|
49
|
+
require_paths:
|
50
|
+
- lib
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 3.2.0
|
56
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
requirements: []
|
62
|
+
rubygems_version: 3.4.10
|
63
|
+
signing_key:
|
64
|
+
specification_version: 4
|
65
|
+
summary: Foundational helpers for our Rails applications
|
66
|
+
test_files: []
|