rbytes 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a2b785fc9d54a6ca927a015009e6dc828afd264c5bd9f2055ce903aa4ebd1c07
4
- data.tar.gz: c6de88c97011399b70b77ffdbf138ef46edd26a9889451e74d0a954da553eee5
3
+ metadata.gz: 53595c57bee23eca0389d923a2b7fec3c67e570c07a4405cc705afe658081a3a
4
+ data.tar.gz: d96f2d9536487f2432a0f56c9d9407c6caa7f04a2d9e98ecea72111e3e88e9b0
5
5
  SHA512:
6
- metadata.gz: a7ef023c07d2b51593664bfa42de8de319ecfaad698d586905fc4cb93751e0fa40db2c7c1878893b8c3bbff2208604c5f536ba0a33f61e46e4dee2418798ffdc
7
- data.tar.gz: d90ee6b3cfc3e1e1548d4c34862e355be5e3bfb10b8909a669ff1cc3cc4d05a8c7d9adac9940ae09ef24336c1e10ae05a0f3b203ce7eadd3f58b4f8e540853a3
6
+ metadata.gz: 9bee2dcc4ecf593b7aa7d7289955eb4518dadf74087bafa523880647e193bd2b8d16af2542c27e73f2a6d05fcbd2a73ea5de2fef02bfdd202dc013d4024c147a
7
+ data.tar.gz: 8f5928ca9ba174fab8e830825f2bad113fbb295cbd84b106cd0364d0519037750c1343acc19b40f1d1152f7ec1d92760180d594730247ff4c16d4133560c6376
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 0.1.1 (2023-03-20)
6
+
7
+ - Add Ruby Bytes project generator (see `templates/generator`).
8
+
5
9
  ## 0.1.0 (2023-03-17) 🍀
6
10
 
7
11
  - Initial release.
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
@@ -110,6 +110,7 @@ module RubyBytes
110
110
  require "thor"
111
111
  require "ruby_bytes/thor"
112
112
 
113
+ Rbytes::Base.source_paths << Dir.pwd
113
114
  Rbytes.new.template(url)
114
115
  end
115
116
  end
@@ -22,14 +22,14 @@ module RubyBytes
22
22
  contents = File.read(resolve_path(path))
23
23
  %(ERB.new(
24
24
  *[
25
- <<~'CODE'
26
- #{contents}
27
- CODE
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
@@ -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}"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubyBytes # :nodoc:
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
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.0
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-17 00:00:00.000000000 Z
11
+ date: 2023-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor