mvcgen 0.1.26 → 0.1.27
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mvcgen/generator.rb +55 -52
- data/lib/mvcgen/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4fb6f71d6bf04c240281b752fecb498064ef979c
|
4
|
+
data.tar.gz: b013c7c2d61a6a8c2347b26bea5a51d477e930c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6bd58a456f9cf05363b0408b4407866c5b3b57b6631a0c124ab726562e312f7dd02ffe3a2fedce7d0e4651f2f005f7a1e7cc2889c193db7e9635bf9743ae3725
|
7
|
+
data.tar.gz: 9aee4de9a80fa9ad74e65e5674162fb96cca76d5c65cceb8090e3847df1d260da4aeedc912659a7987eff0ee71adbaa83620892197745b3581b32f18712b699e
|
data/lib/mvcgen/generator.rb
CHANGED
@@ -18,85 +18,88 @@ module MVCgen
|
|
18
18
|
proj = Xcodeproj::Project.open(project_file)
|
19
19
|
|
20
20
|
# TODO: view this to improve path files: allowable_project_paths
|
21
|
-
self.add_files_togroup(proj, proj.main_group, proj.targets.first)
|
22
|
-
|
21
|
+
# self.add_files_togroup(filespath, proj, proj.main_group, proj.targets.first)
|
22
|
+
self.addxcodefiles(filespath,proj.main_group,proj.targets.first)
|
23
23
|
|
24
24
|
proj.save
|
25
25
|
puts "Finish adding files"
|
26
26
|
end
|
27
27
|
|
28
28
|
def self.is_resource_group(file)
|
29
|
-
extname= file[/\.[^\.]+$/]
|
29
|
+
extname = file[/\.[^\.]+$/]
|
30
30
|
if extname == '.bundle' || extname == '.xcassets' then
|
31
31
|
return true
|
32
32
|
end
|
33
33
|
return false
|
34
34
|
end
|
35
35
|
|
36
|
-
def self.add_files_togroup(project, group, target)
|
36
|
+
# def self.add_files_togroup(direc, project, group, target)
|
37
|
+
# if File.exist?(Dir.glob(direc))
|
37
38
|
|
38
|
-
|
39
|
+
# Dir.glob(direc) do |entry|
|
40
|
+
# filePath = File.join(group.path, entry)
|
39
41
|
|
40
|
-
|
41
|
-
filePath = File.join(group.path, entry)
|
42
|
+
# # puts filePath
|
42
43
|
|
43
|
-
|
44
|
+
# if filePath.to_s.end_with?(".DS_Store", ".xcconfig") then
|
45
|
+
# # ignore
|
44
46
|
|
45
|
-
|
46
|
-
|
47
|
+
# elsif filePath.to_s.end_with?(".lproj") then
|
48
|
+
# if @variant_group.nil?
|
49
|
+
# @variant_group = group.new_variant_group("Localizable.strings");
|
50
|
+
# end
|
51
|
+
# string_file = File.join(filePath, "Localizable.strings")
|
52
|
+
# fileReference = @variant_group.new_reference(string_file)
|
53
|
+
# target.add_resources([fileReference])
|
47
54
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
string_file = File.join(filePath, "Localizable.strings")
|
53
|
-
fileReference = @variant_group.new_reference(string_file)
|
54
|
-
target.add_resources([fileReference])
|
55
|
+
# elsif self.is_resource_group(entry) then
|
56
|
+
# fileReference = group.new_reference(filePath)
|
57
|
+
# target.add_resources([fileReference])
|
58
|
+
# elsif !File.directory?(filePath) then
|
55
59
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
+
# fileReference = group.new_reference(filePath)
|
61
|
+
# if filePath.to_s.end_with?(".swift", ".mm", ".m", ".cpp") then
|
62
|
+
# target.add_file_references([fileReference])
|
63
|
+
# elsif filePath.to_s.end_with?(".pch") then
|
60
64
|
|
61
|
-
|
62
|
-
if filePath.to_s.end_with?(".swift", ".mm", ".m", ".cpp") then
|
63
|
-
target.add_file_references([fileReference])
|
64
|
-
elsif filePath.to_s.end_with?(".pch") then
|
65
|
+
# elsif filePath.to_s.end_with?("Info.plist") && entry == "Info.plist" then
|
65
66
|
|
66
|
-
|
67
|
+
# elsif filePath.to_s.end_with?(".h") then
|
68
|
+
# # target.headers_build_phase.add_file_reference(fileReference)
|
69
|
+
# elsif filePath.to_s.end_with?(".framework") || filePath.to_s.end_with?(".a") then
|
70
|
+
# target.frameworks_build_phases.add_file_reference(fileReference)
|
71
|
+
# elsif
|
72
|
+
# target.add_resources([fileReference])
|
73
|
+
# end
|
74
|
+
# elsif File.directory?(filePath) && entry != '.' && entry != '..' then
|
67
75
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
elsif
|
73
|
-
target.add_resources([fileReference])
|
74
|
-
end
|
75
|
-
elsif File.directory?(filePath) && entry != '.' && entry != '..' then
|
76
|
+
# subGroup = group.find_subpath(entry, true)
|
77
|
+
# subGroup.set_source_tree(group.source_tree)
|
78
|
+
# subGroup.set_path(File.join(group.path, entry))
|
79
|
+
# add_files_togroup(project, target, subGroup)
|
76
80
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
81
|
+
# end
|
82
|
+
# end
|
83
|
+
# end
|
84
|
+
# end
|
86
85
|
|
87
86
|
def self.addxcodefiles(direc, current_group, main_target)
|
88
87
|
Dir.glob(direc) do |item|
|
89
88
|
next if item == '.' or item == '.DS_Store'
|
90
89
|
if File.directory?(item)
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
elsif item
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
90
|
+
new_folder = File.basename(item)
|
91
|
+
created_group = current_group.new_group(new_folder)
|
92
|
+
self.addxcodefiles("#{item}/*", created_group, main_target)
|
93
|
+
elsif self.is_resource_group(item) then
|
94
|
+
fileReference = current_group.new_reference(filePath)
|
95
|
+
main_target.add_resources([fileReference])
|
96
|
+
# elsif item == "Assets.xcassets"
|
97
|
+
# main_target.add_frameworks_bundles([item])
|
98
|
+
# break
|
99
|
+
else
|
100
|
+
i = current_group.new_reference(filePath)
|
101
|
+
# i = current_group.new_file(item)
|
102
|
+
main_target.add_file_references([i])
|
100
103
|
end
|
101
104
|
end
|
102
105
|
end
|
data/lib/mvcgen/version.rb
CHANGED