generamba-mp 0.0.3 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.DS_Store +0 -0
- data/.vscode/launch.json +64 -0
- data/generamba.gemspec +4 -4
- data/lib/generamba/cli/cli.rb +1 -1
- data/lib/generamba/cli/gen_command.rb +15 -9
- data/lib/generamba/code_generation/code_module.rb +4 -2
- data/lib/generamba/helpers/xcodeproj_helper.rb +9 -3
- data/lib/generamba/module_generator.rb +12 -5
- data/lib/generamba/tools/liquid-camelcase.rb +14 -0
- metadata +12 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4cf24c7bef74d63bd1a60fa24e1a13d8acfaf652
|
4
|
+
data.tar.gz: fafff07f593f7d39d2be0aaea8e1749f1007d535
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00aace9efe6aec620ed780c8a374a54c01d6715cacf5a7cab0c0aae8a04b2f11bc699485d605c7abfce113a921f54985a3975f3acd14d720b4d35b267bb3b728
|
7
|
+
data.tar.gz: 9c578a7ff41873246efba781363ff3914f306339ac86af4e942b49b68c2b654160159248e34ea96d43dfa5d01b8769beb71089deaae89740645634fe247fba30
|
data/.DS_Store
ADDED
Binary file
|
data/.vscode/launch.json
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
{
|
2
|
+
// Use IntelliSense to learn about possible attributes.
|
3
|
+
// Hover to view descriptions of existing attributes.
|
4
|
+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
5
|
+
"version": "0.2.0",
|
6
|
+
"configurations": [
|
7
|
+
{
|
8
|
+
"name": "Debug Local File",
|
9
|
+
"type": "Ruby",
|
10
|
+
"request": "launch",
|
11
|
+
"cwd": "${workspaceRoot}",
|
12
|
+
"program": "${workspaceRoot}/bin/generamba"
|
13
|
+
},
|
14
|
+
{
|
15
|
+
"name": "Listen for rdebug-ide",
|
16
|
+
"type": "Ruby",
|
17
|
+
"request": "attach",
|
18
|
+
"cwd": "${workspaceRoot}",
|
19
|
+
"remoteHost": "127.0.0.1",
|
20
|
+
"remotePort": "1234",
|
21
|
+
"remoteWorkspaceRoot": "${workspaceRoot}"
|
22
|
+
},
|
23
|
+
{
|
24
|
+
"name": "Rails server",
|
25
|
+
"type": "Ruby",
|
26
|
+
"request": "launch",
|
27
|
+
"cwd": "${workspaceRoot}",
|
28
|
+
"program": "${workspaceRoot}/bin/rails",
|
29
|
+
"args": [
|
30
|
+
"server"
|
31
|
+
]
|
32
|
+
},
|
33
|
+
{
|
34
|
+
"name": "RSpec - all",
|
35
|
+
"type": "Ruby",
|
36
|
+
"request": "launch",
|
37
|
+
"cwd": "${workspaceRoot}",
|
38
|
+
"program": "${workspaceRoot}/bin/rspec",
|
39
|
+
"args": [
|
40
|
+
"-I",
|
41
|
+
"${workspaceRoot}"
|
42
|
+
]
|
43
|
+
},
|
44
|
+
{
|
45
|
+
"name": "RSpec - active spec file only",
|
46
|
+
"type": "Ruby",
|
47
|
+
"request": "launch",
|
48
|
+
"cwd": "${workspaceRoot}",
|
49
|
+
"program": "${workspaceRoot}/bin/rspec",
|
50
|
+
"args": [
|
51
|
+
"-I",
|
52
|
+
"${workspaceRoot}",
|
53
|
+
"${file}"
|
54
|
+
]
|
55
|
+
},
|
56
|
+
{
|
57
|
+
"name": "Cucumber",
|
58
|
+
"type": "Ruby",
|
59
|
+
"request": "launch",
|
60
|
+
"cwd": "${workspaceRoot}",
|
61
|
+
"program": "${workspaceRoot}/bin/cucumber"
|
62
|
+
}
|
63
|
+
]
|
64
|
+
}
|
data/generamba.gemspec
CHANGED
@@ -5,13 +5,13 @@ require 'generamba/version'
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'generamba-mp'
|
8
|
-
spec.version = '0.0.
|
9
|
-
spec.authors = ['Marton Pito']
|
8
|
+
spec.version = '0.0.5'
|
9
|
+
spec.authors = ['Egor Tolstoy', 'Andrey Zarembo', 'Beniamin Sarkisyan', 'Aleksandr Sychev','Marton Pito']
|
10
10
|
spec.email = 'martonpito@gmail.com'
|
11
11
|
|
12
|
-
spec.summary = '
|
12
|
+
spec.summary = 'FORKED FOR OWN USAGE! Advanced code generator for Xcode projects with a nice and flexible template system.'
|
13
13
|
spec.description = 'Generamba is a powerful and easy-to-use Xcode code generator. It provides a project-based configuration, flexible templates system, the ability to generate code and tests simultaneously.'
|
14
|
-
spec.homepage = 'https://github.com/
|
14
|
+
spec.homepage = 'https://github.com/rambler-digital-solutions/Generamba'
|
15
15
|
spec.license = 'MIT'
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
data/lib/generamba/cli/cli.rb
CHANGED
@@ -8,9 +8,9 @@ require 'generamba/cli/version_command.rb'
|
|
8
8
|
require 'generamba/cli/setup_username_command.rb'
|
9
9
|
require 'generamba/cli/thor_extension.rb'
|
10
10
|
require 'generamba/cli/template/template_group.rb'
|
11
|
+
require 'generamba/tools/liquid-camelcase.rb'
|
11
12
|
|
12
13
|
module Generamba::CLI
|
13
14
|
class Application < Thor
|
14
|
-
|
15
15
|
end
|
16
16
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'thor'
|
2
|
+
require 'liquid'
|
2
3
|
require 'generamba/helpers/print_table.rb'
|
3
4
|
require 'generamba/helpers/rambafile_validator.rb'
|
4
5
|
require 'generamba/helpers/xcodeproj_helper.rb'
|
@@ -58,15 +59,20 @@ module Generamba::CLI
|
|
58
59
|
DependencyChecker.check_all_required_dependencies_has_in_cartfile(template.dependencies, code_module.cartfile_path)
|
59
60
|
|
60
61
|
project = XcodeprojHelper.obtain_project(code_module.xcodeproj_path)
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
62
|
+
|
63
|
+
template.code_files.each do |file|
|
64
|
+
file_group = File.join(code_module.project_group_path, "/", File.dirname(file[TEMPLATE_NAME_KEY]))
|
65
|
+
|
66
|
+
if XcodeprojHelper.module_with_group_path_already_exists(project, file_group)
|
67
|
+
replace_exists_module = yes?("#{module_name} module already exists. Replace? (yes/no)")
|
68
|
+
|
69
|
+
unless replace_exists_module
|
70
|
+
return
|
71
|
+
else
|
72
|
+
break
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
70
76
|
|
71
77
|
generator = Generamba::ModuleGenerator.new
|
72
78
|
generator.generate_module(module_name, code_module, template)
|
@@ -81,7 +81,8 @@ module Generamba
|
|
81
81
|
file_path = group_path unless file_path
|
82
82
|
|
83
83
|
variable_value = file_path.gsub(SLASH_REGEX, '')
|
84
|
-
variable_value = Pathname.new(variable_value)
|
84
|
+
variable_value = Pathname.new(variable_value)#.join(@name)
|
85
|
+
puts("setup_file_and_group_paths variable_value: #{variable_value}")
|
85
86
|
instance_variable_set("@#{variable_name}", variable_value)
|
86
87
|
end
|
87
88
|
|
@@ -91,7 +92,8 @@ module Generamba
|
|
91
92
|
group_path = file_path unless group_path
|
92
93
|
|
93
94
|
variable_value = group_path.gsub(SLASH_REGEX, '')
|
94
|
-
variable_value = Pathname.new(variable_value)
|
95
|
+
variable_value = Pathname.new(variable_value)#.join(@name)
|
96
|
+
puts("setup_file_and_group_paths variable_value: #{variable_value}")
|
95
97
|
instance_variable_set("@#{variable_name}", variable_value)
|
96
98
|
end
|
97
99
|
end
|
@@ -24,6 +24,8 @@ module Generamba
|
|
24
24
|
file_path = file_path.join(file_group_path) if file_group_path
|
25
25
|
file_path = file_path.join(file_name) if file_name
|
26
26
|
|
27
|
+
puts "add_file_to_project_and_targets file_path: #{file_path}"
|
28
|
+
|
27
29
|
module_group = self.retrieve_group_or_create_if_needed(group_path, dir_path, file_group_path, project, true)
|
28
30
|
xcode_file = module_group.new_file(File.absolute_path(file_path))
|
29
31
|
|
@@ -46,6 +48,7 @@ module Generamba
|
|
46
48
|
#
|
47
49
|
# @return [void]
|
48
50
|
def self.add_group_to_project(project, group_path, dir_path, directory_name)
|
51
|
+
puts "add_group_to_project: group_path: #{group_path}, dir_path: #{dir_path}, directory_name: #{directory_name} "
|
49
52
|
self.retrieve_group_or_create_if_needed(group_path, dir_path, directory_name, project, true)
|
50
53
|
end
|
51
54
|
|
@@ -72,9 +75,11 @@ module Generamba
|
|
72
75
|
# @return [Void]
|
73
76
|
def self.clear_group(project, targets_name, group_path)
|
74
77
|
module_group = self.retrieve_group_or_create_if_needed(group_path, nil, nil, project, false)
|
78
|
+
puts "clear_group: group_path: #{group_path} module_group: #{module_group}"
|
75
79
|
return unless module_group
|
76
80
|
|
77
81
|
files_path = self.files_path_from_group(module_group, project)
|
82
|
+
puts "clear_group: group_path: #{group_path} files_path: #{files_path}"
|
78
83
|
return unless files_path
|
79
84
|
|
80
85
|
files_path.each do |file_path|
|
@@ -105,15 +110,16 @@ module Generamba
|
|
105
110
|
#
|
106
111
|
# @return [PBXGroup]
|
107
112
|
def self.retrieve_group_or_create_if_needed(group_path, dir_path, file_group_path, project, create_group_if_not_exists)
|
113
|
+
|
108
114
|
group_names = path_names_from_path(group_path)
|
109
115
|
group_components_count = group_names.count
|
110
116
|
group_names += path_names_from_path(file_group_path) if file_group_path
|
111
|
-
|
117
|
+
puts "retrieve_group_or_create_if_needed group_names: #{group_names}" unless create_group_if_not_exists
|
112
118
|
final_group = project
|
113
119
|
|
114
120
|
group_names.each_with_index do |group_name, index|
|
115
121
|
next_group = final_group[group_name]
|
116
|
-
|
122
|
+
# puts "retrieve_group_or_create_if_needed next_group: #{next_group}" unless create_group_if_not_exists
|
117
123
|
unless next_group
|
118
124
|
return nil unless create_group_if_not_exists
|
119
125
|
|
@@ -126,7 +132,7 @@ module Generamba
|
|
126
132
|
|
127
133
|
final_group = next_group
|
128
134
|
end
|
129
|
-
|
135
|
+
# puts "final_group: #{final_group}" unless create_group_if_not_exists
|
130
136
|
final_group
|
131
137
|
end
|
132
138
|
|
@@ -55,25 +55,32 @@ module Generamba
|
|
55
55
|
def process_files_if_needed(files, code_module, template, project, targets, group_path, dir_path, processed_groups = [])
|
56
56
|
# It's possible that current project doesn't test targets configured, so it doesn't need to generate tests.
|
57
57
|
# The same is for files property - a template can have only test or project files
|
58
|
+
puts "process_files_if_needed: group_path: #{group_path}\n dir_path: #{dir_path}\n"
|
58
59
|
if targets.count == 0 || files == nil || files.count == 0 || dir_path == nil || group_path == nil
|
59
60
|
return
|
60
61
|
end
|
61
62
|
|
62
|
-
XcodeprojHelper.clear_group(project, targets, group_path) unless processed_groups.include? group_path
|
63
63
|
files.each do |file|
|
64
|
-
unless file[TEMPLATE_FILE_PATH_KEY]
|
65
64
|
|
65
|
+
file_group = File.dirname(file[TEMPLATE_NAME_KEY])
|
66
|
+
file_group = nil if file_group == '.'
|
67
|
+
|
68
|
+
unless processed_groups.include? File.join(group_path, "/", file_group)
|
69
|
+
# puts "process_files_if_needed: file_group: #{File.join(group_path, "/", file_group)}"
|
70
|
+
XcodeprojHelper.clear_group(project, targets, File.join(group_path, "/", file_group))
|
71
|
+
processed_groups.push(File.join(group_path, "/", file_group))
|
72
|
+
end
|
73
|
+
|
74
|
+
unless file[TEMPLATE_FILE_PATH_KEY]
|
66
75
|
directory_name = file[TEMPLATE_NAME_KEY].gsub(/^\/|\/$/, '')
|
67
76
|
file_group = dir_path.join(directory_name)
|
68
77
|
|
69
78
|
FileUtils.mkdir_p file_group
|
70
79
|
XcodeprojHelper.add_group_to_project(project, group_path, dir_path, directory_name)
|
80
|
+
|
71
81
|
next
|
72
82
|
end
|
73
83
|
|
74
|
-
# file_group = File.dirname(file[TEMPLATE_NAME_KEY])
|
75
|
-
file_group = nil if file_group == '.'
|
76
|
-
|
77
84
|
module_info = ModuleInfoGenerator.new(code_module)
|
78
85
|
|
79
86
|
# Generating the content of the code file and it's name
|
metadata
CHANGED
@@ -1,14 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: generamba-mp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
+
- Egor Tolstoy
|
8
|
+
- Andrey Zarembo
|
9
|
+
- Beniamin Sarkisyan
|
10
|
+
- Aleksandr Sychev
|
7
11
|
- Marton Pito
|
8
12
|
autorequire:
|
9
13
|
bindir: bin
|
10
14
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
15
|
+
date: 2018-05-19 00:00:00.000000000 Z
|
12
16
|
dependencies:
|
13
17
|
- !ruby/object:Gem::Dependency
|
14
18
|
name: thor
|
@@ -179,10 +183,12 @@ executables:
|
|
179
183
|
extensions: []
|
180
184
|
extra_rdoc_files: []
|
181
185
|
files:
|
186
|
+
- ".DS_Store"
|
182
187
|
- ".codeclimate.yml"
|
183
188
|
- ".gitignore"
|
184
189
|
- ".rspec"
|
185
190
|
- ".travis.yml"
|
191
|
+
- ".vscode/launch.json"
|
186
192
|
- CHANGELOG.md
|
187
193
|
- Gemfile
|
188
194
|
- LICENSE.txt
|
@@ -242,9 +248,10 @@ files:
|
|
242
248
|
- lib/generamba/template/installer/template_installer_factory.rb
|
243
249
|
- lib/generamba/template/processor/template_declaration.rb
|
244
250
|
- lib/generamba/template/processor/template_processor.rb
|
251
|
+
- lib/generamba/tools/liquid-camelcase.rb
|
245
252
|
- lib/generamba/tools/string-colorize.rb
|
246
253
|
- lib/generamba/version.rb
|
247
|
-
homepage: https://github.com/
|
254
|
+
homepage: https://github.com/rambler-digital-solutions/Generamba
|
248
255
|
licenses:
|
249
256
|
- MIT
|
250
257
|
metadata: {}
|
@@ -267,5 +274,6 @@ rubyforge_project:
|
|
267
274
|
rubygems_version: 2.5.2
|
268
275
|
signing_key:
|
269
276
|
specification_version: 4
|
270
|
-
summary:
|
277
|
+
summary: FORKED FOR OWN USAGE! Advanced code generator for Xcode projects with a nice
|
278
|
+
and flexible template system.
|
271
279
|
test_files: []
|