svelte-on-rails 0.0.34 → 0.0.35
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/README.md +20 -41
- data/lib/svelte-on-rails.rb +0 -10
- data/lib/tasks/svelte_on_rails_tasks.rake +0 -29
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b3b3a20bdc53e8344c4e03d88ace00eb01e7c9f9b05545ea626af2a6131ef45
|
4
|
+
data.tar.gz: ccc007c3e60640ad5707b9361d73ffd7967a9af439a86be6ad358d5024fcd76c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3ff1581778782262c1798b73aed2fabff57a9f29b9d473fe80c40d4d440005e6aea26d9b1b118ed2a4f2cb61b833a2c26ebc188c736d034d776ba32fbe13cca
|
7
|
+
data.tar.gz: 33a3971a817cc494dc8245bad803c008a30ca01026e04d2391619cab50f53184b7de8945ab98ade59895eaffd1750b57d3140825207787dfdb915a6849359e34
|
data/README.md
CHANGED
@@ -259,51 +259,30 @@ Example from the rails console for a medium complex component
|
|
259
259
|
|
260
260
|
## Testing
|
261
261
|
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
The
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
262
|
+
Tests are based on the included templates, like the `hello world template` and on the installer.
|
263
|
+
|
264
|
+
That means, basically, when you run a test, it creates a new rails app and runs the installer.
|
265
|
+
The destination folder is defined by the file `generated_test_app_path` within the gems root folder.
|
266
|
+
The string there must represent a full path to a existing folder.
|
267
|
+
|
268
|
+
When you want to develop the components, the workflow is:
|
269
|
+
|
270
|
+
- run a component test
|
271
|
+
- the first run is slow because the installer must build the app
|
272
|
+
- the second run is fast because the app is already built
|
273
|
+
- open the browser by localhost:3000
|
274
|
+
- change the component
|
275
|
+
- run the component test again
|
276
|
+
- see the changes in the browser
|
277
|
+
|
277
278
|
NOTE: Theese tests are dependend on your environment, including the running ruby version!
|
278
|
-
I am
|
279
|
+
I am working on rvm. If you work on a different environment, some (not many) changes may be necessary.
|
280
|
+
Thats your part :)
|
279
281
|
|
280
282
|
The current test cases including (among others):
|
281
283
|
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
Development helpers:
|
286
|
-
|
287
|
-
```bash
|
288
|
-
rake svelte_on_rails:create_test_app
|
289
|
-
```
|
290
|
-
|
291
|
-
This creates a new rails app within `spec/installer_tests` and runs the installer with `--full`.
|
292
|
-
On the last line it shows you the path to the test app.
|
293
|
-
Now you can cd into this folder and run `rails s`.
|
294
|
-
|
295
|
-
```bash
|
296
|
-
rake svelte_on_rails:replace_test_app_hello_world
|
297
|
-
```
|
298
|
-
|
299
|
-
Overwrites the hello world files within this test app from template.
|
300
|
-
|
301
|
-
As a rule of thumb, for **component tests**, before each test, templates are copied onto the tests-app, and be tested by playwright and the rails server should remain running at the end of each component test.
|
302
|
-
On that way the templates easily can be developped and tested, the end user has maximum function stability and the developer always see the latest changes.
|
303
|
-
|
304
|
-
Idea is to have all working examples within the template and included in the testing scope as in the hello world component.
|
305
|
-
|
306
|
-
... for having a 100% WYSIWYG and a easy maintainable package so that contributors are motivated to come into my project.
|
284
|
+
create a completely new rails app, running the full installer and check if a hello World component is visible and javascript is working.
|
285
|
+
run assets:precompile within a rails app and check if the gem does its precompiling too.
|
307
286
|
|
308
287
|
## Licence
|
309
288
|
|
data/lib/svelte-on-rails.rb
CHANGED
@@ -37,14 +37,4 @@ module SvelteOnRails
|
|
37
37
|
puts "Error running create_test_app task: #{e.message}"
|
38
38
|
end
|
39
39
|
|
40
|
-
def self.run_replace_hello_world_task
|
41
|
-
# Ensure Rake tasks are loaded
|
42
|
-
Rake::Task.define_task(:environment) # Define a dummy environment task (if needed)
|
43
|
-
load File.expand_path('../rakefile', __FILE__) # Load the gem's Rakefile
|
44
|
-
|
45
|
-
# Invoke the task
|
46
|
-
Rake::Task['svelte_on_rails:replace_test_app_hello_world'].invoke
|
47
|
-
rescue StandardError => e
|
48
|
-
puts "Error running replace_test_app_hello_world task: #{e.message}"
|
49
|
-
end
|
50
40
|
end
|
@@ -72,33 +72,4 @@ namespace :svelte_on_rails do
|
|
72
72
|
SvelteOnRails::Compiler.reset_and_compile_all
|
73
73
|
end
|
74
74
|
|
75
|
-
desc "Build test app within spec/installer_tests"
|
76
|
-
task :create_test_app do
|
77
|
-
TestHelpers.cleanup_rails_app
|
78
|
-
TestHelpers.create_rails_app
|
79
|
-
TestHelpers.gem_setup("rails g svelte_on_rails:install --full")
|
80
|
-
puts '-'*80
|
81
|
-
puts "Built test app successfully!"
|
82
|
-
puts "You can now run the server by:"
|
83
|
-
puts "$ cd #{TestHelpers.installer_test_app_path} && rails s"
|
84
|
-
end
|
85
|
-
|
86
|
-
desc "Build test app within spec/installer_tests"
|
87
|
-
task :replace_test_app_hello_world do
|
88
|
-
#require_relative '../../lib/svelte_on_rails/lib/utils'
|
89
|
-
require_relative '../../spec/test_helpers'
|
90
|
-
th = TestHelpers
|
91
|
-
puts '-'*80
|
92
|
-
hw_i = SvelteOnRails::Installer::HelloWorld
|
93
|
-
#utils = SvelteOnRails::Lib::Utils
|
94
|
-
@hello_world_path = hw_i.install_hello_world(
|
95
|
-
SvelteOnRails::Generators::InstallGenerator::HELLO_WORLD_FILES,
|
96
|
-
app_root: th.installer_test_app_path,
|
97
|
-
force: true,
|
98
|
-
)
|
99
|
-
|
100
|
-
puts '-'*80
|
101
|
-
puts "replaced Hello World component with new one"
|
102
|
-
end
|
103
|
-
|
104
75
|
end
|