rbytes 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +2 -0
- data/lib/ruby_bytes/cli.rb +1 -0
- data/lib/ruby_bytes/compiler.rb +4 -4
- data/lib/ruby_bytes/test_case.rb +10 -3
- data/lib/ruby_bytes/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53595c57bee23eca0389d923a2b7fec3c67e570c07a4405cc705afe658081a3a
|
4
|
+
data.tar.gz: d96f2d9536487f2432a0f56c9d9407c6caa7f04a2d9e98ecea72111e3e88e9b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bee2dcc4ecf593b7aa7d7289955eb4518dadf74087bafa523880647e193bd2b8d16af2542c27e73f2a6d05fcbd2a73ea5de2fef02bfdd202dc013d4024c147a
|
7
|
+
data.tar.gz: 8f5928ca9ba174fab8e830825f2bad113fbb295cbd84b106cd0364d0519037750c1343acc19b40f1d1152f7ec1d92760180d594730247ff4c16d4133560c6376
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -53,6 +53,8 @@ You can also install Ruby Bytes as a plugin for Thor (see [Thor integration](#th
|
|
53
53
|
|
54
54
|
## Writing templates
|
55
55
|
|
56
|
+
> The quickes way to get started with using Ruby Bytes to build templates is to use [our generator](templates/generator/).
|
57
|
+
|
56
58
|
Ruby Bytes adds partial support to Thor/Rails templates. For that, you can use `#include` and `#render` methods:
|
57
59
|
|
58
60
|
```erb
|
data/lib/ruby_bytes/cli.rb
CHANGED
data/lib/ruby_bytes/compiler.rb
CHANGED
@@ -22,14 +22,14 @@ module RubyBytes
|
|
22
22
|
contents = File.read(resolve_path(path))
|
23
23
|
%(ERB.new(
|
24
24
|
*[
|
25
|
-
<<~'
|
26
|
-
|
27
|
-
|
25
|
+
<<~'TCODE'
|
26
|
+
#{contents}
|
27
|
+
TCODE
|
28
28
|
], trim_mode: "<>").result(binding))
|
29
29
|
end
|
30
30
|
|
31
31
|
def include(path, indent: 0)
|
32
|
-
indented(File.read(resolve_path(path)), indent)
|
32
|
+
indented(render(File.read(resolve_path(path))), indent)
|
33
33
|
end
|
34
34
|
|
35
35
|
private
|
data/lib/ruby_bytes/test_case.rb
CHANGED
@@ -11,9 +11,6 @@ module RubyBytes
|
|
11
11
|
class TestCase < Minitest::Test
|
12
12
|
TMP_DIR = File.join(Dir.pwd, "tmp", "rbytes_test")
|
13
13
|
|
14
|
-
FileUtils.rm_rf(TMP_DIR) if File.directory?(TMP_DIR)
|
15
|
-
FileUtils.mkdir_p(TMP_DIR)
|
16
|
-
|
17
14
|
Rbytes::Base.source_paths << TMP_DIR
|
18
15
|
|
19
16
|
# Patch Thor::LineEditor to use Basic in tests
|
@@ -81,6 +78,11 @@ module RubyBytes
|
|
81
78
|
|
82
79
|
attr_accessor :destination
|
83
80
|
|
81
|
+
def setup
|
82
|
+
FileUtils.rm_rf(TMP_DIR) if File.directory?(TMP_DIR)
|
83
|
+
FileUtils.mkdir_p(TMP_DIR)
|
84
|
+
end
|
85
|
+
|
84
86
|
def prepare_dummy
|
85
87
|
# Then, copy the dummy app if any
|
86
88
|
dummy = self.class.dummy_app
|
@@ -169,6 +171,11 @@ module RubyBytes
|
|
169
171
|
assert File.file?(fullpath), "File not found: #{path}"
|
170
172
|
end
|
171
173
|
|
174
|
+
def refute_file(path)
|
175
|
+
fullpath = File.join(destination, path)
|
176
|
+
refute File.file?(fullpath), "File must not exist: #{path}"
|
177
|
+
end
|
178
|
+
|
172
179
|
def refute_file_contains(path, body)
|
173
180
|
fullpath = File.join(destination, path)
|
174
181
|
assert File.file?(fullpath), "File not found: #{path}"
|
data/lib/ruby_bytes/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbytes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladimir Dementyev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-03-
|
11
|
+
date: 2023-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|