rubyjs-vite 1.0.5 → 1.0.7

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: c39af5daef081c5bc9c342f12d60d2638d5ee4d4da919248b8141f4d597dc60c
4
- data.tar.gz: 9976bce372c776e1017f2803a5668bd18884c267ad267b121a1560381a298c05
3
+ metadata.gz: d1ecaf5af46c82f3dc87b3581c2b1106a76d6c633c489e54df1c9ef2cd5c548e
4
+ data.tar.gz: de26dc30d23010a446198d9a19ac4dee7f9c2776ba91a2ff828b60d86806c07a
5
5
  SHA512:
6
- metadata.gz: 8eea646c8f3a31ba4c855d5bbed5dbea5cf93f6bd37c63c814636faecf3757c776fbcff4b8f849fe1d814953ddba69b3458fee64d56a4fdb9df3fe6bf175dc8f
7
- data.tar.gz: 4a0cb39723484ca3cbbf110f3d1722f647bbd4ed741b8f2b5c65bfbd63d34234c61ce07db82a67954c25020a757bd4afd9bafaeab5e818fb1906205ea7fffa12
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: false,
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
- @options[:generate] = true
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
@@ -22,8 +22,7 @@ end
22
22
 
23
23
  def generate
24
24
  if @options[:generate]
25
- path_s = @options[:source]
26
- code_j = RubyJS.generate_cj path_s
25
+ code_j = RubyJS.generate_cj @options[:source], @options[:generate]
27
26
  return code_j.get_ignore_r
28
27
  end
29
28
 
@@ -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
- fe_arr_u = fe_arr.group_by{|x|x[1]}.values.map(&:last).reverse
95
- return fa_arr.clone.concat(fe_arr_u).to_s.gsub(/[\[\]\"]/, '').split(', ')
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
@@ -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.copy_entry path_as, path_ao
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
@@ -1,3 +1,3 @@
1
1
  module RubyJS
2
- VERSION = "1.0.5"
2
+ VERSION = "1.0.7"
3
3
  end
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 = ROOT
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
- path_f = File.join(path_s, name_f)
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.5
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-27 00:00:00.000000000 Z
11
+ date: 2022-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby2js