m9sh 0.2.2 → 0.2.3
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/m9sh/generator.rb +17 -1
- data/lib/m9sh/version.rb +1 -1
- 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: b2943f1ea814ee67959d6641c70faafff3cd1679436893f0e5e6bd0346a87bd1
|
4
|
+
data.tar.gz: 19596194b09be430dab2ece4179bf7a7adb748f9e47016dd4e74b5420eac087a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6082841e10731ac6b1f8524a3e8c2c3f6ea402a385d543c180bbee82308778a393b04b87569792689c7ab49d383e756fdcf40bc15586571c2482a60402a040c9
|
7
|
+
data.tar.gz: b5ddcde073cd21ab9956c713eba54582ec28adbf1cb6a9cec76410e571dccd3575ccfa351043c4e1798bc3605b4b567770e2fd2fdcbe43a5f863e0115af49fc9
|
data/lib/m9sh/generator.rb
CHANGED
@@ -107,7 +107,8 @@ module M9sh
|
|
107
107
|
end
|
108
108
|
|
109
109
|
def copy_file(source_file, namespace, components_path, javascript_path, force)
|
110
|
-
|
110
|
+
# Find the source file - first try gem installation, then local dev
|
111
|
+
source_path = find_source_file(source_file)
|
111
112
|
|
112
113
|
unless File.exist?(source_path)
|
113
114
|
return { success: false, error: "Source file not found: #{source_file}" }
|
@@ -179,5 +180,20 @@ module M9sh
|
|
179
180
|
def sync_all(options = {})
|
180
181
|
generate_all(options.merge(force: true))
|
181
182
|
end
|
183
|
+
|
184
|
+
# Find source file in gem directory or local development directory
|
185
|
+
def find_source_file(relative_path)
|
186
|
+
# First, try the gem installation directory
|
187
|
+
begin
|
188
|
+
spec = Gem::Specification.find_by_name('m9sh')
|
189
|
+
gem_path = File.join(spec.gem_dir, relative_path)
|
190
|
+
return gem_path if File.exist?(gem_path)
|
191
|
+
rescue Gem::MissingSpecError
|
192
|
+
# Gem not installed, fall through to local path
|
193
|
+
end
|
194
|
+
|
195
|
+
# Fall back to local development path
|
196
|
+
File.join(@root_path, relative_path)
|
197
|
+
end
|
182
198
|
end
|
183
199
|
end
|
data/lib/m9sh/version.rb
CHANGED