generamba-mp 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +7 -0
  2. data/.codeclimate.yml +10 -0
  3. data/.gitignore +4 -0
  4. data/.rspec +2 -0
  5. data/.travis.yml +17 -0
  6. data/CHANGELOG.md +180 -0
  7. data/Gemfile +6 -0
  8. data/LICENSE.txt +21 -0
  9. data/README.md +62 -0
  10. data/Rakefile +6 -0
  11. data/VISION.md +41 -0
  12. data/bin/console +14 -0
  13. data/bin/generamba +5 -0
  14. data/bin/setup +7 -0
  15. data/docs/2.x/roadmap.md +365 -0
  16. data/generamba.gemspec +38 -0
  17. data/lib/generamba.rb +16 -0
  18. data/lib/generamba/cli/cli.rb +16 -0
  19. data/lib/generamba/cli/gen_command.rb +76 -0
  20. data/lib/generamba/cli/setup_command.rb +122 -0
  21. data/lib/generamba/cli/setup_username_command.rb +21 -0
  22. data/lib/generamba/cli/template/template_create_command.rb +40 -0
  23. data/lib/generamba/cli/template/template_group.rb +14 -0
  24. data/lib/generamba/cli/template/template_install_command.rb +21 -0
  25. data/lib/generamba/cli/template/template_list_command.rb +25 -0
  26. data/lib/generamba/cli/template/template_search_command.rb +30 -0
  27. data/lib/generamba/cli/thor_extension.rb +47 -0
  28. data/lib/generamba/cli/version_command.rb +25 -0
  29. data/lib/generamba/code_generation/Rambafile.liquid +41 -0
  30. data/lib/generamba/code_generation/code_module.rb +100 -0
  31. data/lib/generamba/code_generation/content_generator.rb +43 -0
  32. data/lib/generamba/code_generation/module_template.rb +28 -0
  33. data/lib/generamba/code_generation/rambafile_generator.rb +23 -0
  34. data/lib/generamba/configuration/user_preferences.rb +50 -0
  35. data/lib/generamba/constants/constants.rb +12 -0
  36. data/lib/generamba/constants/rambafile_constants.rb +31 -0
  37. data/lib/generamba/constants/rambaspec_constants.rb +18 -0
  38. data/lib/generamba/constants/user_preferences_constants.rb +5 -0
  39. data/lib/generamba/helpers/dependency_checker.rb +54 -0
  40. data/lib/generamba/helpers/gen_command_table_parameters_formatter.rb +33 -0
  41. data/lib/generamba/helpers/module_info_generator.rb +33 -0
  42. data/lib/generamba/helpers/module_validator.rb +85 -0
  43. data/lib/generamba/helpers/print_table.rb +17 -0
  44. data/lib/generamba/helpers/rambafile_validator.rb +18 -0
  45. data/lib/generamba/helpers/template_helper.rb +30 -0
  46. data/lib/generamba/helpers/xcodeproj_helper.rb +256 -0
  47. data/lib/generamba/module_generator.rb +104 -0
  48. data/lib/generamba/template/creator/new_template/Code/Service/service.h.liquid +11 -0
  49. data/lib/generamba/template/creator/new_template/Code/Service/service.m.liquid +13 -0
  50. data/lib/generamba/template/creator/new_template/Tests/Service/service_tests.m.liquid +35 -0
  51. data/lib/generamba/template/creator/new_template/template.rambaspec.liquid +20 -0
  52. data/lib/generamba/template/creator/template_creator.rb +39 -0
  53. data/lib/generamba/template/helpers/catalog_downloader.rb +58 -0
  54. data/lib/generamba/template/helpers/catalog_template_list_helper.rb +23 -0
  55. data/lib/generamba/template/helpers/catalog_template_search_helper.rb +27 -0
  56. data/lib/generamba/template/helpers/catalog_terminator.rb +21 -0
  57. data/lib/generamba/template/helpers/rambaspec_validator.rb +52 -0
  58. data/lib/generamba/template/installer/abstract_installer.rb +9 -0
  59. data/lib/generamba/template/installer/catalog_installer.rb +73 -0
  60. data/lib/generamba/template/installer/local_installer.rb +32 -0
  61. data/lib/generamba/template/installer/remote_installer.rb +50 -0
  62. data/lib/generamba/template/installer/template_installer_factory.rb +22 -0
  63. data/lib/generamba/template/processor/template_declaration.rb +36 -0
  64. data/lib/generamba/template/processor/template_processor.rb +75 -0
  65. data/lib/generamba/tools/string-colorize.rb +23 -0
  66. data/lib/generamba/version.rb +5 -0
  67. metadata +271 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6455917831eb0c2e9502b429a3a19911b27103d0
4
+ data.tar.gz: 368bfc2c005dc2b787d9fb861c82ec6bb90e1e41
5
+ SHA512:
6
+ metadata.gz: e2718705c5fa2fd4225f008ec9866a7666a467d6daadad6240849068e64c22db1ad3ba846e4788666e1c334f36829a33af7bd4f7f195c360aced73532585026b
7
+ data.tar.gz: df2b0ac530ad8fb185e8db86ac425c04d629f1fad678a1cf61e8b0719e0862edcf5db8e195a75290fdfb2c10c3cddea72c599d16cddad1781c93afcfcdbfb85a
@@ -0,0 +1,10 @@
1
+ engines:
2
+ rubocop:
3
+ enabled: true
4
+
5
+ ratings:
6
+ paths:
7
+ - "**.rb"
8
+
9
+ exclude_paths:
10
+ - spec/**/*
@@ -0,0 +1,4 @@
1
+ .idea/*
2
+ .rakeTasks
3
+ encodings.xml
4
+ Gemfile.lock
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,17 @@
1
+ language: objective-c
2
+ osx_image: xcode7.3
3
+
4
+ cache:
5
+ bundler: true
6
+
7
+ bundler_args: --jobs 3 --retry 3
8
+
9
+ rvm:
10
+ - 2.2.1
11
+ - 2.3.1
12
+
13
+ before_install:
14
+ - gem update --system --no-doc --no-ri
15
+ - gem install bundler --no-doc --no-ri
16
+
17
+ script: bundle exec rake
@@ -0,0 +1,180 @@
1
+ # Change Log
2
+
3
+ ## [1.4.1](https://github.com/rambler-digital-solutions/Generamba/tree/1.4.1) (2017-09-04)
4
+ [Full Changelog](https://github.com/rambler-digital-solutions/Generamba/compare/1.4.0...1.4.1)
5
+
6
+ **Merged pull requests:**
7
+
8
+ * Do not clear tests group if **test\_group\_path** is the same as **project\_group\_path** [\#193](https://github.com/rambler-digital-solutions/Generamba/pull/193) ([RamTararam](https://github.com/RamTararam))
9
+
10
+ ## [1.2.2](https://github.com/rambler-digital-solutions/Generamba/tree/1.2.2) (2016-09-27)
11
+ [Full Changelog](https://github.com/rambler-digital-solutions/Generamba/compare/1.2.1...1.2.2)
12
+
13
+ ## [1.2.1](https://github.com/rambler-digital-solutions/Generamba/tree/1.2.1) (2016-09-26)
14
+ [Full Changelog](https://github.com/rambler-digital-solutions/Generamba/compare/1.2.0...1.2.1)
15
+
16
+ **Fixed bugs:**
17
+
18
+ - Crashes for multiple project targets [\#150](https://github.com/rambler-digital-solutions/Generamba/issues/150)
19
+
20
+ **Closed issues:**
21
+
22
+ - Can I create a template to generate swift-like structure objects for ObjC? [\#157](https://github.com/rambler-digital-solutions/Generamba/issues/157)
23
+ - Error generate module with option :exclusive=\>true in Podfile [\#154](https://github.com/rambler-digital-solutions/Generamba/issues/154)
24
+ - Module Generation Settings with project\_targets [\#151](https://github.com/rambler-digital-solutions/Generamba/issues/151)
25
+
26
+ ## [1.2.0](https://github.com/rambler-digital-solutions/Generamba/tree/1.2.0) (2016-09-05)
27
+ [Full Changelog](https://github.com/rambler-digital-solutions/Generamba/compare/1.1.0...1.2.0)
28
+
29
+ **Fixed bugs:**
30
+
31
+ - Файлы в корне модуля [\#147](https://github.com/rambler-digital-solutions/Generamba/issues/147)
32
+
33
+ **Merged pull requests:**
34
+
35
+ - Bug fixes and refactoring [\#148](https://github.com/rambler-digital-solutions/Generamba/pull/148) ([Beniamiiin](https://github.com/Beniamiiin))
36
+
37
+ ## [1.1.0](https://github.com/rambler-digital-solutions/Generamba/tree/1.1.0) (2016-09-05)
38
+ [Full Changelog](https://github.com/rambler-digital-solutions/Generamba/compare/1.0.0...1.1.0)
39
+
40
+ **Implemented enhancements:**
41
+
42
+ - Refactoring rambafile and module validation [\#144](https://github.com/rambler-digital-solutions/Generamba/issues/144)
43
+ - Update gen command parameters table [\#142](https://github.com/rambler-digital-solutions/Generamba/issues/142)
44
+ - If statement in .rambaspec [\#128](https://github.com/rambler-digital-solutions/Generamba/issues/128)
45
+ - Ask user, he want create all modules by one path? [\#126](https://github.com/rambler-digital-solutions/Generamba/issues/126)
46
+
47
+ **Fixed bugs:**
48
+
49
+ - Generates files with a wrongs paths. [\#138](https://github.com/rambler-digital-solutions/Generamba/issues/138)
50
+ - Install templates from git repo is broken? [\#135](https://github.com/rambler-digital-solutions/Generamba/issues/135)
51
+ - Error creating the Xcode group path to new modules [\#129](https://github.com/rambler-digital-solutions/Generamba/issues/129)
52
+ - If statement in .rambaspec [\#128](https://github.com/rambler-digital-solutions/Generamba/issues/128)
53
+
54
+ **Closed issues:**
55
+
56
+ - Error: `parse': \(Rambafile\): block sequence entries are not allowed [\#127](https://github.com/rambler-digital-solutions/Generamba/issues/127)
57
+
58
+ **Merged pull requests:**
59
+
60
+ - \[RESOLVED\] Added question in setup command \#126 [\#146](https://github.com/rambler-digital-solutions/Generamba/pull/146) ([Beniamiiin](https://github.com/Beniamiiin))
61
+ - \[RESOLVED\] Updated logic of rambafile and module validation \#144 [\#145](https://github.com/rambler-digital-solutions/Generamba/pull/145) ([Beniamiiin](https://github.com/Beniamiiin))
62
+ - \[RESOLVED\] Updated gen command parameters table \#142 [\#143](https://github.com/rambler-digital-solutions/Generamba/pull/143) ([Beniamiiin](https://github.com/Beniamiiin))
63
+ - \[RESOLVED\] Added ability use custom parameters in rambaspec \#128 [\#141](https://github.com/rambler-digital-solutions/Generamba/pull/141) ([Beniamiiin](https://github.com/Beniamiiin))
64
+ - \[FIXED\] Fixed bug \#138 [\#140](https://github.com/rambler-digital-solutions/Generamba/pull/140) ([Beniamiiin](https://github.com/Beniamiiin))
65
+ - Added product\_module\_name to code\_module [\#139](https://github.com/rambler-digital-solutions/Generamba/pull/139) ([mogol](https://github.com/mogol))
66
+ - A little refactoring [\#137](https://github.com/rambler-digital-solutions/Generamba/pull/137) ([Beniamiiin](https://github.com/Beniamiiin))
67
+ - Support Ruby 2.3.1 [\#134](https://github.com/rambler-digital-solutions/Generamba/pull/134) ([ivaravko](https://github.com/ivaravko))
68
+ - Helpers code style [\#133](https://github.com/rambler-digital-solutions/Generamba/pull/133) ([ivaravko](https://github.com/ivaravko))
69
+ - Adds Code Climate config [\#132](https://github.com/rambler-digital-solutions/Generamba/pull/132) ([ivaravko](https://github.com/ivaravko))
70
+
71
+ ## [1.0.0](https://github.com/rambler-digital-solutions/Generamba/tree/1.0.0) (2016-07-23)
72
+ [Full Changelog](https://github.com/rambler-digital-solutions/Generamba/compare/0.7.8...1.0.0)
73
+
74
+ **Implemented enhancements:**
75
+
76
+ - Add more info to `generamba version` command [\#122](https://github.com/rambler-digital-solutions/Generamba/issues/122)
77
+ - Empty group in Xcode structure [\#118](https://github.com/rambler-digital-solutions/Generamba/issues/118)
78
+ - Gem dependency of cocoapods-core-0.39.0 [\#114](https://github.com/rambler-digital-solutions/Generamba/issues/114)
79
+ - Remove adding module name in module\_group\_path if it set from cli [\#98](https://github.com/rambler-digital-solutions/Generamba/issues/98)
80
+ - Check for missing Carthage dependencies [\#83](https://github.com/rambler-digital-solutions/Generamba/issues/83)
81
+ - Automatic tests generation based on protocols and class interfaces [\#71](https://github.com/rambler-digital-solutions/Generamba/issues/71)
82
+ - Track all modules created by Generamba [\#70](https://github.com/rambler-digital-solutions/Generamba/issues/70)
83
+
84
+ **Fixed bugs:**
85
+
86
+ - Can't add file with type . Only 'source' and 'resource' are acceptable [\#116](https://github.com/rambler-digital-solutions/Generamba/issues/116)
87
+ - If option --module-group-path starts with '/' Generamba add folder with empty name in root folder [\#99](https://github.com/rambler-digital-solutions/Generamba/issues/99)
88
+
89
+ ## [0.7.8](https://github.com/rambler-digital-solutions/Generamba/tree/0.7.8) (2016-05-16)
90
+ [Full Changelog](https://github.com/rambler-digital-solutions/Generamba/compare/0.7.7...0.7.8)
91
+
92
+ ## [0.7.7](https://github.com/rambler-digital-solutions/Generamba/tree/0.7.7) (2016-05-10)
93
+ [Full Changelog](https://github.com/rambler-digital-solutions/Generamba/compare/0.7.6...0.7.7)
94
+
95
+ **Implemented enhancements:**
96
+
97
+ - Project target name in module\_info [\#110](https://github.com/rambler-digital-solutions/Generamba/issues/110)
98
+ - Give a user more information about templates during `generamba setup` [\#86](https://github.com/rambler-digital-solutions/Generamba/issues/86)
99
+
100
+ ## [0.7.6](https://github.com/rambler-digital-solutions/Generamba/tree/0.7.6) (2016-04-30)
101
+ [Full Changelog](https://github.com/rambler-digital-solutions/Generamba/compare/0.7.5...0.7.6)
102
+
103
+ **Fixed bugs:**
104
+
105
+ - Failed adding files to project [\#96](https://github.com/rambler-digital-solutions/Generamba/issues/96)
106
+
107
+ ## [0.7.5](https://github.com/rambler-digital-solutions/Generamba/tree/0.7.5) (2016-04-24)
108
+ [Full Changelog](https://github.com/rambler-digital-solutions/Generamba/compare/0.7.4...0.7.5)
109
+
110
+ **Implemented enhancements:**
111
+
112
+ - Get templates from git by specific a branch [\#104](https://github.com/rambler-digital-solutions/Generamba/issues/104)
113
+
114
+ **Fixed bugs:**
115
+
116
+ - Non human exception when wrong template name or catalog [\#77](https://github.com/rambler-digital-solutions/Generamba/issues/77)
117
+
118
+ **Closed issues:**
119
+
120
+ - Module Name in .rambaspec support [\#102](https://github.com/rambler-digital-solutions/Generamba/issues/102)
121
+ - Generate with project and tests targets in command line [\#97](https://github.com/rambler-digital-solutions/Generamba/issues/97)
122
+ - Easy setup template path to local templates in Rambafile [\#94](https://github.com/rambler-digital-solutions/Generamba/issues/94)
123
+
124
+ ## [0.7.4](https://github.com/rambler-digital-solutions/Generamba/tree/0.7.4) (2016-02-21)
125
+ [Full Changelog](https://github.com/rambler-digital-solutions/Generamba/compare/0.7.3...0.7.4)
126
+
127
+ **Implemented enhancements:**
128
+
129
+ - Asks the user if he needed tests in `generamba setup` command [\#85](https://github.com/rambler-digital-solutions/Generamba/issues/85)
130
+ - Improve the visualization of commands with parameters [\#69](https://github.com/rambler-digital-solutions/Generamba/issues/69)
131
+ - Can we introduce something similar to view partials in rails \(for duplicated parts of views\) [\#62](https://github.com/rambler-digital-solutions/Generamba/issues/62)
132
+
133
+ **Fixed bugs:**
134
+
135
+ - Add resources\(xib, storyboard and etc\) in project bundle resources. [\#84](https://github.com/rambler-digital-solutions/Generamba/issues/84)
136
+
137
+ **Closed issues:**
138
+
139
+ - Get "Liquid error: This liquid context does not allow includes." on all files in just generated module [\#93](https://github.com/rambler-digital-solutions/Generamba/issues/93)
140
+
141
+ ## [0.7.3](https://github.com/rambler-digital-solutions/Generamba/tree/0.7.3) (2016-01-24)
142
+ [Full Changelog](https://github.com/rambler-digital-solutions/Generamba/compare/0.7.2...0.7.3)
143
+
144
+ **Implemented enhancements:**
145
+
146
+ - Enhance `generamba template search` to search templates in custom catalogs [\#75](https://github.com/rambler-digital-solutions/Generamba/issues/75)
147
+ - Enhance `generamba template list` to browse custom catalogs [\#74](https://github.com/rambler-digital-solutions/Generamba/issues/74)
148
+
149
+ **Closed issues:**
150
+
151
+ - Can we use constants from rambafile in templates? [\#81](https://github.com/rambler-digital-solutions/Generamba/issues/81)
152
+
153
+ ## [0.7.2](https://github.com/rambler-digital-solutions/Generamba/tree/0.7.2) (2016-01-10)
154
+ [Full Changelog](https://github.com/rambler-digital-solutions/Generamba/compare/0.7.1...0.7.2)
155
+
156
+ **Fixed bugs:**
157
+
158
+ - Don't set target in swift projects [\#65](https://github.com/rambler-digital-solutions/Generamba/issues/65)
159
+ - Errors if default path is empty [\#64](https://github.com/rambler-digital-solutions/Generamba/issues/64)
160
+ - Default template set can not be used [\#60](https://github.com/rambler-digital-solutions/Generamba/issues/60)
161
+
162
+ ## [0.7.1](https://github.com/rambler-digital-solutions/Generamba/tree/0.7.1) (2015-12-20)
163
+ [Full Changelog](https://github.com/rambler-digital-solutions/Generamba/compare/0.7.0...0.7.1)
164
+
165
+ ## [0.7.0](https://github.com/rambler-digital-solutions/Generamba/tree/0.7.0) (2015-12-13)
166
+ [Full Changelog](https://github.com/rambler-digital-solutions/Generamba/compare/0.6.2...0.7.0)
167
+
168
+ ## [0.6.2](https://github.com/rambler-digital-solutions/Generamba/tree/0.6.2) (2015-11-25)
169
+ [Full Changelog](https://github.com/rambler-digital-solutions/Generamba/compare/0.6.1...0.6.2)
170
+
171
+ ## [0.6.1](https://github.com/rambler-digital-solutions/Generamba/tree/0.6.1) (2015-11-21)
172
+ [Full Changelog](https://github.com/rambler-digital-solutions/Generamba/compare/0.6.0...0.6.1)
173
+
174
+ ## [0.6.0](https://github.com/rambler-digital-solutions/Generamba/tree/0.6.0) (2015-11-15)
175
+ [Full Changelog](https://github.com/rambler-digital-solutions/Generamba/compare/0.5.0...0.6.0)
176
+
177
+ ## [0.5.0](https://github.com/rambler-digital-solutions/Generamba/tree/0.5.0) (2015-11-01)
178
+
179
+
180
+ \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in generamba.gemspec
4
+ gemspec
5
+
6
+ gem 'rspec', '~> 3.0'
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Egor Tolstoy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,62 @@
1
+ <p align="center">
2
+ <img src="http://i.imgur.com/1AwoVaN.png"/>
3
+ </p>
4
+
5
+ [![Build Status](https://travis-ci.org/rambler-digital-solutions/Generamba.svg)](https://travis-ci.org/rambler-digital-solutions/Generamba)
6
+ [![Gem Version](https://badge.fury.io/rb/generamba.svg)](https://badge.fury.io/rb/generamba)
7
+ [![Code Climate](https://codeclimate.com/github/rambler-digital-solutions/Generamba/badges/gpa.svg)](https://codeclimate.com/github/rambler-digital-solutions/Generamba)
8
+
9
+ **Generamba** is a code generator made for working with Xcode. Primarily it is designed to generate VIPER modules but it is quite easy to customize it for generation of any other classes (both in Objective-C and Swift).
10
+
11
+ *We keep evolving Generamba:*
12
+ - [Vision](https://github.com/rambler-digital-solutions/Generamba/blob/develop/VISION.md),
13
+ - [Changelog](https://github.com/rambler-digital-solutions/Generamba/blob/develop/CHANGELOG.md),
14
+ - [Release notes](https://github.com/rambler-digital-solutions/Generamba/releases).
15
+
16
+ Besides, we started working on 2.0 version with powerful DSL and plugins. Check the [release roadmap](https://github.com/rambler-digital-solutions/Generamba/blob/develop/docs/2.x/roadmap.md)!
17
+
18
+ ![Generamba Screenshot](https://habrastorage.org/files/b98/770/b37/b98770b37dc54de98daf0e22fea38478.gif)
19
+
20
+ ### Key features
21
+
22
+ - Supports work with *.xcodeproj* files out of the box. All generated class files are automatically placed to specific folders and groups of Xcode project.
23
+ - Can generate both code itself and tests adding them to right targets.
24
+ - Based on work with [liquid-templates](https://github.com/Shopify/liquid) that have plain and readable syntax in comparison with templates for Xcode.
25
+ - It is very easy to create a new module: `generamba gen [MODULE_NAME] [TEMPLATE_NAME]`. You do not need to input a bunch of data each time because each project corresponds to only one configuration file that holds standard file system and Xcode-project pathes, names of targets, information about the author.
26
+
27
+ ### Installation
28
+
29
+ > Ruby 2.2 or later version is required. To check your current Ruby version run this command in terminal:
30
+ ```bash
31
+ $ ruby --version
32
+ ```
33
+ When necessary you can install the required Ruby version with the help of [`rvm`](http://octopress.org/docs/setup/rvm/) or [`rbenv`](http://octopress.org/docs/setup/rbenv/).
34
+
35
+ Run the command `gem install generamba`.
36
+
37
+ ### Usage
38
+ 1. Run [`generamba setup`](https://github.com/rambler-digital-solutions/Generamba/wiki/Available-Commands#basic-generamba-configuration) in the project root folder. This command helps to create [Rambafile](https://github.com/rambler-digital-solutions/Generamba/wiki/Rambafile-Structure) that define all configuration needed to generate code. You can modify this file directly in future.
39
+ 2. Add all templates planned to use in the project to the generated [Rambafile](https://github.com/rambler-digital-solutions/Generamba/wiki/Rambafile-Structure). You can begin with one of the templates from our catalog: `{name: 'rviper_controller'}`.
40
+ 3. Run [`generamba template install`](https://github.com/rambler-digital-solutions/Generamba/wiki/Available-Commands#template-installation). All the templates will be placed in the '/Templates' folder of your current project.
41
+ 4. Run [`generamba gen [MODULE_NAME] [TEMPLATE_NAME]`](https://github.com/rambler-digital-solutions/Generamba/wiki/Available-Commands#module-generation) - It creates module with specific name from specific template.
42
+
43
+ ### Additional info
44
+
45
+ Run `generamba help` to learn more about each of the Generamba features.
46
+
47
+ **Wiki:**
48
+ - [Command list](https://github.com/rambler-digital-solutions/Generamba/wiki/Available-Commands)
49
+ - [Understanding the Rambafile](https://github.com/rambler-digital-solutions/Generamba/wiki/Rambafile-Structure)
50
+ - [Understanding templates](https://github.com/rambler-digital-solutions/Generamba/wiki/Template-Structure)
51
+
52
+ **Other materials:**
53
+ - [Russian] Rambler.iOS V: Generamba and Code Generation ([Slides](http://www.slideshare.net/Rambler-iOS/viper-56423582) | [Video](http://www.youtube.com/watch?v=NXNiN9FaUnY))
54
+ - [Introduction to Generamba](http://etolstoy.com/2016/02/10/generamba/)
55
+
56
+ ### Authors
57
+
58
+ - Egor Tolstoy, Beniamin Sarkisyan, Andrey Zarembo and the rest of [Rambler.iOS team](https://github.com/orgs/rambler-digital-solutions/teams/ios-team).
59
+
60
+ ### License
61
+
62
+ MIT
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,41 @@
1
+ # Vision
2
+
3
+ Generamba is a tool with one primary role:
4
+
5
+ > Routine tasks automation through code generation.
6
+
7
+ At first it was designed to work only with Xcode - IDE for iOS/macOS, but as time passed we saw a lot of opportunities to use it in other circumstances, e.g. in frontend, Android and backend development.
8
+
9
+ ### What Is Generamba
10
+
11
+ The Generamba core is a simple generator that takes a [liquid](https://shopify.github.io/liquid/) template and a set of parameters as an input and produces a text snippet as an output. Everything else is built upon this simple concept.
12
+
13
+ There are a lot of IDE's, package managers and other stuff which is related to creating new code modules. We try to keep the core small but provide rich opportunities for integration with all these tools via plugins *(in development)* and templates *(ready to use)* systems.
14
+
15
+ ### General Aim
16
+
17
+ Our general aim is to provide a simple yet extensible way to generate any piece of code. The beginner should be able to create new code modules without complex configuration process. Generamba capabilities should grow as fast as the user needs, providing ways to validate the environment status, integrations with different file systems and IDEs, complex statements inside templates and so on.
18
+
19
+ ### Templates
20
+
21
+ Code templates are the fuel for Generamba. We use a [liquid](https://shopify.github.io/liquid/) markup, because of its beautiful syntax and the ability to implement really complex logic.
22
+
23
+ Templates may be private as well as adopted for public. We provide a number of ways to install them - using local paths, remote git repository, public or private catalogs.
24
+
25
+ We also maintain a [public catalog](https://github.com/rambler-digital-solutions/generamba-catalog) which has some popular templates for iOS/macOS projects.
26
+
27
+ ### Communication
28
+
29
+ We try to keep all the discussion about Generamba within [GitHub issues](https://github.com/rambler-digital-solutions/Generamba/issues). This attitude allows us to keep our processes and intentions transparent.
30
+
31
+ Besides it there is a private Telegram channel where maintainers discuss work questions. We are considering moving to Slack or Gitter at some point in the future - but we haven't grown big enough yet.
32
+
33
+ ### Contributions
34
+
35
+ Despite main maintainers are engineers from Rambler&Co team, we are glad to welcome external contributors. Generamba has evolved a lot since the first alpha release thanks to a lot of ideas from its users that came in the form of issues and pull requests.
36
+
37
+ The aim of our core team is to adopt Generamba possibilities to each user needs and provide him a way to extend its functionality himself.
38
+
39
+ ### ...
40
+
41
+ The structure and idea of *VISION.md* file was taken from the [Danger](https://github.com/danger/danger) project and [@orta](https://github.com/orta).
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "generamba"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'generamba'
4
+
5
+ Generamba::CLI::Application.start(ARGV)
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,365 @@
1
+ # Generamba 2.0 Roadmap
2
+ ### Overview
3
+
4
+ The main aim of 2.0 release is to decouple Generamba from iOS/macOS development and make it available for other areas as well: backend, frontend, Android.
5
+
6
+ We'll definitely break the backwards compatibility with *Rambafile* and templates created for the 1.x Generamba versions. To simplify the upgrading process we're considering writing some automatic migration tools.
7
+
8
+ ### High-Level Tasks
9
+
10
+ * Switch *Rambafile* from `yml` to a custom DSL format.
11
+ * Wrap repetitive tasks into *ramba*'s - the nearest analogs are *lane*'s from `fastlane`.
12
+ * Introduce the concept of two types of *plugins*: system (validation, save) and general-purpose.
13
+ * Allow the usage of different types of hooks - `before`, `after`, `error`.
14
+ * Add validation plugins, that are available to check the environment before code generation.
15
+ * Extract the saving logic from the Generamba core to plugins, both to filesystem and Xcode.
16
+ * Add saving plugins, that are available to process the text snippet created by generamba and save it somewhere.
17
+ * Extract the validation logic from the Generamba core to plugins, both for CocoaPods and Carthage.
18
+
19
+ ### Generamba Flow
20
+
21
+ A typical generation process consists of three steps:
22
+ * validation
23
+ * generation
24
+ * saving
25
+
26
+ #### Validation
27
+
28
+ That step is used to validate the environment status before code generation. It's a perfect place to implement logic of checking the required packages versions, the presence of system libraries, git status and so on.
29
+
30
+ If one of checks returns an error, the overall validation process doesn't stop until all of validation methods execute. This is crucial for a smooth user experience.
31
+
32
+ #### Generation
33
+
34
+ That's the core functionality of Generamba. A user provides a template name and some options which are used as an input. After the generation Generamba produces a text snippet as an output.
35
+
36
+ There can be multiple generation actions as well. All of them are executed in the writing order and their results are stored in-memory.
37
+
38
+ #### Saving
39
+
40
+ This step defines what to do with a generation output. The most obvious options are to store it as a file in some directory on the disk, embed it in your IDE, upload somewhere or print in log.
41
+
42
+ If there are multiple saving actions, each of them is applied to each generation output. They are executed in the writing order.
43
+
44
+ ### DSL
45
+
46
+ #### Basic Rambafile Structure
47
+
48
+ The main building block of *Rambafile* is `ramba`:
49
+
50
+ ```
51
+ desc "Creates a new Xcode project"
52
+ ramba :viper_module do
53
+ # Detailed description of generation steps
54
+ end
55
+ ```
56
+
57
+ The *Rambafile* may be monolithic as well as decomposed to multiple files. This is available via special functions:
58
+ - `ramba_import_local('path')` - imports the contents of `Rambafile` stored locally.
59
+ - `ramba_import_git('git', 'branch')` - imports the contents of Rambafile stored in remote git repository.
60
+
61
+ #### Setting Options
62
+
63
+ A user can set options in any part of *Rambafile* structure. It's important to note, that option, defined on the next level of method hierarchy, overwrites it's previous declaration. That allows to have a default value for some key and redefine it in each `ramba`.
64
+ ```
65
+ set :project_name, 'MyProject'
66
+
67
+ ramba :viper_module do
68
+ set :project_name, 'MyProject'
69
+ end
70
+ ```
71
+
72
+ It's also available to set an option using lambda:
73
+ ```
74
+ set :date_string, -> {
75
+ "Current date: #{Date.now}"
76
+ }
77
+ ```
78
+
79
+ > How options are set in Rambafile...
80
+ >
81
+
82
+ Besides `ramba` -specific options, there are template-specific options as well. They may correspond to a specific template and be defined in the *.rambaspec* file.
83
+
84
+ > The saving action for Xcode should behave differently depending on whether a generated file it's a code file or some resource. So, there is a special option for each file of Xcode templates:
85
+ > `- {name: Router/RouterTests.m, path: Tests/Router/router_tests.m.liquid, is_resource: false}`
86
+
87
+ #### Hooks
88
+
89
+ There are multiple types of hooks, which make possible to perform some action or redefine an option in certain moments of generation cycle.
90
+
91
+ ##### `before` hooks
92
+
93
+ A user can specify a hook, that'll execute before a specific `ramba`:
94
+ ```
95
+ before :viper_module do
96
+ # Some logic here...
97
+ end
98
+ ```
99
+
100
+ It's also possible to write a hook that'll execute before each `ramba`:
101
+ ```
102
+ before_each do |ramba_name|
103
+ # Some logic here...
104
+ end
105
+ ```
106
+
107
+ ##### `after` hooks
108
+
109
+ A user can specify a hook, that'll execute after a specific `ramba`:
110
+ ```
111
+ after :viper_module do
112
+ # Some logic here...
113
+ end
114
+ ```
115
+
116
+ It's also possible to write a hook that'll execute after each `ramba`:
117
+ ```
118
+ after_each do |ramba_name|
119
+ # Some logic here...
120
+ end
121
+ ```
122
+
123
+ ##### `error` hooks
124
+
125
+ If any action returns an error, it's possible to customize the resulting behavior for a specific `ramba` :
126
+ ```
127
+ error :viper_module do
128
+ # Some logic here...
129
+ end
130
+ ```
131
+ It's also possible to write a hook that'll execute in case of error in any `ramba`:
132
+ ```
133
+ error_each do |ramba_name|
134
+ # Some logic here...
135
+ end
136
+ ```
137
+
138
+ #### `ramba` structure
139
+
140
+ As we've already mentioned, `ramba` consists of three main steps. Multiple actions in each step are executed in the writing order.
141
+
142
+ ##### Validation actions
143
+
144
+ ```
145
+ ramba :viper_module do
146
+ ...
147
+ validate :validate_plugin_name do
148
+ set :some_option, 'some_value'
149
+ any_custom_action()
150
+ end
151
+ ...
152
+ end
153
+ ```
154
+
155
+ This notation means the following steps:
156
+ - The lambda passed to the validate action is executed.
157
+ - The plugin with name `validate_plugin_name` is called with options modified by lambda.
158
+
159
+ The notation can be simplified to:
160
+ ```
161
+ validate :validate_plugin_name
162
+ ```
163
+
164
+ ##### Generation actions
165
+
166
+ ```
167
+ ramba :viper_module do
168
+ ...
169
+ gen :viper_module do
170
+ set :some_option, 'some_value'
171
+ any_custom_action(parameter1)
172
+ end
173
+ ...
174
+ end
175
+ ```
176
+
177
+ This notation means the following steps:
178
+ - The lambda passed to the gen action is executed.
179
+ * The `gen` command is called with a template *viper_module* and options modified by lambda.
180
+
181
+ The notation can be simplified to:
182
+ ```
183
+ gen :viper_module
184
+ ```
185
+
186
+ ##### Saving actions
187
+
188
+ ```
189
+ ramba :viper_module do
190
+ ...
191
+ save :save_plugin_name do
192
+ set :some_option, 'some_value'
193
+ any_custom_action()
194
+ end
195
+ ...
196
+ end
197
+ ```
198
+
199
+ This notation means the following steps:
200
+ - The lambda passed to the saving action is executed.
201
+ - The plugin with name `save_plugin_name` is called with options modified by lambda.
202
+
203
+ The notation can be simplified to:
204
+ ```
205
+ save :save_plugin_name
206
+ ```
207
+
208
+ ##### Custom Actions
209
+
210
+ Besides system plugins (validation and saving), a user can create a general-purpose plugin which contains some specific reusable logic. E.g. a plugin which clears the environment - calls `git reset`, uninstalls some packages and so on. It's called simply by calling it's name:
211
+ ```
212
+ ramba :viper_module do
213
+ ...
214
+ any_custom_action()
215
+ ...
216
+ end
217
+ ```
218
+
219
+ ##### Templates and Catalogs
220
+
221
+ Templates and tempalte catalogs, used for code generation, can be specified right in the `ramba`'s.
222
+
223
+ ```
224
+ ramba :viper_module do
225
+ catalog 'https://github.com/user/catalog', branch:'develop'
226
+ template 'viper_ios', version:'1.2.5'
227
+ template 'viper_ios2', path:'/local_templates'
228
+ end
229
+ ```
230
+
231
+ - `catalog` keyword specifies a custom template catalog (like https://github.com/rambler-digital-solutions/generamba-catalog).
232
+ - `branch` parameter specifies a concrete catalog branch
233
+ - `template` keyword declares a template that needs to be installed
234
+ - `version` parameter specifies a concrete template version.
235
+ - `path` parameter specifies a local path to the template.
236
+ - `git` parameter specifies a remote repository path to a template.
237
+ - `branch` parameter is used together with `git` to specify a branch.
238
+
239
+ The `generamba template install` command aggregates all of the templates from the `Rambafile` and installs them in a `.generamba` hidden directory. When a user triggers some `ramba`, templates are loaded from this directory. The only exception are local templates - they are always installed from the specified in the `Rambafile` local path.
240
+
241
+ ### Plugins
242
+
243
+ The main ideas behind plugin system are:
244
+
245
+ - Increase code reusability between different projects,
246
+ * Keep the Generamba core as simple as possible,
247
+ * Abstract from specific implementations of different IDEs,
248
+ * Allow users to easily extend Generamba functionality for their needs.
249
+
250
+ As we've already mentioned, there are two types of plugins:
251
+
252
+ - System plugins - validation and saving,
253
+ * Custom plugins.
254
+
255
+ The main difference between them is how system calls them during `ramba` execution.
256
+
257
+ #### Plugin Structure
258
+
259
+ ```
260
+ module Generamba
261
+ module Plugins
262
+ class CocoaPodsPackageVersionValidationPlugin < ValidationPlugin
263
+ # The main body of a plugin
264
+ def self.run(params)
265
+ # Loads Podfile
266
+ # Analyzez dependencies version
267
+ # Compares these versions to the passed options
268
+ end
269
+
270
+ # The description of what this plugin does
271
+ def self.description
272
+ 'Verifies dependencies version in the project Podfile'
273
+ end
274
+
275
+ # Explicitly declaring available plugin options
276
+ def self.available_options
277
+ [
278
+ Generamba::ConfigItem.new(key: :package_versions,
279
+ description: "The hash with dependencies names and required versions",
280
+ default_value: [])
281
+ ]
282
+ end
283
+
284
+ # Declaring the output parameters
285
+ def self.output
286
+ [
287
+ ['COCOAPODS_CHECK_RESULT', 'The result of dependency checking']
288
+ ]
289
+ end
290
+
291
+ # Who created this plugin
292
+ def self.authors
293
+ ["etolstoy"]
294
+ end
295
+ end
296
+ end
297
+ end
298
+ ```
299
+
300
+ The same structure applies to other kinds of plugins. The only difference is the base class for the plugin - it can be `ValidationPlugin`, `SavingPlugin`, `Plugin`.
301
+
302
+ We've borrowed the plugin structure from `fastlane`.
303
+
304
+ #### Plugin Distribution
305
+
306
+ To avoid over-engineering in this version plugins will be distributed together with Generamba binary. If there'll be a lot of community-created plugins, will think about switching to other distribution system.
307
+
308
+ It's also possible to store plugins near the `Rambafile` in a separate directory `/plugins`. They'll be loaded by Generamba automatically.
309
+
310
+ ### Rambafile Example
311
+
312
+ ```
313
+ ramba_import_local('path')
314
+ ramba_import_git('git', 'branch')
315
+
316
+ set :project_name, 'LiveJournal'
317
+
318
+ before :viper_module do
319
+ set :company, 'Rambler&Co'
320
+ set :xcodeproj_path, 'LiveJournal.xcodeproj'
321
+ set :project_targets, ['LiveJournal1', 'LiveJournal2']
322
+ set :test_target, 'LiveJournalTests'
323
+ end
324
+
325
+ desc "Creates a simple VIPER module"
326
+ ramba :viper_module do
327
+ validate :plugin_validate_name do
328
+ set :some_option, '456'
329
+ any_custom_action()
330
+ end
331
+
332
+ gen :template_name do
333
+ set :some_option, '123'
334
+ any_custom_action(parameter1)
335
+ end
336
+
337
+ save :file_system do
338
+ set :some_option, '789'
339
+ end
340
+
341
+ save :xcode_proj
342
+ end
343
+
344
+ desc "Creates a new Xcode project"
345
+ ramba :create_project do
346
+ sh("liftoff") # Calling a shell script which invokes a 'liftoff' utility
347
+ add_pods(["Typhoon", "MagicalRecord"])
348
+
349
+ gen :app_delegate
350
+ gen :core_data_stack
351
+
352
+ save :file_system
353
+ save :xcode_proj
354
+ end
355
+
356
+ # It's called after each 'ramba' execution
357
+ after_each do |ramba_name|
358
+ # Some logic here
359
+ end
360
+
361
+ # It's called in case of an error in any 'ramba'
362
+ error :viper_module do
363
+ # Some error handling logic here
364
+ end
365
+ ```