roda-vite 0.2.0 → 0.3.0
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/lib/version.rb +1 -1
- data/lib/vite_roda/lib/vite_roda/installation.rb +19 -4
- 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: baacd4f5b199ed697cc5ac19f952b61c2c3852048a44e41d3f644299dbdbd509
|
4
|
+
data.tar.gz: 281aeea9ef2e4ecc85cf8c0bf36156e53cb9ac5f51ed6ac4396ed054c9b719c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e8e77a7503276004f2390c290b3d19fd09e06d2d6ad8ad4aa937b32bb7bc0547a32537ab261bb102e313fcb540d1bf96cf39ac71964b9e631cd3be512f5981e
|
7
|
+
data.tar.gz: b06a90e6a2125f7fbe058265de17de952e9a2514d498ae8979e7fef0df2989c0c647e7d328d296a94668c0d2f1bd1e5731ff9b206665a5bf51de294f7ed51b5e
|
data/lib/version.rb
CHANGED
@@ -64,13 +64,28 @@ module ViteRoda::Installation
|
|
64
64
|
POST_INSTALL_MESSAGE
|
65
65
|
end
|
66
66
|
|
67
|
-
# Internal: Ensures the Vite plugin is loaded in app.rb
|
67
|
+
# Internal: Ensures the Vite plugin is loaded in app.rb, or [app_name].rb
|
68
|
+
# This check is skipped if the -f or --force flag is passed
|
68
69
|
def ensure_roda_plugin_added
|
69
|
-
|
70
|
-
|
70
|
+
return if ARGV.any? { |flag| ['-f', '--force'].include? flag }
|
71
|
+
|
72
|
+
unless line_with_prefix_exists? root.join('app.rb'), 'plugin :vite' ||
|
73
|
+
line_with_prefix_exists? root.join("#{app_name}.rb"), 'plugin :vite'
|
74
|
+
abort "Add plugin :vite to your Roda app (found in app.rb or #{app_name}.rb) before installing, or pass -f to force."
|
71
75
|
end
|
72
76
|
end
|
73
77
|
|
78
|
+
# Internal: Get probable app_name for checking if plugin :vite has been loaded.
|
79
|
+
# If this is wrong, the install subcommand can always be forced with -f.
|
80
|
+
def app_name
|
81
|
+
|
82
|
+
# Return the name of current working directory, for now. More complex logic may be added
|
83
|
+
# here, including returning a list of probable app_names for use with #any? like:
|
84
|
+
# unless files.any? { |file| line_with_prefix_exists?(file, 'plugin :vite') }
|
85
|
+
|
86
|
+
File.basename(Dir.pwd)
|
87
|
+
end
|
88
|
+
|
74
89
|
# Using String#lstrip and String#start_with? is supposedly faster than using Regex as:
|
75
90
|
# File.readlines(file).any? { |line| line.match?(/^\s*plugin :vite/) } if File.exist?(file)
|
76
91
|
def line_with_prefix_exists?(file, string)
|
@@ -146,6 +161,6 @@ module ViteRoda::Installation
|
|
146
161
|
|
147
162
|
end
|
148
163
|
|
149
|
-
puts "VITE RODA CLI"
|
164
|
+
puts "VITE RODA CLI" if ARGV.include?('--debug')
|
150
165
|
|
151
166
|
ViteRuby::CLI::Install.prepend(ViteRoda::Installation)
|