foobara-domain-mapper-generator 0.0.1 → 0.0.3
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
- data/CHANGELOG.md +8 -0
- data/src/generators/domain_mapper_generator.rb +1 -2
- data/templates/src/domain_mapper.rb.erb +15 -0
- metadata +7 -7
- data/src/generators/gemfile_generator.rb +0 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99cda9488ef0d2374fced6da9b91858851fd4384ddd9cd602a769d284c724178
|
4
|
+
data.tar.gz: cfd04a80b439b85128d64d1e75d7dea548f57d0e1dfd466a53ee28277e1b6c61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef49d726e58e008a1dfbb07f9521f89866e4adab98ae7180d3c71c8cf5a11375ea0ceba15a722285a5f07bbfb7a5c1429137b9e89942d2ad5aea924b47f50267
|
7
|
+
data.tar.gz: 597a58a2c1a59d8cb85660cc1e64df646f8d3267da15ed0d8f983bf7d5b1480fe1b7f0418481fe59848cdf3d0647259aa777729fbbe7e62858a77f7d5368febd
|
data/CHANGELOG.md
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
<% module_path[..-2].each do |part| %>
|
2
|
+
module <%= part %>
|
3
|
+
<% end %>
|
4
|
+
class <%= module_path.last %> < Foobara::DomainMapper
|
5
|
+
from :integer
|
6
|
+
to :string
|
7
|
+
|
8
|
+
def map(from_value)
|
9
|
+
from_value.to_s
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
<% (module_path.size - 1).times do %>
|
14
|
+
end
|
15
|
+
<% end %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foobara-domain-mapper-generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Georgi
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: foobara
|
@@ -38,7 +38,7 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
description:
|
41
|
+
description:
|
42
42
|
email:
|
43
43
|
- azimux@gmail.com
|
44
44
|
executables: []
|
@@ -54,8 +54,8 @@ files:
|
|
54
54
|
- src/domain_mapper_config.rb
|
55
55
|
- src/generate_domain_mapper.rb
|
56
56
|
- src/generators/domain_mapper_generator.rb
|
57
|
-
- src/generators/gemfile_generator.rb
|
58
57
|
- src/write_domain_mapper_to_disk.rb
|
58
|
+
- templates/src/domain_mapper.rb.erb
|
59
59
|
homepage: https://github.com/foobara/generators-domain-mapper-generator
|
60
60
|
licenses:
|
61
61
|
- Apache-2.0
|
@@ -65,7 +65,7 @@ metadata:
|
|
65
65
|
source_code_uri: https://github.com/foobara/generators-domain-mapper-generator
|
66
66
|
changelog_uri: https://github.com/foobara/generators-domain-mapper-generator/blob/main/CHANGELOG.md
|
67
67
|
rubygems_mfa_required: 'true'
|
68
|
-
post_install_message:
|
68
|
+
post_install_message:
|
69
69
|
rdoc_options: []
|
70
70
|
require_paths:
|
71
71
|
- lib
|
@@ -81,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
81
|
version: '0'
|
82
82
|
requirements: []
|
83
83
|
rubygems_version: 3.4.10
|
84
|
-
signing_key:
|
84
|
+
signing_key:
|
85
85
|
specification_version: 4
|
86
86
|
summary: Generates Foobara domain mappers
|
87
87
|
test_files: []
|
@@ -1,39 +0,0 @@
|
|
1
|
-
module Foobara
|
2
|
-
module Generators
|
3
|
-
module DomainMapperGenerator
|
4
|
-
module Generators
|
5
|
-
class GemfileGenerator < DomainMapperGenerator
|
6
|
-
def applicable?
|
7
|
-
gemfile_contents !~ /^\s*gem\s*["']foobara-domain-mapper-generator\b/
|
8
|
-
end
|
9
|
-
|
10
|
-
def template_path
|
11
|
-
"Gemfile"
|
12
|
-
end
|
13
|
-
|
14
|
-
def target_path
|
15
|
-
"Gemfile"
|
16
|
-
end
|
17
|
-
|
18
|
-
def generate(_elements_to_generate)
|
19
|
-
match = gemfile_contents.match(/^gem /)
|
20
|
-
|
21
|
-
if match
|
22
|
-
new_entry = 'gem "foobara-domain-mapper-generator", github: "foobara/domain-mapper-generator"'
|
23
|
-
"#{match.pre_match}\n#{new_entry}\n#{match}#{match.post_match}"
|
24
|
-
else
|
25
|
-
# TODO: maybe print a warning and return the original Gemfile
|
26
|
-
# :nocov:
|
27
|
-
raise "Not sure how to inject foobara-domain-mapper-generator into the Gemfile"
|
28
|
-
# :nocov:
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def gemfile_contents
|
33
|
-
File.read(template_path)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|