svelte-on-rails 0.0.41 → 0.0.42

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: 683e0e4881fc72969224d9792ba06ff4049c19adbcf55bc8e0ba817ba4be48d4
4
- data.tar.gz: 6a9ed00119ddbdb2b9a095458b010150ecd938d751e9112b26629343bc782656
3
+ metadata.gz: c46f6cb43c90617bc4798072b58a35e81a311886a858c379224216fc63c03d3e
4
+ data.tar.gz: 2bd3286eac9420225ac3f641d1cf783a84f48f575d69c0bce53a9b1da9d9d262
5
5
  SHA512:
6
- metadata.gz: a166ff91777a7969f50874feb855c522aeac968dae0c6f1659b92ced9ac461683cbac34eee6f3999b961db6669732dbcbea41d3f659f621a3c198fc6b3204e76
7
- data.tar.gz: dd7c49785a50f484c936fbac6f5a8000fc46d6fc7165113c55a7e437b4b2ac20a05a1da4d9311b24d8757d307fa14061c35b2fdf607614502bd6ff24aa0ee948
6
+ metadata.gz: 9e4ae887620aaabd737fc30864bed6eea15dcc9bb47e6ef9db4ab1e38f0ea96a1643b2f12cd81aeadf2c636e6e1575920da2efca62886e877a71dbe25b2818a2
7
+ data.tar.gz: 821084886d515faf8e68440a001bc4a3fd5d310c6068efbb1578ca558774f0ad731e5cf13f142b3223db7e5a2b380775319de9ce3e75a54e597ff59ba1a505cc
data/README.md CHANGED
@@ -263,10 +263,20 @@ Example from the rails console for a medium complex component
263
263
 
264
264
  ## Contributors Guide
265
265
 
266
- Tests are based on the included templates, like the `hello world template` and on the installer.
266
+ Contributors welcome!
267
+
268
+ After downloaded the gem, please run the task
269
+
270
+ ```bash
271
+ rake svelte_on_rails:create_contributor_configs_file
272
+ ```
273
+ and define a `generated_test_app_folder_path` (required) for apps, generated for the testings.
267
274
 
268
- On the gem folder you can put a file `generated_test_app_path`, and put the path for a existing
269
- folder where the tests generate a test rails app.
275
+ For development of the **npm package @csedl/svelte-on-rails** you can set the
276
+ `local_npm_package_path` (optional) and insert the path to the npm package on your local machine.
277
+ This will cause the installer, to install the npm package from a local path instead from the npm registry.
278
+
279
+ Tests are based on the included templates, like the `hello world template` and on the installer.
270
280
 
271
281
  **Installer tests** starting with completely destroy the rails app within the `generated_test_app_path`,
272
282
  generating a new rails app and running the installer and test by `playwright` if the components are working.
@@ -293,13 +303,6 @@ The current test cases including (among others):
293
303
  create a completely new rails app, running the full installer and check if a hello World component is visible and javascript is working.
294
304
  run assets:precompile within a rails app and check if the gem does its precompiling too.
295
305
 
296
- For development of the **npm package @csedl/svelte-on-rails** you can add the file
297
- `local_npm_package_path` and insert the path to the npm package on your local machine.
298
- This will cause the installer, not to install the npm package from npm, but to use the local one.
299
-
300
- ‼️ **ATTENTION:** Please do never commit the file `local_npm_package_path` to the repo! This is only for developers!
301
- Otherwise a user would, on running the installer, get an error, because the npm package is not found.
302
-
303
306
  ## Licence
304
307
 
305
308
  License is MIT
@@ -68,7 +68,7 @@ module SvelteOnRails
68
68
  if pkg
69
69
  {
70
70
  type: pkg.match(/^.*?(?=\/[^\/]*$)/).to_s,
71
- version: version.split('.').map(&:to_i)
71
+ version: version&.split('.')&.map(&:to_i)
72
72
  }
73
73
  end
74
74
 
@@ -2,18 +2,15 @@ module SvelteOnRails
2
2
  class DevelopmentUtils
3
3
 
4
4
  def self.local_npm_package_url
5
- config_file = gem_folder.join('local_npm_package_path')
6
- if !File.exist?(config_file)
7
- return nil
5
+ str = contributor_config('local_npm_package_path', required: false)
6
+ if !str.present?
7
+ nil
8
+ elsif !Dir.exist?(str)
9
+ raise "Invalid path given on local_npm_package_path: «#{str}»"
10
+ elsif !File.exist?(Pathname.new(str).join('package.json'))
11
+ raise "Given local_npm_package_path does not seem to be a valid npm package as it does not contain a package.json"
8
12
  else
9
- str = File.read(config_file).strip
10
- if !Dir.exist?(str)
11
- raise "Invalid path given on local_npm_package_path: «#{str}»"
12
- elsif !File.exist?(Pathname.new(str).join('package.json'))
13
- raise "Given local_npm_package_path does not seem to be a valid npm package as it does not contain a package.json"
14
- else
15
- return Pathname.new(str)
16
- end
13
+ return Pathname.new(str)
17
14
  end
18
15
  end
19
16
 
@@ -21,5 +18,21 @@ module SvelteOnRails
21
18
  Pathname.new(File.expand_path('../../..', __dir__))
22
19
  end
23
20
 
21
+ def self.contributor_config(key, required: true)
22
+ config_file = File.expand_path('../svelte_on_rails_contributor_configs.yml', gem_folder)
23
+ if !File.exist?(config_file)
24
+ if required
25
+ raise "Missing configuration file, searched at: «#{config_file}»"
26
+ end
27
+ else
28
+ yml = YAML.load_file(config_file)
29
+ value = yml[key.to_s]
30
+ if required && !value.present?
31
+ raise "Missing value «#{key}» in configuration file: «#{config_file}»"
32
+ end
33
+ value
34
+ end
35
+ end
36
+
24
37
  end
25
38
  end
@@ -71,4 +71,31 @@ namespace :svelte_on_rails do
71
71
  SvelteOnRails::Compiler.reset_and_compile_all
72
72
  end
73
73
 
74
+ desc "For contributors to this gem: writes a config file for developing options."
75
+ task :create_contributor_configs_file do
76
+ path = File.expand_path('../../../svelte_on_rails_contributor_configs.yml', __dir__)
77
+
78
+ if File.exist?(path)
79
+ puts "Config file for Contributors already exists: file://#{path}"
80
+ puts 'nothing done.'
81
+ exit
82
+ end
83
+
84
+ content = <<-END
85
+ #local_npm_package_path: /path/to/my/local/csedl-svelte-on-rails-main
86
+
87
+ # optional
88
+ # If you want to develop the @csedl/svelte-on-rails package
89
+ # add full path like /path/to/csedl-svelte-on-rails-main
90
+ # Then, on running the generator, it installs this package from your local root folder
91
+
92
+ generated_test_app_folder_path: /destination/folder/for/generated/test/app
93
+
94
+ # required!
95
+ # When you run tests, a rails app will be generated into this folder
96
+ END
97
+ File.write(path, content)
98
+ puts "Config file for Contributors created at: #{path}"
99
+ end
100
+
74
101
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: svelte-on-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.41
4
+ version: 0.0.42
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Sedlmair