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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0dbc9d9406cccf11b2508d5c27370906bf7f13b18e8506638ddc29a9ce003df4
4
- data.tar.gz: 64beedf46aea4a1768e98790c9c3e96acca2d274fe12805721588338584fb390
3
+ metadata.gz: 4bf7aff137172ca7f7959152c9a6550f1453ae79c9f0947048b3f829ae118b5c
4
+ data.tar.gz: 97a5b9c2fcf8204aa77b84bd159888f93808aa0dcc7693547d0aa3104cb226b2
5
5
  SHA512:
6
- metadata.gz: 3e22613cee83158a67415a51e128603d5bea8ad9fb052c679520669c01e933fbd14c850efaddb0a30144ccca4515f7a96c45104b503e975b44f344fb2bbfd64f
7
- data.tar.gz: 5054c72f1a820e90cf414aa110246bb0d404737f13c61ea2117818474ff42316ea40217e8f19fd113316e994a67ed6878be64abcf444165a8216b49b8eda9ceb
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
- include Dry::Monads[:result]
8
+ # Dynamically adds Git email if defined.
9
+ class GitEmail
10
+ include Import[:git]
11
+ include Dry::Monads[:result]
11
12
 
12
- GitEmail = lambda do |content, git: Gitt::Repository.new|
13
- return Dry::Monads::Success content if content[:author_email]
13
+ def call content
14
+ return Success content if content[:author_email]
14
15
 
15
- git.get("user.email").fmap { |email| content.merge! author_email: email }
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
- include Dry::Monads[:result]
8
+ # Dynamically adds GitHub user if user is defined.
9
+ class GitHubUser
10
+ include Import[:git]
11
+ include Dry::Monads[:result]
11
12
 
12
- GitHubUser = lambda do |content, git: Gitt::Repository.new|
13
- return Dry::Monads::Success content if content[:git_hub_user]
13
+ def call content
14
+ return Success content if content[:git_hub_user]
14
15
 
15
- git.get("github.user").fmap { |user| content.merge! git_hub_user: user }
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
- include Dry::Monads[:result]
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
- include Dry::Monads[:result]
9
+ # Appends custom content to default template roots.
10
+ class TemplateRoot
11
+ include Dry::Monads[:result]
11
12
 
12
- using Refinements::Arrays
13
+ using Refinements::Arrays
13
14
 
14
- TemplateRoot = lambda do |content, overrides: Pathname(__dir__).join("../../templates")|
15
- Array(overrides).map { |path| Pathname path }
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| Dry::Monads::Success content.merge!(template_roots: 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
@@ -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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "rubysmith"
5
- spec.version = "5.0.1"
5
+ spec.version = "5.1.0"
6
6
  spec.authors = ["Brooke Kuhlmann"]
7
7
  spec.email = ["brooke@alchemists.io"]
8
8
  spec.homepage = "https://github.com/bkuhlmann/rubysmith"
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.1
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-16 00:00:00.000000000 Z
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