Skip to content

Commit

Permalink
Merge branch 'release/0.7.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
Egor Tolstoy committed Apr 24, 2016
2 parents f48d7e6 + 57bc335 commit 2c787d6
Show file tree
Hide file tree
Showing 23 changed files with 381 additions and 60 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
.idea/modules.xml
.idea/vcs.xml
.idea/workspace.xml
.rakeTasks
encodings.xml
137 changes: 137 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
# Change Log

## [0.7.4](https://github.com/rambler-ios/Generamba/tree/0.7.4) (2016-02-21)
[Full Changelog](https://github.com/rambler-ios/Generamba/compare/0.7.3...0.7.4)

**Implemented enhancements:**

- Asks the user if he needed tests in `generamba setup` command [\#85](https://github.com/rambler-ios/Generamba/issues/85)
- Can we introduce something similar to view partials in rails \(for duplicated parts of views\) [\#62](https://github.com/rambler-ios/Generamba/issues/62)

**Fixed bugs:**

- Add resources\(xib, storyboard and etc\) in project bundle resources. [\#84](https://github.com/rambler-ios/Generamba/issues/84)

**Closed issues:**

- Get "Liquid error: This liquid context does not allow includes." on all files in just generated module [\#93](https://github.com/rambler-ios/Generamba/issues/93)

## [0.7.3](https://github.com/rambler-ios/Generamba/tree/0.7.3) (2016-01-24)
[Full Changelog](https://github.com/rambler-ios/Generamba/compare/0.7.2...0.7.3)

**Implemented enhancements:**

- Enhance `generamba template search` to search templates in custom catalogs [\#75](https://github.com/rambler-ios/Generamba/issues/75)
- Enhance `generamba template list` to browse custom catalogs [\#74](https://github.com/rambler-ios/Generamba/issues/74)
- Warn the user if template contains missing dependencies [\#17](https://github.com/rambler-ios/Generamba/issues/17)

**Closed issues:**

- Can we use constants from rambafile in templates? [\#81](https://github.com/rambler-ios/Generamba/issues/81)
- Arguments for `generamba gen Name modulename` [\#80](https://github.com/rambler-ios/Generamba/issues/80)

## [0.7.2](https://github.com/rambler-ios/Generamba/tree/0.7.2) (2016-01-10)
[Full Changelog](https://github.com/rambler-ios/Generamba/compare/0.7.1...0.7.2)

**Implemented enhancements:**

- --version command [\#54](https://github.com/rambler-ios/Generamba/issues/54)
- Incorrect behavior when generate module which already exists [\#52](https://github.com/rambler-ios/Generamba/issues/52)
- Add the ability to specify custom template catalogs in Rambafile [\#44](https://github.com/rambler-ios/Generamba/issues/44)

**Fixed bugs:**

- Don't set target in swift projects [\#65](https://github.com/rambler-ios/Generamba/issues/65)
- Incorrect behavior when generate module which already exists [\#52](https://github.com/rambler-ios/Generamba/issues/52)

**Closed issues:**

- Can generamba be used to generate swift modules? [\#61](https://github.com/rambler-ios/Generamba/issues/61)
- Git 1.2.9.1 [\#57](https://github.com/rambler-ios/Generamba/issues/57)
- Clarify generamba parameters usage [\#51](https://github.com/rambler-ios/Generamba/issues/51)
- Add documentation for liquid templates [\#48](https://github.com/rambler-ios/Generamba/issues/48)
- The documentation is not translated into English [\#13](https://github.com/rambler-ios/Generamba/issues/13)

## [0.7.1](https://github.com/rambler-ios/Generamba/tree/0.7.1) (2015-12-20)
[Full Changelog](https://github.com/rambler-ios/Generamba/compare/0.7.0...0.7.1)

**Implemented enhancements:**

- Podfile path setup during generamba setup needs clarification [\#50](https://github.com/rambler-ios/Generamba/issues/50)
- Remove the Settingslogic dependency [\#42](https://github.com/rambler-ios/Generamba/issues/42)

**Fixed bugs:**

- Unexpected behavior when use --module\_path [\#53](https://github.com/rambler-ios/Generamba/issues/53)

**Closed issues:**

- Add support for multiple targets during generamba setup [\#49](https://github.com/rambler-ios/Generamba/issues/49)

## [0.7.0](https://github.com/rambler-ios/Generamba/tree/0.7.0) (2015-12-13)
[Full Changelog](https://github.com/rambler-ios/Generamba/compare/0.6.2...0.7.0)

**Implemented enhancements:**

- Add coloured output [\#28](https://github.com/rambler-ios/Generamba/issues/28)
- Add -filepath and -grouppath options for `generamba gen` command [\#27](https://github.com/rambler-ios/Generamba/issues/27)
- Add a `generamba template search` command [\#26](https://github.com/rambler-ios/Generamba/issues/26)
- Add a `generamba template list` command [\#25](https://github.com/rambler-ios/Generamba/issues/25)
- Add the if statements to the Rambafile.liquid [\#22](https://github.com/rambler-ios/Generamba/issues/22)
- Target membership for module sources [\#11](https://github.com/rambler-ios/Generamba/issues/11)

**Fixed bugs:**

- Non-informative error message when running `generamba template install` in the wrong directory [\#39](https://github.com/rambler-ios/Generamba/issues/39)
- undefined method `each' for nil:NilClass \(NoMethodError\) [\#37](https://github.com/rambler-ios/Generamba/issues/37)

## [0.6.2](https://github.com/rambler-ios/Generamba/tree/0.6.2) (2015-11-25)
[Full Changelog](https://github.com/rambler-ios/Generamba/compare/0.6.1...0.6.2)

**Fixed bugs:**

- Can't install template from git repo [\#36](https://github.com/rambler-ios/Generamba/issues/36)

**Closed issues:**

- Need more information about dependencies [\#34](https://github.com/rambler-ios/Generamba/issues/34)

## [0.6.1](https://github.com/rambler-ios/Generamba/tree/0.6.1) (2015-11-21)
[Full Changelog](https://github.com/rambler-ios/Generamba/compare/0.6.0...0.6.1)

**Implemented enhancements:**

- Add Rambafile validation [\#10](https://github.com/rambler-ios/Generamba/issues/10)

**Fixed bugs:**

- The author name should be configured without `generamba setup` [\#31](https://github.com/rambler-ios/Generamba/issues/31)
- Sometimes Generamba fills in the wrong test target in the Rambafile [\#30](https://github.com/rambler-ios/Generamba/issues/30)
- Seems that Generamba doesn't add project name to the headers [\#29](https://github.com/rambler-ios/Generamba/issues/29)

**Closed issues:**

- Add a documentation for a .rambaspec file and overall template structure [\#24](https://github.com/rambler-ios/Generamba/issues/24)
- Rambafile format is not documented [\#9](https://github.com/rambler-ios/Generamba/issues/9)

## [0.6.0](https://github.com/rambler-ios/Generamba/tree/0.6.0) (2015-11-15)
[Full Changelog](https://github.com/rambler-ios/Generamba/compare/0.5.0...0.6.0)

**Implemented enhancements:**

- Add a podfile\_path/cartfile\_path fields to a Rambafile [\#19](https://github.com/rambler-ios/Generamba/issues/19)
- Add a dependencies field to the .rambaspec [\#18](https://github.com/rambler-ios/Generamba/issues/18)
- Move the hardcoded keys to the constants [\#15](https://github.com/rambler-ios/Generamba/issues/15)
- Implement automatic template creation [\#8](https://github.com/rambler-ios/Generamba/issues/8)
- Change some of the questions of `generamba setup` [\#7](https://github.com/rambler-ios/Generamba/issues/7)

**Fixed bugs:**

- Rambafile uses absolute filepath to xcodeproj file [\#21](https://github.com/rambler-ios/Generamba/issues/21)
- Duplicate file reference in project.pbxproj [\#20](https://github.com/rambler-ios/Generamba/issues/20)
- Move the rambler\_viper\_controller template to the generamba-catalog [\#16](https://github.com/rambler-ios/Generamba/issues/16)

## [0.5.0](https://github.com/rambler-ios/Generamba/tree/0.5.0) (2015-11-01)


\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
6 changes: 3 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
PATH
remote: .
specs:
generamba (0.7.2)
generamba (0.7.4)
cocoapods-core (= 0.39.0)
git (= 1.2.9.1)
liquid (= 3.0.6)
terminal-table (= 1.4.5)
thor (= 0.19.1)
tilt (= 2.0.1)
xcodeproj (= 0.28.2)

GEM
Expand Down Expand Up @@ -47,9 +47,9 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.3.0)
rspec-support (3.3.0)
terminal-table (1.4.5)
thor (0.19.1)
thread_safe (0.3.5)
tilt (2.0.1)
tzinfo (1.2.2)
thread_safe (~> 0.1)
xcodeproj (0.28.2)
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

**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).

*We keep evolving Generamba:* [changelog](https://github.com/rambler-ios/Generamba/blob/develop/CHANGELOG.md), [release notes](https://github.com/rambler-ios/Generamba/releases).

![Generamba Screenshot](http://s24.postimg.org/gej9cg1cl/generamba.jpg)

### Key features
Expand All @@ -24,7 +26,7 @@ When necessary you can install the required Ruby version with the help of [`rvm`

Run the command `gem install generamba`.

### Using
### Usage
1. Run [`generamba setup`](https://github.com/rambler-ios/Generamba/wiki/Available-Commands#basic-generamba-configuration) in the project root folder. This command helps to create [Rambafile](https://github.com/rambler-ios/Generamba/wiki/Rambafile-Structure) that define all configuration needed to generate code. You can modify this file directly in future.
2. Add all templates planned to use in the project to the generated [Rambafile](https://github.com/rambler-ios/Generamba/wiki/Rambafile-Structure). You can begin with one of the templates from our catalog: `{name: 'rviper_controller'}`.
3. Run [`generamba template install`](https://github.com/rambler-ios/Generamba/wiki/Available-Commands#template-installation). All the templates will be placed in the '/Templates' folder of your current project.
Expand All @@ -41,6 +43,7 @@ Run `generamba help` to learn more about each of the Generamba features.

**Other materials:**
- [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))
- [Introduction to Generamba](http://etolstoy.com/2016/02/10/generamba/)

### Authors

Expand Down
4 changes: 2 additions & 2 deletions generamba.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require 'generamba/version'
Gem::Specification.new do |spec|
spec.name = 'generamba'
spec.version = Generamba::VERSION
spec.authors = ['Egor Tolstoy', 'Andrey Zarembo']
spec.authors = ['Egor Tolstoy', 'Andrey Zarembo', 'Beniamin Sarkisyan']
spec.email = '[email protected]'

spec.summary = 'Advanced code generator for Xcode projects with a nice and flexible template system.'
Expand All @@ -23,9 +23,9 @@ Gem::Specification.new do |spec|
spec.add_runtime_dependency 'thor', '0.19.1'
spec.add_runtime_dependency 'xcodeproj', '0.28.2'
spec.add_runtime_dependency 'liquid', '3.0.6'
spec.add_runtime_dependency 'tilt', '2.0.1'
spec.add_runtime_dependency 'git', '1.2.9.1'
spec.add_runtime_dependency 'cocoapods-core', '0.39.0'
spec.add_runtime_dependency 'terminal-table', '1.4.5'

spec.add_development_dependency 'bundler', '~> 1.10'
spec.add_development_dependency 'rake', '~> 10.0'
Expand Down
1 change: 0 additions & 1 deletion lib/generamba/cli/cli.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require 'thor'
require 'xcodeproj'
require 'liquid'
require 'tilt'
require 'git'
require 'generamba/cli/gen_command.rb'
require 'generamba/cli/setup_command.rb'
Expand Down
8 changes: 8 additions & 0 deletions lib/generamba/cli/gen_command.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
require 'thor'
require 'generamba/helpers/print_table.rb'
require 'generamba/helpers/rambafile_validator.rb'
require 'generamba/helpers/xcodeproj_helper.rb'
require 'generamba/helpers/dependency_checker.rb'
require 'generamba/helpers/gen_command_table_parameters_formatter.rb'

module Generamba::CLI
class Application < Thor
Expand Down Expand Up @@ -38,6 +40,12 @@ def gen(module_name, template_name)

rambafile = YAML.load_file(RAMBAFILE_NAME)

parameters = GenCommandTableParametersFormatter.prepare_parameters_for_displaying(rambafile)
PrintTable.print_values(
values: parameters,
title: "Summary for gen #{module_name}"
)

template = ModuleTemplate.new(template_name)
code_module = CodeModule.new(module_name, module_description, rambafile, options)

Expand Down
40 changes: 31 additions & 9 deletions lib/generamba/cli/setup_command.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
require 'thor'
require 'xcodeproj'
require 'liquid'
require 'tilt'
require 'git'
require 'generamba/constants/rambafile_constants.rb'
require 'generamba/helpers/print_table.rb'

module Generamba::CLI
class Application < Thor
Expand Down Expand Up @@ -33,21 +33,29 @@ def setup
targets_prompt = ''
project.targets.each_with_index { |element, i| targets_prompt += ("#{i}. #{element.name}" + "\n") }
project_target = ask_index("Select the appropriate target for adding your MODULES (type the index):\n" + targets_prompt,project.targets)
test_target = ask_index("Select the appropriate target for adding your TESTS (type the index):\n" + targets_prompt,project.targets)
include_tests = yes?('Are you using unit-tests in this project? (yes/no)')

if include_tests
test_target = ask_index("Select the appropriate target for adding your TESTS (type the index):\n" + targets_prompt,project.targets)
end

should_use_same_paths = yes?('Do you want to use the same paths for your files both in Xcode and the filesystem? (yes/no)')
if should_use_same_paths
project_group_path = ask('The default path for creating new modules:')
project_file_path = project_group_path

test_group_path = ask('The default path for creating tests:')
test_file_path = test_group_path
if include_tests
test_group_path = ask('The default path for creating tests:')
test_file_path = test_group_path
end
else
project_group_path = ask('The default path for creating new modules (in Xcode groups):')
project_file_path = ask('The default path for creating new modules (in the filesystem):')

test_group_path = ask('The default path for creating tests (in Xcode groups):')
test_file_path = ask('The default path for creating tests (in the filesystem):')
if include_tests
test_group_path = ask('The default path for creating tests (in Xcode groups):')
test_file_path = ask('The default path for creating tests (in the filesystem):')
end
end

using_pods = yes?('Are you using Cocoapods? (yes/no)')
Expand All @@ -65,9 +73,23 @@ def setup
properties[PROJECT_TARGET_KEY] = project_target.name
properties[PROJECT_FILE_PATH_KEY] = project_file_path
properties[PROJECT_GROUP_PATH_KEY] = project_group_path
properties[TEST_TARGET_KEY] = test_target.name
properties[TEST_FILE_PATH_KEY] = test_file_path
properties[TEST_GROUP_PATH_KEY] = test_group_path

if test_target
properties[TEST_TARGET_KEY] = test_target.name
end

if test_file_path
properties[TEST_FILE_PATH_KEY] = test_file_path
end

if test_group_path
properties[TEST_GROUP_PATH_KEY] = test_group_path
end

PrintTable.print_values(
values: properties,
title: "Summary for generamba setup"
)

Generamba::RambafileGenerator.create_rambafile(properties)
puts('Rambafile successfully created! Now add some templates to the Rambafile and run `generamba template install`.'.green)
Expand Down
15 changes: 13 additions & 2 deletions lib/generamba/cli/template/template_create_command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'generamba/helpers/print_table.rb'

module Generamba::CLI
class Template < Thor
include Generamba
Expand All @@ -17,13 +19,22 @@ def create(template_name)
TEMPLATE_NAME_KEY => template_name,
TEMPLATE_SUMMARY_KEY => summary,
TEMPLATE_AUTHOR_KEY => author,
TEMPLATE_LICENSE_KEY => license,
TEMPLATE_DEPENDENCIES_KEY => dependencies
TEMPLATE_LICENSE_KEY => license
}

if dependencies and !dependencies.empty?
properties[TEMPLATE_DEPENDENCIES_KEY] = dependencies
end

PrintTable.print_values(
values: properties,
title: "Summary for template create"
)

template_creator = Generamba::TemplateCreator.new
template_creator.create_template(properties)
puts("The template #{template_name} is successfully generated! Now add some file templates into it.".green)
end

end
end
9 changes: 5 additions & 4 deletions lib/generamba/code_generation/Rambafile.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@ project_file_path: {{ project_file_path }}
# The Xcode group path to new modules
project_group_path: {{ project_group_path }}

{% if test_target != "" or test_file_path != "" or test_group_path != "" %}### Tests generation settings section{% endif %}
{% if test_target != "" %}# The tests target name
{% if (test_target != nil and test_target != "") or (test_file_path != nil and test_file_path != "") or (test_group_path != nil and test_group_path != "") %}### Tests generation settings section
{% if test_target != nil and test_target != "" %}# The tests target name
test_target: {{ test_target }}{% endif %}

{% if test_file_path != "" %}# The file path for new tests
{% if test_file_path != nil and test_file_path != "" %}# The file path for new tests
test_file_path: {{ test_file_path }}{% endif %}

{% if test_group_path != "" %}# The Xcode group path to new tests
{% if test_group_path != nil and test_group_path != "" %}# The Xcode group path to new tests
test_group_path: {{ test_group_path }}{% endif %}
{% endif %}

{% if podfile_path != nil or cartfile_path != nil %}### Dependencies settings section{% endif %}
{% if podfile_path != nil %}podfile_path: {{ podfile_path }}{% endif %}
Expand Down
Loading

0 comments on commit 2c787d6

Please sign in to comment.