rubyjs-vite 1.0.5 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/arguments.rb +7 -3
- data/app/main.rb +1 -2
- data/lib/ruby_js/code_join.rb +42 -6
- data/lib/ruby_js/scaffold.rb +1 -1
- data/lib/ruby_js/version.rb +1 -1
- data/lib/ruby_js.rb +4 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1ecaf5af46c82f3dc87b3581c2b1106a76d6c633c489e54df1c9ef2cd5c548e
|
4
|
+
data.tar.gz: de26dc30d23010a446198d9a19ac4dee7f9c2776ba91a2ff828b60d86806c07a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f12d19d2456635463aee1ec2cc23f07d122fa86f7512b3e4a146aff1d5ec202b0c6fd19f310917da745fc8d1bb8341b6083a4efea096cd74e893509136ef58d
|
7
|
+
data.tar.gz: 87803ac54cc51f22f5958b8ec7f2bdcb8fff7b3809fd68cf5f32db64b56281f8ae11dd00505aff15fc04507be197d47ef39a4ab87babd9f5b802ea31a01a28f1
|
data/app/arguments.rb
CHANGED
@@ -2,7 +2,7 @@ require "option_parser"
|
|
2
2
|
|
3
3
|
@options = {
|
4
4
|
compile: false,
|
5
|
-
generate:
|
5
|
+
generate: nil,
|
6
6
|
watch: false,
|
7
7
|
output: Dir.pwd,
|
8
8
|
source: Dir.pwd,
|
@@ -29,8 +29,12 @@ OptionParser.parse do |parser|
|
|
29
29
|
parser.on( "-c", "--compile", "Compile to JavaScript and save as .js files." ) do
|
30
30
|
@options[:compile] = true
|
31
31
|
end
|
32
|
-
parser.on( "-g", "--generate", "Copies every rjs file into a single rjs file." ) do
|
33
|
-
|
32
|
+
parser.on( "-g PATH", "--generate PATH", "Copies every rjs file into a single rjs file." ) do |path|
|
33
|
+
if File.directory?(path)
|
34
|
+
@options[:generate] = path
|
35
|
+
else
|
36
|
+
@options[:generate] = ""
|
37
|
+
end
|
34
38
|
end
|
35
39
|
parser.on("-o DIR", "--output DIR", "Set the output path or path/filename\n" +
|
36
40
|
"for compiled JavaScript." ) do |dir|
|
data/app/main.rb
CHANGED
data/lib/ruby_js/code_join.rb
CHANGED
@@ -15,7 +15,7 @@ module RubyJS
|
|
15
15
|
|
16
16
|
@json_cj = JsonParser.new File.join(path_s, FILE_HN)
|
17
17
|
@json_cj.on :name, "project"
|
18
|
-
@json_cj.on :ignore, ["#{FILE_N}_.*.rjs", TEST_N]
|
18
|
+
@json_cj.on :ignore, ["#{FILE_N}_.*.rjs", TEST_N, "main.rjs"]
|
19
19
|
end
|
20
20
|
|
21
21
|
def add_file path_f
|
@@ -61,13 +61,13 @@ module RubyJS
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
end
|
64
|
-
|
64
|
+
|
65
65
|
return files_c + files_nc
|
66
66
|
end
|
67
67
|
|
68
68
|
def extends_pos_class hash
|
69
|
-
fe_arr = []
|
70
|
-
fa_arr = []
|
69
|
+
fe_arr = [] # Extend class
|
70
|
+
fa_arr = [] # No extend class
|
71
71
|
hash.each do |c, e|
|
72
72
|
if e
|
73
73
|
arr_c = [c, e]
|
@@ -91,8 +91,44 @@ module RubyJS
|
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
|
-
|
95
|
-
|
94
|
+
last_class = check_last_extend_class(fe_arr)
|
95
|
+
|
96
|
+
fe_arr_ue = []
|
97
|
+
fe_arr.each do |cs|
|
98
|
+
cs.each do |c|
|
99
|
+
fe_arr_ue << c
|
100
|
+
end
|
101
|
+
end
|
102
|
+
fe_arr_uniq = change_extend_class_position(last_class, fe_arr_ue.uniq)
|
103
|
+
|
104
|
+
return fa_arr.clone.concat(fe_arr_uniq)
|
105
|
+
end
|
106
|
+
|
107
|
+
def change_extend_class_position last_class, fe_arr_uniq
|
108
|
+
last_class.each do |c|
|
109
|
+
i_c = fe_arr_uniq.delete c
|
110
|
+
fe_arr_uniq.push c
|
111
|
+
end
|
112
|
+
return fe_arr_uniq
|
113
|
+
end
|
114
|
+
|
115
|
+
def check_last_extend_class fe_arr
|
116
|
+
last_class = []
|
117
|
+
fe_arr.each do |cs|
|
118
|
+
unless last_class.empty?
|
119
|
+
last_class.each do |c|
|
120
|
+
is_exist = cs.find_index(c)
|
121
|
+
if is_exist
|
122
|
+
last_class.delete(c)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
if cs.length == 1
|
128
|
+
last_class << cs[0]
|
129
|
+
end
|
130
|
+
end
|
131
|
+
return last_class
|
96
132
|
end
|
97
133
|
|
98
134
|
def to_s
|
data/lib/ruby_js/scaffold.rb
CHANGED
@@ -7,7 +7,7 @@ module RubyJS
|
|
7
7
|
path_ao = File.join(Dir.pwd, project)
|
8
8
|
|
9
9
|
puts "Scaffolding project in #{path_ao}..."
|
10
|
-
FileUtils.
|
10
|
+
FileUtils.cp_r path_as, path_ao
|
11
11
|
|
12
12
|
json_oc = JsonParser.new File.join(path_ao, "package.json")
|
13
13
|
json_oc.parse :name, project.downcase
|
data/lib/ruby_js/version.rb
CHANGED
data/lib/ruby_js.rb
CHANGED
@@ -33,10 +33,10 @@ module RubyJS
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
def self.generate_cj path_s
|
36
|
+
def self.generate_cj path_s, path_g
|
37
37
|
path_hfd = path_s
|
38
38
|
unless File.exist?(File.join(path_s, CodeJoin::FILE_HN))
|
39
|
-
path_hfd =
|
39
|
+
path_hfd = Dir.pwd
|
40
40
|
end
|
41
41
|
|
42
42
|
code_join = CodeJoin.new path_hfd
|
@@ -50,7 +50,8 @@ module RubyJS
|
|
50
50
|
|
51
51
|
name_f = "#{code_join.json_cj.parse(:name).downcase.gsub(' ', '_')}_" +
|
52
52
|
"#{Time.now.strftime("%ya%m%d")}.#{Constants::FILE_TYPE}"
|
53
|
-
|
53
|
+
path_w = path_g.empty? ? path_s : path_g
|
54
|
+
path_f = File.join(path_w, name_f)
|
54
55
|
RubyJS::Helper.write(path_f, content_join)
|
55
56
|
puts Helper.event_p("generated", path_f)
|
56
57
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubyjs-vite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Filip Vrba
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby2js
|