rbytes 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a2b785fc9d54a6ca927a015009e6dc828afd264c5bd9f2055ce903aa4ebd1c07
4
- data.tar.gz: c6de88c97011399b70b77ffdbf138ef46edd26a9889451e74d0a954da553eee5
3
+ metadata.gz: 240c05001c82217a6c81800227e8043364abf995559420377265e921bf8b30a6
4
+ data.tar.gz: 44c8486ef55774b3fbf8bf6781dc17202e2b5e9a8f885fe7db8395ca7fa59e0c
5
5
  SHA512:
6
- metadata.gz: a7ef023c07d2b51593664bfa42de8de319ecfaad698d586905fc4cb93751e0fa40db2c7c1878893b8c3bbff2208604c5f536ba0a33f61e46e4dee2418798ffdc
7
- data.tar.gz: d90ee6b3cfc3e1e1548d4c34862e355be5e3bfb10b8909a669ff1cc3cc4d05a8c7d9adac9940ae09ef24336c1e10ae05a0f3b203ce7eadd3f58b4f8e540853a3
6
+ metadata.gz: d85b989709ffb1a3eb9a820516a5097bc87a6788b6384faa36ca00ec2608e9df7a366383826761b7938dfbcf6976b5335cfb90ce1d667af61c1c957fa88b6ec1
7
+ data.tar.gz: 149d5ec020537aaedb78c5d17d6dd9e56f75d33493b22ec6f12b1679515065f672e9bb91859a726bb90ee38766ec5ed3a61f4ffb08801e4fd315bc9be22e28c8
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 0.1.2 (2023-03-20)
6
+
7
+ - Add missing `rbytes` executable to the gemspec.
8
+
9
+ ## 0.1.1 (2023-03-20)
10
+
11
+ - Add Ruby Bytes project generator (see `templates/generator`).
12
+
5
13
  ## 0.1.0 (2023-03-17) 🍀
6
14
 
7
15
  - Initial release.
data/README.md CHANGED
@@ -53,6 +53,16 @@ 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 quickest way to get started with using Ruby Bytes to build templates is to use our generator to create a project:
57
+
58
+ ```sh
59
+ $ rbytes install https://railsbytes.com/script/V2GsbB
60
+
61
+ ...
62
+ ```
63
+
64
+ ### Splitting template into partials
65
+
56
66
  Ruby Bytes adds partial support to Thor/Rails templates. For that, you can use `#include` and `#render` methods:
57
67
 
58
68
  ```erb
@@ -78,7 +88,7 @@ cable_adapter = ask? "Which AnyCable pub/sub adapter do you want to use?"
78
88
  file "config/anycable.yml", <%= code("anycable.yml") %>
79
89
  ```
80
90
 
81
- The compiled template will like like this:
91
+ The compiled template will look like this:
82
92
 
83
93
  ```erb
84
94
  cable_adapter = ask? "Which AnyCable pub/sub adapter do you want to use?"
@@ -92,7 +102,7 @@ file "config/anycable.yml", ERB.new(
92
102
  ], trim_mode: "<>").result(binding)
93
103
  ```
94
104
 
95
- **NOTE:** By default, we assume that partials are stored next to the template's entrypoint. Partials may have "_" prefix and ".rb"/".tt" suffixes.
105
+ **NOTE:** By default, we assume that partials are stored next to the template's entry-point. Partials may have the "_" prefix and ".rb" or ".tt" suffixes.
96
106
 
97
107
  ### Compiling templates
98
108
 
@@ -249,7 +259,7 @@ Bug reports and pull requests are welcome on GitHub at [https://github.com/palka
249
259
 
250
260
  ## Credits
251
261
 
252
- This gem is generated via [new-gem-generator](https://github.com/palkan/new-gem-generator).
262
+ This gem is generated via [`newgem` template](https://github.com/palkan/newgem) by [@palkan](https://github.com/palkan).
253
263
 
254
264
  ## License
255
265
 
@@ -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.2"
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.2
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
@@ -70,7 +70,8 @@ description: Ruby Bytes is a tool to build application templates for Ruby and Ra
70
70
  applications
71
71
  email:
72
72
  - dementiev.vm@gmail.com
73
- executables: []
73
+ executables:
74
+ - rbytes
74
75
  extensions: []
75
76
  extra_rdoc_files: []
76
77
  files: