Top Level Namespace
Defined Under Namespace
Modules: ArJdbc, Hatio, HatioCore
Classes: GeneratorReport
Instance Method Summary
collapse
#check_required_param, #check_required_params, #convert_date_bet_cond, #convert_date_eq_cond, #convert_time_to_db, #debug_print, #empty_param?, #generateUUID, #parse_date, #parse_time, #parse_time_to_db, #to_std_date_str, #to_std_time_str
Instance Method Details
#countl(target, to) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/utils/detect_mismatch_tags.rb', line 4
def countl(target, to)
i = 0
a = ""
target.each_byte do |x|
a << x
a = "" unless to.index(a) == 0
i = i + 1 if a == to
a = "" if a == to
end
i
end
|
#find_mismatch(dir, tag) ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/utils/detect_mismatch_tags.rb', line 20
def find_mismatch dir, tag
dir = File.join(Rails.root, dir)
excludes = ["theme", "js", "touch"]
openTag = tag
closeTag = getCloseTag(tag)
Find.find(dir) do |path|
if FileTest.directory?(path)
if excludes.include?(File.basename(path))
Find.prune else
next
end
else
next unless path.end_with?('.js')
open = 0
close = 0
File.open(path).each do |line|
open += countl(line, openTag)
close += countl(line, closeTag)
end
puts "#{openTag} - #{path} : #{open} - #{close} = #{open - close}" unless open - close == 0
end
end
end
|
#find_mismatches(dir, tags = '{,[') ⇒ Object
16
17
18
|
# File 'lib/utils/detect_mismatch_tags.rb', line 16
def find_mismatches dir, tags='{,['
tags.split(',').each { |x| find_mismatch dir, x }
end
|
#getCloseTag(tag) ⇒ Object
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/utils/detect_mismatch_tags.rb', line 47
def getCloseTag tag
if(tag == '{')
return '}'
elsif(tag == '[')
return ']'
elsif(tag == '(')
return ')'
else
raise "Not support tag #{tag}!"
end
end
|
#traverse_terms(terms, category, cxt) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/utils/upload_locale.rb', line 4
def traverse_terms terms, category, cxt
terms.each do |name, value|
if value.is_a? String
if name.ends_with?('.short')
Terminology.where({
domain_id: Domain.current_domain.id,
name: name[0..-7],
locale: cxt['locale'],
category: category
}).first_or_create.update({
display_short: value
})
else
Terminology.where({
domain_id: Domain.current_domain.id,
name: name,
locale: cxt['locale'],
category: category
}).first_or_create.update({
display: value
})
end
else
traverse_terms value, name, cxt
end
end
end
|
#update_license ⇒ Object
1
2
3
4
5
|
# File 'lib/utils/update_license.rb', line 1
def update_license
Dir[Rails.root.to_path + '/app/assets/javascripts/**/*.js'].each do |jsfile|
puts "[JS FILE] #{jsfile}"
end
end
|
#upload_locale(upload_bundle = nil) ⇒ Object
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/utils/upload_locale.rb', line 1
def upload_locale(upload_bundle = nil)
require 'v8'
def traverse_terms terms, category, cxt
terms.each do |name, value|
if value.is_a? String
if name.ends_with?('.short')
Terminology.where({
domain_id: Domain.current_domain.id,
name: name[0..-7],
locale: cxt['locale'],
category: category
}).first_or_create.update({
display_short: value
})
else
Terminology.where({
domain_id: Domain.current_domain.id,
name: name,
locale: cxt['locale'],
category: category
}).first_or_create.update({
display: value
})
end
else
traverse_terms value, name, cxt
end
end
end
V8::Context.new do |cxt|
cxt['T'] = lambda do |this, terms|
traverse_terms terms, 'global', cxt
end
Hatio::Bundle.ordered_bundle_list.each do |bundle|
bundle_name = bundle.name
next if(upload_bundle && upload_bundle != bundle_name)
spec = Gem::Specification.find_by_name(bundle_name)
gem_root = spec.gem_dir
Dir[gem_root + '/app/assets/javascripts/**/locale/??-??.js'].each do |termfile|
puts "[LOCALE FILE] #{termfile}"
locale = termfile.split('/').last.split('.').first
cxt['locale'] = locale
cxt.load(termfile);
end
end
Dir[Rails.root.to_path + '/app/assets/javascripts/**/locale/??-??.js'].each do |termfile|
puts "[LOCALE FILE] #{termfile}"
locale = termfile.split('/').last.split('.').first
cxt['locale'] = locale
cxt.load(termfile);
end
end
end
|