rubysmith 5.0.1 → 5.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/rubysmith/configuration/transformers/git_email.rb +8 -6
- data/lib/rubysmith/configuration/transformers/git_hub_user.rb +8 -6
- data/lib/rubysmith/configuration/transformers/git_user.rb +7 -7
- data/lib/rubysmith/configuration/transformers/template_root.rb +16 -6
- data/lib/rubysmith/container.rb +6 -4
- data/rubysmith.gemspec +1 -1
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4bf7aff137172ca7f7959152c9a6550f1453ae79c9f0947048b3f829ae118b5c
|
4
|
+
data.tar.gz: 97a5b9c2fcf8204aa77b84bd159888f93808aa0dcc7693547d0aa3104cb226b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfbbafd5a69876cd04a2d6d980c3ffccf95efe7a70d595983953bf62efcd557e49433f34dc954069b135e90372f601837c9b9f7ee50534fb0c0b61c2b73c86b9
|
7
|
+
data.tar.gz: 520c7dccfd4bde72ceb2678fbc6e7ceb1d5a246c17261858d22577b92965463998968dbf3cf50e44847c64484aff1fee4795d220364ceeef749fb4bee967450e
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -1,18 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "dry/monads"
|
4
|
-
require "gitt"
|
5
4
|
|
6
5
|
module Rubysmith
|
7
6
|
module Configuration
|
8
|
-
# Dynamically adds Git email if defined.
|
9
7
|
module Transformers
|
10
|
-
|
8
|
+
# Dynamically adds Git email if defined.
|
9
|
+
class GitEmail
|
10
|
+
include Import[:git]
|
11
|
+
include Dry::Monads[:result]
|
11
12
|
|
12
|
-
|
13
|
-
|
13
|
+
def call content
|
14
|
+
return Success content if content[:author_email]
|
14
15
|
|
15
|
-
|
16
|
+
git.get("user.email").fmap { |email| content.merge! author_email: email }
|
17
|
+
end
|
16
18
|
end
|
17
19
|
end
|
18
20
|
end
|
@@ -1,18 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "dry/monads"
|
4
|
-
require "gitt"
|
5
4
|
|
6
5
|
module Rubysmith
|
7
6
|
module Configuration
|
8
|
-
# Dynamically adds GitHub user if user is defined.
|
9
7
|
module Transformers
|
10
|
-
|
8
|
+
# Dynamically adds GitHub user if user is defined.
|
9
|
+
class GitHubUser
|
10
|
+
include Import[:git]
|
11
|
+
include Dry::Monads[:result]
|
11
12
|
|
12
|
-
|
13
|
-
|
13
|
+
def call content
|
14
|
+
return Success content if content[:git_hub_user]
|
14
15
|
|
15
|
-
|
16
|
+
git.get("github.user").fmap { |user| content.merge! git_hub_user: user }
|
17
|
+
end
|
16
18
|
end
|
17
19
|
end
|
18
20
|
end
|
@@ -1,18 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "dry/monads"
|
4
|
-
require "gitt"
|
5
4
|
|
6
5
|
module Rubysmith
|
7
6
|
module Configuration
|
8
|
-
# Dynamically adds Git user if defined.
|
9
7
|
module Transformers
|
10
|
-
|
8
|
+
# Dynamically adds Git user if defined.
|
9
|
+
class GitUser
|
10
|
+
include Import[:git]
|
11
|
+
include Dry::Monads[:result]
|
12
|
+
|
13
|
+
def call content
|
14
|
+
return Success content if content[:author_given_name] || content[:author_family_name]
|
11
15
|
|
12
|
-
GitUser = lambda do |content, git: Gitt::Repository.new|
|
13
|
-
if content[:author_given_name] || content[:author_family_name]
|
14
|
-
Dry::Monads::Success content
|
15
|
-
else
|
16
16
|
git.get("user.name").fmap do |name|
|
17
17
|
first, last = String(name).split
|
18
18
|
content.merge author_given_name: first, author_family_name: last
|
@@ -5,17 +5,27 @@ require "refinements/arrays"
|
|
5
5
|
|
6
6
|
module Rubysmith
|
7
7
|
module Configuration
|
8
|
-
# Prepends template roots to existing content.
|
9
8
|
module Transformers
|
10
|
-
|
9
|
+
# Appends custom content to default template roots.
|
10
|
+
class TemplateRoot
|
11
|
+
include Dry::Monads[:result]
|
11
12
|
|
12
|
-
|
13
|
+
using Refinements::Arrays
|
13
14
|
|
14
|
-
|
15
|
-
|
15
|
+
def initialize default = Pathname(__dir__).join("../../templates")
|
16
|
+
@default = default
|
17
|
+
end
|
18
|
+
|
19
|
+
def call content
|
20
|
+
Array(default).map { |path| Pathname path }
|
16
21
|
.including(content[:template_roots])
|
17
22
|
.compact
|
18
|
-
.then { |paths|
|
23
|
+
.then { |paths| Success content.merge!(template_roots: paths) }
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
attr_reader :default
|
19
29
|
end
|
20
30
|
end
|
21
31
|
end
|
data/lib/rubysmith/container.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require "cogger"
|
4
4
|
require "dry-container"
|
5
5
|
require "etcher"
|
6
|
+
require "gitt"
|
6
7
|
require "runcom"
|
7
8
|
require "spek"
|
8
9
|
|
@@ -20,10 +21,10 @@ module Rubysmith
|
|
20
21
|
Etcher::Registry.new(contract: Configuration::Contract, model: Configuration::Model)
|
21
22
|
.add_loader(Etcher::Loaders::YAML.new(self[:defaults_path]))
|
22
23
|
.add_transformer(Configuration::Transformers::CurrentTime)
|
23
|
-
.add_transformer(Configuration::Transformers::GitHubUser)
|
24
|
-
.add_transformer(Configuration::Transformers::GitEmail)
|
25
|
-
.add_transformer(Configuration::Transformers::GitUser)
|
26
|
-
.add_transformer(Configuration::Transformers::TemplateRoot)
|
24
|
+
.add_transformer(Configuration::Transformers::GitHubUser.new)
|
25
|
+
.add_transformer(Configuration::Transformers::GitEmail.new)
|
26
|
+
.add_transformer(Configuration::Transformers::GitUser.new)
|
27
|
+
.add_transformer(Configuration::Transformers::TemplateRoot.new)
|
27
28
|
.add_transformer(Configuration::Transformers::TargetRoot)
|
28
29
|
end
|
29
30
|
|
@@ -31,6 +32,7 @@ module Rubysmith
|
|
31
32
|
register(:defaults_path) { Pathname(__dir__).join("configuration/defaults.yml") }
|
32
33
|
register(:xdg_config) { Runcom::Config.new "rubysmith/configuration.yml" }
|
33
34
|
register(:specification) { Spek::Loader.call "#{__dir__}/../../rubysmith.gemspec" }
|
35
|
+
register(:git) { Gitt::Repository.new }
|
34
36
|
register(:kernel) { Kernel }
|
35
37
|
register(:logger) { Cogger.new formatter: :emoji }
|
36
38
|
end
|
data/rubysmith.gemspec
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubysmith
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0
|
4
|
+
version: 5.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
3n5C8/6Zh9DYTkpcwPSuIfAga6wf4nXc9m6JAw8AuMLaiWN/r/2s4zJsUHYERJEu
|
36
36
|
gZGm4JqtuSg8pYjPeIJxS960owq+SfuC+jxqmRA54BisFCv/0VOJi7tiJVY=
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2023-06-
|
38
|
+
date: 2023-06-17 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: cogger
|
metadata.gz.sig
CHANGED
Binary file
|