k_builder 0.0.20 → 0.0.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/USAGE.md +52 -20
- data/_out1.png +0 -0
- data/_out2.png +0 -0
- data/_out3.png +0 -0
- data/_out4.png +0 -0
- data/_out5.png +0 -0
- data/k_builder.gemspec +1 -1
- data/lib/k_builder/version.rb +1 -1
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e1de8ff91bc3e273459d6970c8c1c136184e9c0990b0645fa426888317640eb
|
4
|
+
data.tar.gz: b6a5856f4bbb628422968a80a212fc6fbb1515b19c2cc29160d9cf984faa2b40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62e85ea3f17a20cbc3bd180b74a057caab722d37de1bdb008353839f5f0159f564b69a4bcee9124857c7d24fe5b7b46afe967b86e52aaac7009960a663294886
|
7
|
+
data.tar.gz: 51a3c0374b57f0cfebc099df6d86c7657b50815185ea60f71e37cc9f27c5edf4afbb1933e727c1e68b81b179b079f7666c89a9273e971d7aa72fdb74e0411942
|
data/USAGE.md
CHANGED
@@ -11,8 +11,15 @@ As a Polyglot Developer, I want to be up and running in any development language
|
|
11
11
|
Print the configuration
|
12
12
|
|
13
13
|
```ruby
|
14
|
-
|
15
|
-
|
14
|
+
usecases_folder = File.join(Dir.getwd, 'spec', 'usecases')
|
15
|
+
|
16
|
+
KBuilder.configure do |config|
|
17
|
+
config.template_folder = File.join(usecases_folder, '.app_template')
|
18
|
+
config.global_template_folder = File.join(usecases_folder, '.global_template')
|
19
|
+
config.target_folder = File.join(usecases_folder, '.output')
|
20
|
+
end
|
21
|
+
|
22
|
+
puts JSON.pretty_generate(KBuilder.configuration.to_hash)
|
16
23
|
```
|
17
24
|
|
18
25
|
```javascript
|
@@ -35,9 +42,9 @@ Example folder structure for this usecase before running the builder
|
|
35
42
|
|
36
43
|
This example builder will add 4 files into the output folder.
|
37
44
|
|
38
|
-
1. main.rb is based on class.rb from app_template
|
39
|
-
2. person.rb & address.rb are based on model.rb from global_template
|
40
|
-
3. configuration.log.txt is based on an inline template
|
45
|
+
1. `main.rb` is based on `class.rb` from `app_template`
|
46
|
+
2. `person.rb` & `address.rb` are based on `model.rb` from `global_template`
|
47
|
+
3. `configuration.log.txt` is based on an inline template
|
41
48
|
|
42
49
|
```ruby
|
43
50
|
template = <<~TEXT
|
@@ -48,21 +55,26 @@ TEXT
|
|
48
55
|
|
49
56
|
builder = KBuilder::Builder.init
|
50
57
|
|
51
|
-
builder
|
52
|
-
'
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
58
|
+
builder
|
59
|
+
.add_file('main.rb', template_file: 'class.rb', name: 'main')
|
60
|
+
.add_file('person.rb',
|
61
|
+
template_file: 'model.rb',
|
62
|
+
name: 'person',
|
63
|
+
fields: %i[first_name last_name])
|
64
|
+
.add_file('address.rb',
|
65
|
+
template_file: 'model.rb',
|
66
|
+
name: 'address',
|
67
|
+
fields: %i[street1 street2 post_code state])
|
68
|
+
.add_file('configuration.log.txt',
|
69
|
+
template: template,
|
70
|
+
a: builder.template_folder,
|
71
|
+
b: builder.global_template_folder,
|
72
|
+
c: builder.target_folder)
|
73
|
+
.add_file('css/index.css',
|
74
|
+
template: '{{#each colors}} .{{.}} { color: {{.}} } {{/each}}',
|
75
|
+
colors: ['red', 'blue', 'green'],
|
76
|
+
pretty: true)
|
77
|
+
|
66
78
|
```
|
67
79
|
|
68
80
|
#### Folder Structure (after)
|
@@ -70,3 +82,23 @@ builder.add_file('main.rb', template_file: 'class.rb', name: 'main').add_file(
|
|
70
82
|
Folder structure after running the builder
|
71
83
|
|
72
84
|
![](_usage_folder_after.png)
|
85
|
+
|
86
|
+
#### main.rb
|
87
|
+
|
88
|
+
![main.rb](_out1.png)
|
89
|
+
|
90
|
+
#### person.rb
|
91
|
+
|
92
|
+
![](_out2.png)
|
93
|
+
|
94
|
+
#### address.rb
|
95
|
+
|
96
|
+
![person.rb](_out3.png)
|
97
|
+
|
98
|
+
#### configuration.log.txt
|
99
|
+
|
100
|
+
![configuration.log.txt](_out4.png)
|
101
|
+
|
102
|
+
#### css/index.css
|
103
|
+
|
104
|
+
![css/index.css](_out5.png)
|
data/_out1.png
ADDED
Binary file
|
data/_out2.png
ADDED
Binary file
|
data/_out3.png
ADDED
Binary file
|
data/_out4.png
ADDED
Binary file
|
data/_out5.png
ADDED
Binary file
|
data/k_builder.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.description = <<-TEXT
|
14
14
|
K Builder provides various fluent builders for initializing applications with different language requirements
|
15
15
|
TEXT
|
16
|
-
spec.homepage = 'http://appydave.com/gems/k-builder'
|
16
|
+
spec.homepage = 'http://appydave.com' # /gems/k-builder'
|
17
17
|
spec.license = 'MIT'
|
18
18
|
|
19
19
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
data/lib/k_builder/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: k_builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Cruwys
|
@@ -44,6 +44,11 @@ files:
|
|
44
44
|
- Rakefile
|
45
45
|
- STORIES.md
|
46
46
|
- USAGE.md
|
47
|
+
- _out1.png
|
48
|
+
- _out2.png
|
49
|
+
- _out3.png
|
50
|
+
- _out4.png
|
51
|
+
- _out5.png
|
47
52
|
- _usage_folder_after.png
|
48
53
|
- _usage_folder_before.png
|
49
54
|
- bin/console
|
@@ -60,11 +65,11 @@ files:
|
|
60
65
|
- lib/k_builder/builder.rb
|
61
66
|
- lib/k_builder/configuration.rb
|
62
67
|
- lib/k_builder/version.rb
|
63
|
-
homepage: http://appydave.com
|
68
|
+
homepage: http://appydave.com
|
64
69
|
licenses:
|
65
70
|
- MIT
|
66
71
|
metadata:
|
67
|
-
homepage_uri: http://appydave.com
|
72
|
+
homepage_uri: http://appydave.com
|
68
73
|
source_code_uri: https://github.com/klueless-io/k_builder
|
69
74
|
changelog_uri: https://github.com/klueless-io/k_builder/commits/master
|
70
75
|
post_install_message:
|