rubysmith 4.0.1 → 4.2.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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/rubysmith/builders/git/commit.rb +2 -4
- data/lib/rubysmith/configuration/content.rb +6 -10
- data/lib/rubysmith/configuration/enhancers/container.rb +20 -0
- data/lib/rubysmith/configuration/enhancers/current_time.rb +3 -13
- data/lib/rubysmith/configuration/enhancers/git_email.rb +6 -16
- data/lib/rubysmith/configuration/enhancers/git_hub_user.rb +6 -16
- data/lib/rubysmith/configuration/enhancers/git_user.rb +10 -18
- data/lib/rubysmith/configuration/enhancers/template_root.rb +12 -0
- data/lib/rubysmith/configuration/loader.rb +7 -11
- data/lib/rubysmith/templates/%project_name%/Gemfile.erb +1 -1
- data/lib/rubysmith/templates/%project_name%/spec/spec_helper.rb.erb +2 -1
- data/rubysmith.gemspec +2 -2
- data.tar.gz.sig +0 -0
- metadata +6 -5
- metadata.gz.sig +0 -0
- data/lib/rubysmith/templates/.DS_Store +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4cfa93891b2aab52dafc35ded6689a9b1ab0238392a77fb00792921509688a81
|
4
|
+
data.tar.gz: fe6ad94812bfcf65510f5d003adcdb1343108eeab217b000ecd52ede786918c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a452d09d13d5f9531c0f524a7562b352ed1b3e4c24c2b8f8cadccfe05ee8c9eae60aed31da16b7b2125fdc95e3034f88a364b7188c6721073177635ba67ba602
|
7
|
+
data.tar.gz: d88f49c8805a2f9730d29a741a399075c3a30c88bbcb987bd70647de3b68d859ebe05ab8d91b5563566cb80c39202494d63f5f89ea2861a3816edf88895d306c
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -34,10 +34,8 @@ module Rubysmith
|
|
34
34
|
attr_reader :configuration, :builder
|
35
35
|
|
36
36
|
def body
|
37
|
-
|
38
|
-
|
39
|
-
#{specification.version}.
|
40
|
-
CONTENT
|
37
|
+
"Generated with [#{specification.label}](#{specification.homepage_url}) " \
|
38
|
+
"#{specification.version}."
|
41
39
|
end
|
42
40
|
|
43
41
|
def project_name = configuration.project_name
|
@@ -82,25 +82,21 @@ module Rubysmith
|
|
82
82
|
:project_version,
|
83
83
|
:target_root,
|
84
84
|
:template_path,
|
85
|
-
:template_roots
|
86
|
-
keyword_init: true
|
85
|
+
:template_roots
|
87
86
|
) do
|
88
87
|
using Refinements::Arrays
|
89
88
|
using Refinements::Strings
|
90
89
|
using Refinements::Structs
|
91
90
|
|
92
|
-
def initialize
|
91
|
+
def initialize target_root: Pathname.pwd, template_roots: [], **arguments
|
93
92
|
super
|
94
|
-
|
95
|
-
self[:template_roots] ||= [Pathname(__dir__).join("../templates")]
|
96
|
-
self[:target_root] ||= Pathname.pwd
|
97
93
|
freeze
|
98
94
|
end
|
99
95
|
|
100
|
-
def add_template_roots paths
|
101
|
-
|
102
|
-
|
103
|
-
|
96
|
+
def add_template_roots *paths
|
97
|
+
paths.map { |path| Pathname path }
|
98
|
+
.including(template_roots)
|
99
|
+
.then { |roots| dup.merge! template_roots: roots }
|
104
100
|
end
|
105
101
|
|
106
102
|
def maximize = update_build_options(true)
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "dry/container"
|
4
|
+
|
5
|
+
module Rubysmith
|
6
|
+
module Configuration
|
7
|
+
module Enhancers
|
8
|
+
# Provides a container of enhancers for injection into other objects.
|
9
|
+
module Container
|
10
|
+
extend Dry::Container::Mixin
|
11
|
+
|
12
|
+
register(:current_time) { Enhancers::CurrentTime }
|
13
|
+
register(:git_hub_user) { Enhancers::GitHubUser }
|
14
|
+
register(:git_email) { Enhancers::GitEmail }
|
15
|
+
register(:git_user) { Enhancers::GitUser }
|
16
|
+
register(:template_root) { Enhancers::TemplateRoot }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -4,21 +4,11 @@ require "refinements/structs"
|
|
4
4
|
|
5
5
|
module Rubysmith
|
6
6
|
module Configuration
|
7
|
+
# Adds current time to content.
|
7
8
|
module Enhancers
|
8
|
-
|
9
|
-
class CurrentTime
|
10
|
-
using Refinements::Structs
|
9
|
+
using Refinements::Structs
|
11
10
|
|
12
|
-
|
13
|
-
@now = now
|
14
|
-
end
|
15
|
-
|
16
|
-
def call(content) = content.merge(now:)
|
17
|
-
|
18
|
-
private
|
19
|
-
|
20
|
-
attr_reader :now
|
21
|
-
end
|
11
|
+
CurrentTime = -> content, at: Time.now { content.merge(now: at) }
|
22
12
|
end
|
23
13
|
end
|
24
14
|
end
|
@@ -6,25 +6,15 @@ require "refinements/structs"
|
|
6
6
|
|
7
7
|
module Rubysmith
|
8
8
|
module Configuration
|
9
|
+
# Dynamically adds Git email if defined.
|
9
10
|
module Enhancers
|
10
|
-
|
11
|
-
|
12
|
-
using Refinements::Strings
|
13
|
-
using Refinements::Structs
|
11
|
+
using Refinements::Strings
|
12
|
+
using Refinements::Structs
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
end
|
14
|
+
GitEmail = lambda do |content, git: Gitt::Repository.new|
|
15
|
+
return content unless String(content.author_email).blank?
|
18
16
|
|
19
|
-
|
20
|
-
String(content.author_email).blank? ? content.merge(author_email: email) : content
|
21
|
-
end
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
attr_reader :git
|
26
|
-
|
27
|
-
def email = git.get "user.email", "TODO"
|
17
|
+
content.merge author_email: git.get("user.email").value_or("")
|
28
18
|
end
|
29
19
|
end
|
30
20
|
end
|
@@ -6,25 +6,15 @@ require "refinements/structs"
|
|
6
6
|
|
7
7
|
module Rubysmith
|
8
8
|
module Configuration
|
9
|
+
# Dynamically adds GitHub user if user is defined.
|
9
10
|
module Enhancers
|
10
|
-
|
11
|
-
|
12
|
-
using Refinements::Strings
|
13
|
-
using Refinements::Structs
|
11
|
+
using Refinements::Strings
|
12
|
+
using Refinements::Structs
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
end
|
14
|
+
GitHubUser = lambda do |content, git: Gitt::Repository.new|
|
15
|
+
return content unless String(content.git_hub_user).blank?
|
18
16
|
|
19
|
-
|
20
|
-
String(content.git_hub_user).blank? ? content.merge(git_hub_user: user) : content
|
21
|
-
end
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
attr_reader :git
|
26
|
-
|
27
|
-
def user = git.get "github.user"
|
17
|
+
content.merge git_hub_user: git.get("github.user").value_or("default")
|
28
18
|
end
|
29
19
|
end
|
30
20
|
end
|
@@ -6,27 +6,19 @@ require "refinements/structs"
|
|
6
6
|
|
7
7
|
module Rubysmith
|
8
8
|
module Configuration
|
9
|
+
# Dynamically adds Git user if defined.
|
9
10
|
module Enhancers
|
10
|
-
|
11
|
-
|
12
|
-
using Refinements::Strings
|
13
|
-
using Refinements::Structs
|
11
|
+
using Refinements::Strings
|
12
|
+
using Refinements::Structs
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
end
|
14
|
+
GitUser = lambda do |content, git: Gitt::Repository.new|
|
15
|
+
return content unless String(content.author_name).blank?
|
18
16
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
def user
|
26
|
-
git.get("user.name", "TODO")
|
27
|
-
.then { |name| String(name).split }
|
28
|
-
.then { |first, last| {author_given_name: first, author_family_name: last} }
|
29
|
-
end
|
17
|
+
git.get("user.name")
|
18
|
+
.value_or("")
|
19
|
+
.then { |name| String(name).split }
|
20
|
+
.then { |first, last| {author_given_name: first, author_family_name: last} }
|
21
|
+
.then { |user| content.merge(**user) }
|
30
22
|
end
|
31
23
|
end
|
32
24
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Rubysmith
|
4
|
+
module Configuration
|
5
|
+
module Enhancers
|
6
|
+
# Prepends template roots to existing content.
|
7
|
+
TemplateRoot = lambda do |content, overrides: Pathname(__dir__).join("../../templates")|
|
8
|
+
content.add_template_roots(*Array(overrides))
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -16,32 +16,28 @@ module Rubysmith
|
|
16
16
|
DEFAULTS = YAML.load_file(Pathname(__dir__).join("defaults.yml")).freeze
|
17
17
|
CLIENT = Runcom::Config.new "rubysmith/configuration.yml", defaults: DEFAULTS
|
18
18
|
|
19
|
-
ENHANCERS = [
|
20
|
-
Enhancers::CurrentTime.new,
|
21
|
-
Enhancers::GitEmail.new,
|
22
|
-
Enhancers::GitHubUser.new,
|
23
|
-
Enhancers::GitUser.new
|
24
|
-
].freeze
|
25
|
-
|
26
19
|
def self.call(...) = new(...).call
|
27
20
|
|
28
|
-
def self.with_defaults = new(client: DEFAULTS, enhancers:
|
21
|
+
def self.with_defaults = new(client: DEFAULTS, enhancers: {})
|
29
22
|
|
30
|
-
def initialize content: Content.new, client: CLIENT, enhancers:
|
23
|
+
def initialize content: Content.new, client: CLIENT, enhancers: Enhancers::Container
|
31
24
|
@content = content
|
32
25
|
@client = client
|
33
26
|
@enhancers = enhancers
|
34
27
|
end
|
35
28
|
|
36
29
|
def call
|
37
|
-
enhancers.
|
30
|
+
enhancers.each
|
31
|
+
.reduce(preload_content) { |preload, (_key, enhancer)| enhancer.call preload }
|
38
32
|
.freeze
|
39
33
|
end
|
40
34
|
|
41
|
-
|
35
|
+
protected
|
42
36
|
|
43
37
|
attr_reader :content, :client, :enhancers
|
44
38
|
|
39
|
+
private
|
40
|
+
|
45
41
|
def preload_content = content.merge(**client.to_h.flatten_keys)
|
46
42
|
end
|
47
43
|
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 = "4.0
|
5
|
+
spec.version = "4.2.0"
|
6
6
|
spec.authors = ["Brooke Kuhlmann"]
|
7
7
|
spec.email = ["brooke@alchemists.io"]
|
8
8
|
spec.homepage = "https://github.com/bkuhlmann/rubysmith"
|
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_dependency "dry-container", "~> 0.11"
|
28
28
|
spec.add_dependency "gitt", "~> 1.0"
|
29
29
|
spec.add_dependency "infusible", "~> 1.0"
|
30
|
-
spec.add_dependency "milestoner", "~> 15.
|
30
|
+
spec.add_dependency "milestoner", "~> 15.1"
|
31
31
|
spec.add_dependency "pastel", "~> 0.8"
|
32
32
|
spec.add_dependency "pragmater", "~> 12.0"
|
33
33
|
spec.add_dependency "refinements", "~> 10.0"
|
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: 4.0
|
4
|
+
version: 4.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
@@ -28,7 +28,7 @@ cert_chain:
|
|
28
28
|
CxDe2+VuChj4I1nvIHdu+E6XoEVlanUPKmSg6nddhkKn2gC45Kyzh6FZqnzH/CRp
|
29
29
|
RFE=
|
30
30
|
-----END CERTIFICATE-----
|
31
|
-
date:
|
31
|
+
date: 2023-01-01 00:00:00.000000000 Z
|
32
32
|
dependencies:
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: cogger
|
@@ -92,14 +92,14 @@ dependencies:
|
|
92
92
|
requirements:
|
93
93
|
- - "~>"
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: '15.
|
95
|
+
version: '15.1'
|
96
96
|
type: :runtime
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
100
|
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: '15.
|
102
|
+
version: '15.1'
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: pastel
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
@@ -260,10 +260,12 @@ files:
|
|
260
260
|
- lib/rubysmith/cli/shell.rb
|
261
261
|
- lib/rubysmith/configuration/content.rb
|
262
262
|
- lib/rubysmith/configuration/defaults.yml
|
263
|
+
- lib/rubysmith/configuration/enhancers/container.rb
|
263
264
|
- lib/rubysmith/configuration/enhancers/current_time.rb
|
264
265
|
- lib/rubysmith/configuration/enhancers/git_email.rb
|
265
266
|
- lib/rubysmith/configuration/enhancers/git_hub_user.rb
|
266
267
|
- lib/rubysmith/configuration/enhancers/git_user.rb
|
268
|
+
- lib/rubysmith/configuration/enhancers/template_root.rb
|
267
269
|
- lib/rubysmith/configuration/loader.rb
|
268
270
|
- lib/rubysmith/container.rb
|
269
271
|
- lib/rubysmith/extensions/bundler.rb
|
@@ -306,7 +308,6 @@ files:
|
|
306
308
|
- lib/rubysmith/templates/%project_name%/lib/%project_path%.rb.erb
|
307
309
|
- lib/rubysmith/templates/%project_name%/spec/spec_helper.rb.erb
|
308
310
|
- lib/rubysmith/templates/%project_name%/spec/support/shared_contexts/temp_dir.rb.erb
|
309
|
-
- lib/rubysmith/templates/.DS_Store
|
310
311
|
- lib/rubysmith/text/inserter.rb
|
311
312
|
- rubysmith.gemspec
|
312
313
|
homepage: https://github.com/bkuhlmann/rubysmith
|
metadata.gz.sig
CHANGED
Binary file
|
Binary file
|