generamba 0.7.3 → 0.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7dc501f252222516eac75ae4ce0111181043e982
4
- data.tar.gz: 4e4b25ff2df471bd2c4e1daa8261787749cffca2
3
+ metadata.gz: 5382f3daaa79b49658dadd60155a036352984dce
4
+ data.tar.gz: f27992a72f3ffda44ab213cec784c87a262f4732
5
5
  SHA512:
6
- metadata.gz: d865768cd0dc64bf901bce59b128acea1fb44d3540c6c0eb9b85093b52bc7a1a78428650d5bdf954733cd9a37ebb30d6117f3b34d2aa0622ff077e2330e2a745
7
- data.tar.gz: b663fa970dd38613403b5ae00e5923275123455a985874700c8be232d0ca459d9b6eaf4e95399c806f7f56095e9df30442d0dc8ddf5a050189404d7e4108e602
6
+ metadata.gz: dfe52b2b9ebe991851955d30dd3ead8604927f7162742afede6142816a1f44a02c424f5cea3245e6e1346c983084fca48818166447f2e7d8e5c2853649b29082
7
+ data.tar.gz: 098b52bdc639a2e86ecb79797574ec1d42d4f1809b17e849bf86e0eb2208f9a0e7908adb1b77a20aef231b4742fdde73ce6c3a5305ba9c31a1d0b33d349c4d14
data/CHANGELOG.md ADDED
@@ -0,0 +1,177 @@
1
+ # Change Log
2
+
3
+ ## [Unreleased](https://github.com/rambler-ios/Generamba/tree/HEAD)
4
+
5
+ [Full Changelog](https://github.com/rambler-ios/Generamba/compare/0.7.3...HEAD)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Asks the user if he needed tests in `generamba setup` command [\#85](https://github.com/rambler-ios/Generamba/issues/85)
10
+ - Improve the visualization of commands with parameters [\#69](https://github.com/rambler-ios/Generamba/issues/69)
11
+
12
+ **Fixed bugs:**
13
+
14
+ - Add resources\(xib, storyboard and etc\) in project bundle resources. [\#84](https://github.com/rambler-ios/Generamba/issues/84)
15
+
16
+ **Merged pull requests:**
17
+
18
+ - Print table with summary info about input parameters [\#89](https://github.com/rambler-ios/Generamba/pull/89) ([Beniamiiin](https://github.com/Beniamiiin))
19
+ - Handle any resources in template and correct add to project [\#88](https://github.com/rambler-ios/Generamba/pull/88) ([Beniamiiin](https://github.com/Beniamiiin))
20
+ - Implemented new question, about need tests in `generamba setup` [\#87](https://github.com/rambler-ios/Generamba/pull/87) ([Beniamiiin](https://github.com/Beniamiiin))
21
+
22
+ ## [0.7.3](https://github.com/rambler-ios/Generamba/tree/0.7.3) (2016-01-24)
23
+ [Full Changelog](https://github.com/rambler-ios/Generamba/compare/0.7.2...0.7.3)
24
+
25
+ **Implemented enhancements:**
26
+
27
+ - Enhance `generamba template search` to search templates in custom catalogs [\#75](https://github.com/rambler-ios/Generamba/issues/75)
28
+ - Enhance `generamba template list` to browse custom catalogs [\#74](https://github.com/rambler-ios/Generamba/issues/74)
29
+ - Warn the user if template contains missing dependencies [\#17](https://github.com/rambler-ios/Generamba/issues/17)
30
+ - Added method to check missing template dependencies in podfile [\#79](https://github.com/rambler-ios/Generamba/pull/79) ([Beniamiiin](https://github.com/Beniamiiin))
31
+
32
+ **Closed issues:**
33
+
34
+ - Can we use constants from rambafile in templates? [\#81](https://github.com/rambler-ios/Generamba/issues/81)
35
+ - Arguments for `generamba gen Name modulename` [\#80](https://github.com/rambler-ios/Generamba/issues/80)
36
+
37
+ **Merged pull requests:**
38
+
39
+ - Fixed crash when templates directory exists. [\#78](https://github.com/rambler-ios/Generamba/pull/78) ([mogol](https://github.com/mogol))
40
+
41
+ ## [0.7.2](https://github.com/rambler-ios/Generamba/tree/0.7.2) (2016-01-10)
42
+ [Full Changelog](https://github.com/rambler-ios/Generamba/compare/0.7.1...0.7.2)
43
+
44
+ **Implemented enhancements:**
45
+
46
+ - --version command [\#54](https://github.com/rambler-ios/Generamba/issues/54)
47
+ - Incorrect behavior when generate module which already exists [\#52](https://github.com/rambler-ios/Generamba/issues/52)
48
+ - Add the ability to specify custom template catalogs in Rambafile [\#44](https://github.com/rambler-ios/Generamba/issues/44)
49
+
50
+ **Fixed bugs:**
51
+
52
+ - Don't set target in swift projects [\#65](https://github.com/rambler-ios/Generamba/issues/65)
53
+ - Errors if default path is empty [\#64](https://github.com/rambler-ios/Generamba/issues/64)
54
+ - Default template set can not be used [\#60](https://github.com/rambler-ios/Generamba/issues/60)
55
+ - Incorrect behavior when generate module which already exists [\#52](https://github.com/rambler-ios/Generamba/issues/52)
56
+
57
+ **Closed issues:**
58
+
59
+ - Can generamba be used to generate swift modules? [\#61](https://github.com/rambler-ios/Generamba/issues/61)
60
+ - Git 1.2.9.1 [\#57](https://github.com/rambler-ios/Generamba/issues/57)
61
+
62
+ **Merged pull requests:**
63
+
64
+ - Feature/custom catalogs [\#73](https://github.com/rambler-ios/Generamba/pull/73) ([etolstoy](https://github.com/etolstoy))
65
+ - Added `generamba version` command [\#67](https://github.com/rambler-ios/Generamba/pull/67) ([etolstoy](https://github.com/etolstoy))
66
+ - Fixed \#64: Errors if default path is empty [\#66](https://github.com/rambler-ios/Generamba/pull/66) ([Beniamiiin](https://github.com/Beniamiiin))
67
+ - Added error display, if not specify at least one template in Rambafile \#60 [\#63](https://github.com/rambler-ios/Generamba/pull/63) ([Beniamiiin](https://github.com/Beniamiiin))
68
+ - Fixed \#52 - Incorrect behavior when generate module which already exists [\#59](https://github.com/rambler-ios/Generamba/pull/59) ([Beniamiiin](https://github.com/Beniamiiin))
69
+ - docs, link to Rambafile when it mentioned [\#58](https://github.com/rambler-ios/Generamba/pull/58) ([MaksimBazarov](https://github.com/MaksimBazarov))
70
+ - Fixed incorrect group path [\#56](https://github.com/rambler-ios/Generamba/pull/56) ([Beniamiiin](https://github.com/Beniamiiin))
71
+ - Docs translated to english \(\#13\) [\#55](https://github.com/rambler-ios/Generamba/pull/55) ([novixon](https://github.com/novixon))
72
+
73
+ ## [0.7.1](https://github.com/rambler-ios/Generamba/tree/0.7.1) (2015-12-20)
74
+ [Full Changelog](https://github.com/rambler-ios/Generamba/compare/0.7.0...0.7.1)
75
+
76
+ **Implemented enhancements:**
77
+
78
+ - Podfile path setup during generamba setup needs clarification [\#50](https://github.com/rambler-ios/Generamba/issues/50)
79
+ - Remove the Settingslogic dependency [\#42](https://github.com/rambler-ios/Generamba/issues/42)
80
+
81
+ **Fixed bugs:**
82
+
83
+ - Unexpected behavior when use --module\_path [\#53](https://github.com/rambler-ios/Generamba/issues/53)
84
+
85
+ **Closed issues:**
86
+
87
+ - Add support for multiple targets during generamba setup [\#49](https://github.com/rambler-ios/Generamba/issues/49)
88
+
89
+ **Merged pull requests:**
90
+
91
+ - Feature/settingslogic remove [\#47](https://github.com/rambler-ios/Generamba/pull/47) ([etolstoy](https://github.com/etolstoy))
92
+
93
+ ## [0.7.0](https://github.com/rambler-ios/Generamba/tree/0.7.0) (2015-12-13)
94
+ [Full Changelog](https://github.com/rambler-ios/Generamba/compare/0.6.2...0.7.0)
95
+
96
+ **Implemented enhancements:**
97
+
98
+ - Add coloured output [\#28](https://github.com/rambler-ios/Generamba/issues/28)
99
+ - Add -filepath and -grouppath options for `generamba gen` command [\#27](https://github.com/rambler-ios/Generamba/issues/27)
100
+ - Add a `generamba template search` command [\#26](https://github.com/rambler-ios/Generamba/issues/26)
101
+ - Add a `generamba template list` command [\#25](https://github.com/rambler-ios/Generamba/issues/25)
102
+ - Add the if statements to the Rambafile.liquid [\#22](https://github.com/rambler-ios/Generamba/issues/22)
103
+ - Target membership for module sources [\#11](https://github.com/rambler-ios/Generamba/issues/11)
104
+
105
+ **Fixed bugs:**
106
+
107
+ - Non-informative error message when running `generamba template install` in the wrong directory [\#39](https://github.com/rambler-ios/Generamba/issues/39)
108
+ - undefined method `each' for nil:NilClass \(NoMethodError\) [\#37](https://github.com/rambler-ios/Generamba/issues/37)
109
+
110
+ **Merged pull requests:**
111
+
112
+ - Feature/multiple targets [\#43](https://github.com/rambler-ios/Generamba/pull/43) ([etolstoy](https://github.com/etolstoy))
113
+ - Feature/colored output [\#40](https://github.com/rambler-ios/Generamba/pull/40) ([etolstoy](https://github.com/etolstoy))
114
+ - Feature/gen file flags [\#38](https://github.com/rambler-ios/Generamba/pull/38) ([etolstoy](https://github.com/etolstoy))
115
+
116
+ ## [0.6.2](https://github.com/rambler-ios/Generamba/tree/0.6.2) (2015-11-25)
117
+ [Full Changelog](https://github.com/rambler-ios/Generamba/compare/0.6.1...0.6.2)
118
+
119
+ **Fixed bugs:**
120
+
121
+ - Can't install template from git repo [\#36](https://github.com/rambler-ios/Generamba/issues/36)
122
+ - Can't find template by local fullpath [\#35](https://github.com/rambler-ios/Generamba/issues/35)
123
+
124
+ **Closed issues:**
125
+
126
+ - Need more information about dependencies [\#34](https://github.com/rambler-ios/Generamba/issues/34)
127
+
128
+ **Merged pull requests:**
129
+
130
+ - Mention the Ruby 2.2+ requirement in README [\#33](https://github.com/rambler-ios/Generamba/pull/33) ([rodionovd](https://github.com/rodionovd))
131
+
132
+ ## [0.6.1](https://github.com/rambler-ios/Generamba/tree/0.6.1) (2015-11-21)
133
+ [Full Changelog](https://github.com/rambler-ios/Generamba/compare/0.6.0...0.6.1)
134
+
135
+ **Implemented enhancements:**
136
+
137
+ - Add Rambafile validation [\#10](https://github.com/rambler-ios/Generamba/issues/10)
138
+
139
+ **Fixed bugs:**
140
+
141
+ - The author name should be configured without `generamba setup` [\#31](https://github.com/rambler-ios/Generamba/issues/31)
142
+ - Sometimes Generamba fills in the wrong test target in the Rambafile [\#30](https://github.com/rambler-ios/Generamba/issues/30)
143
+ - Seems that Generamba doesn't add project name to the headers [\#29](https://github.com/rambler-ios/Generamba/issues/29)
144
+
145
+ ## [0.6.0](https://github.com/rambler-ios/Generamba/tree/0.6.0) (2015-11-15)
146
+ [Full Changelog](https://github.com/rambler-ios/Generamba/compare/0.5.0...0.6.0)
147
+
148
+ **Implemented enhancements:**
149
+
150
+ - Add a podfile\_path/cartfile\_path fields to a Rambafile [\#19](https://github.com/rambler-ios/Generamba/issues/19)
151
+ - Add a dependencies field to the .rambaspec [\#18](https://github.com/rambler-ios/Generamba/issues/18)
152
+ - Move the hardcoded keys to the constants [\#15](https://github.com/rambler-ios/Generamba/issues/15)
153
+ - Implement automatic template creation [\#8](https://github.com/rambler-ios/Generamba/issues/8)
154
+ - Change some of the questions of `generamba setup` [\#7](https://github.com/rambler-ios/Generamba/issues/7)
155
+ - Implement installation of templates from the remote git repository [\#6](https://github.com/rambler-ios/Generamba/issues/6)
156
+ - Implement installation of templates with local filepath [\#5](https://github.com/rambler-ios/Generamba/issues/5)
157
+ - Remove the author-specific information from Rambafile [\#1](https://github.com/rambler-ios/Generamba/issues/1)
158
+
159
+ **Fixed bugs:**
160
+
161
+ - Rambafile uses absolute filepath to xcodeproj file [\#21](https://github.com/rambler-ios/Generamba/issues/21)
162
+ - Duplicate file reference in project.pbxproj [\#20](https://github.com/rambler-ios/Generamba/issues/20)
163
+ - Move the rambler\_viper\_controller template to the generamba-catalog [\#16](https://github.com/rambler-ios/Generamba/issues/16)
164
+ - The output of `setup` command is splitted sometimes [\#4](https://github.com/rambler-ios/Generamba/issues/4)
165
+ - Files are generated with incorrect filepaths [\#3](https://github.com/rambler-ios/Generamba/issues/3)
166
+
167
+ **Merged pull requests:**
168
+
169
+ - Feature/template creation [\#23](https://github.com/rambler-ios/Generamba/pull/23) ([etolstoy](https://github.com/etolstoy))
170
+ - Added command: generamba template install [\#14](https://github.com/rambler-ios/Generamba/pull/14) ([etolstoy](https://github.com/etolstoy))
171
+ - Feature/cli improvements [\#12](https://github.com/rambler-ios/Generamba/pull/12) ([AndreyZarembo](https://github.com/AndreyZarembo))
172
+ - Master [\#2](https://github.com/rambler-ios/Generamba/pull/2) ([etolstoy](https://github.com/etolstoy))
173
+
174
+ ## [0.5.0](https://github.com/rambler-ios/Generamba/tree/0.5.0) (2015-11-01)
175
+
176
+
177
+ \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
data/Gemfile.lock CHANGED
@@ -1,18 +1,18 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- generamba (0.7.2)
4
+ generamba (0.7.3)
5
5
  cocoapods-core (= 0.39.0)
6
6
  git (= 1.2.9.1)
7
7
  liquid (= 3.0.6)
8
+ terminal-table (= 1.4.5)
8
9
  thor (= 0.19.1)
9
- tilt (= 2.0.1)
10
10
  xcodeproj (= 0.28.2)
11
11
 
12
12
  GEM
13
13
  remote: https://rubygems.org/
14
14
  specs:
15
- activesupport (4.2.5)
15
+ activesupport (4.2.5.1)
16
16
  i18n (~> 0.7)
17
17
  json (~> 1.7, >= 1.7.7)
18
18
  minitest (~> 5.1)
@@ -32,7 +32,7 @@ GEM
32
32
  json (1.8.3)
33
33
  liquid (3.0.6)
34
34
  minitest (5.8.4)
35
- nap (1.0.0)
35
+ nap (1.1.0)
36
36
  rake (10.4.2)
37
37
  rspec (3.3.0)
38
38
  rspec-core (~> 3.3.0)
@@ -47,9 +47,9 @@ GEM
47
47
  diff-lcs (>= 1.2.0, < 2.0)
48
48
  rspec-support (~> 3.3.0)
49
49
  rspec-support (3.3.0)
50
+ terminal-table (1.4.5)
50
51
  thor (0.19.1)
51
52
  thread_safe (0.3.5)
52
- tilt (2.0.1)
53
53
  tzinfo (1.2.2)
54
54
  thread_safe (~> 0.1)
55
55
  xcodeproj (0.28.2)
data/generamba.gemspec CHANGED
@@ -23,9 +23,9 @@ Gem::Specification.new do |spec|
23
23
  spec.add_runtime_dependency 'thor', '0.19.1'
24
24
  spec.add_runtime_dependency 'xcodeproj', '0.28.2'
25
25
  spec.add_runtime_dependency 'liquid', '3.0.6'
26
- spec.add_runtime_dependency 'tilt', '2.0.1'
27
26
  spec.add_runtime_dependency 'git', '1.2.9.1'
28
27
  spec.add_runtime_dependency 'cocoapods-core', '0.39.0'
28
+ spec.add_runtime_dependency 'terminal-table', '1.4.5'
29
29
 
30
30
  spec.add_development_dependency 'bundler', '~> 1.10'
31
31
  spec.add_development_dependency 'rake', '~> 10.0'
@@ -1,7 +1,6 @@
1
1
  require 'thor'
2
2
  require 'xcodeproj'
3
3
  require 'liquid'
4
- require 'tilt'
5
4
  require 'git'
6
5
  require 'generamba/cli/gen_command.rb'
7
6
  require 'generamba/cli/setup_command.rb'
@@ -1,7 +1,9 @@
1
1
  require 'thor'
2
+ require 'generamba/helpers/print_table.rb'
2
3
  require 'generamba/helpers/rambafile_validator.rb'
3
4
  require 'generamba/helpers/xcodeproj_helper.rb'
4
5
  require 'generamba/helpers/dependency_checker.rb'
6
+ require 'generamba/helpers/gen_command_table_parameters_formatter.rb'
5
7
 
6
8
  module Generamba::CLI
7
9
  class Application < Thor
@@ -38,6 +40,12 @@ module Generamba::CLI
38
40
 
39
41
  rambafile = YAML.load_file(RAMBAFILE_NAME)
40
42
 
43
+ parameters = GenCommandTableParametersFormatter.prepare_parameters_for_displaying(rambafile)
44
+ PrintTable.print_values(
45
+ values: parameters,
46
+ title: "Summary for gen #{module_name}"
47
+ )
48
+
41
49
  template = ModuleTemplate.new(template_name)
42
50
  code_module = CodeModule.new(module_name, module_description, rambafile, options)
43
51
 
@@ -1,9 +1,9 @@
1
1
  require 'thor'
2
2
  require 'xcodeproj'
3
3
  require 'liquid'
4
- require 'tilt'
5
4
  require 'git'
6
5
  require 'generamba/constants/rambafile_constants.rb'
6
+ require 'generamba/helpers/print_table.rb'
7
7
 
8
8
  module Generamba::CLI
9
9
  class Application < Thor
@@ -33,21 +33,29 @@ module Generamba::CLI
33
33
  targets_prompt = ''
34
34
  project.targets.each_with_index { |element, i| targets_prompt += ("#{i}. #{element.name}" + "\n") }
35
35
  project_target = ask_index("Select the appropriate target for adding your MODULES (type the index):\n" + targets_prompt,project.targets)
36
- test_target = ask_index("Select the appropriate target for adding your TESTS (type the index):\n" + targets_prompt,project.targets)
36
+ include_tests = yes?('Are you using unit-tests in this project? (yes/no)')
37
+
38
+ if include_tests
39
+ test_target = ask_index("Select the appropriate target for adding your TESTS (type the index):\n" + targets_prompt,project.targets)
40
+ end
37
41
 
38
42
  should_use_same_paths = yes?('Do you want to use the same paths for your files both in Xcode and the filesystem? (yes/no)')
39
43
  if should_use_same_paths
40
44
  project_group_path = ask('The default path for creating new modules:')
41
45
  project_file_path = project_group_path
42
46
 
43
- test_group_path = ask('The default path for creating tests:')
44
- test_file_path = test_group_path
47
+ if include_tests
48
+ test_group_path = ask('The default path for creating tests:')
49
+ test_file_path = test_group_path
50
+ end
45
51
  else
46
52
  project_group_path = ask('The default path for creating new modules (in Xcode groups):')
47
53
  project_file_path = ask('The default path for creating new modules (in the filesystem):')
48
54
 
49
- test_group_path = ask('The default path for creating tests (in Xcode groups):')
50
- test_file_path = ask('The default path for creating tests (in the filesystem):')
55
+ if include_tests
56
+ test_group_path = ask('The default path for creating tests (in Xcode groups):')
57
+ test_file_path = ask('The default path for creating tests (in the filesystem):')
58
+ end
51
59
  end
52
60
 
53
61
  using_pods = yes?('Are you using Cocoapods? (yes/no)')
@@ -65,9 +73,23 @@ module Generamba::CLI
65
73
  properties[PROJECT_TARGET_KEY] = project_target.name
66
74
  properties[PROJECT_FILE_PATH_KEY] = project_file_path
67
75
  properties[PROJECT_GROUP_PATH_KEY] = project_group_path
68
- properties[TEST_TARGET_KEY] = test_target.name
69
- properties[TEST_FILE_PATH_KEY] = test_file_path
70
- properties[TEST_GROUP_PATH_KEY] = test_group_path
76
+
77
+ if test_target
78
+ properties[TEST_TARGET_KEY] = test_target.name
79
+ end
80
+
81
+ if test_file_path
82
+ properties[TEST_FILE_PATH_KEY] = test_file_path
83
+ end
84
+
85
+ if test_group_path
86
+ properties[TEST_GROUP_PATH_KEY] = test_group_path
87
+ end
88
+
89
+ PrintTable.print_values(
90
+ values: properties,
91
+ title: "Summary for generamba setup"
92
+ )
71
93
 
72
94
  Generamba::RambafileGenerator.create_rambafile(properties)
73
95
  puts('Rambafile successfully created! Now add some templates to the Rambafile and run `generamba template install`.'.green)
@@ -1,3 +1,5 @@
1
+ require 'generamba/helpers/print_table.rb'
2
+
1
3
  module Generamba::CLI
2
4
  class Template < Thor
3
5
  include Generamba
@@ -17,13 +19,22 @@ module Generamba::CLI
17
19
  TEMPLATE_NAME_KEY => template_name,
18
20
  TEMPLATE_SUMMARY_KEY => summary,
19
21
  TEMPLATE_AUTHOR_KEY => author,
20
- TEMPLATE_LICENSE_KEY => license,
21
- TEMPLATE_DEPENDENCIES_KEY => dependencies
22
+ TEMPLATE_LICENSE_KEY => license
22
23
  }
23
24
 
25
+ if dependencies and !dependencies.empty?
26
+ properties[TEMPLATE_DEPENDENCIES_KEY] = dependencies
27
+ end
28
+
29
+ PrintTable.print_values(
30
+ values: properties,
31
+ title: "Summary for template create"
32
+ )
33
+
24
34
  template_creator = Generamba::TemplateCreator.new
25
35
  template_creator.create_template(properties)
26
36
  puts("The template #{template_name} is successfully generated! Now add some file templates into it.".green)
27
37
  end
38
+
28
39
  end
29
40
  end
@@ -16,15 +16,16 @@ project_file_path: {{ project_file_path }}
16
16
  # The Xcode group path to new modules
17
17
  project_group_path: {{ project_group_path }}
18
18
 
19
- {% if test_target != "" or test_file_path != "" or test_group_path != "" %}### Tests generation settings section{% endif %}
20
- {% if test_target != "" %}# The tests target name
19
+ {% 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
20
+ {% if test_target != nil and test_target != "" %}# The tests target name
21
21
  test_target: {{ test_target }}{% endif %}
22
22
 
23
- {% if test_file_path != "" %}# The file path for new tests
23
+ {% if test_file_path != nil and test_file_path != "" %}# The file path for new tests
24
24
  test_file_path: {{ test_file_path }}{% endif %}
25
25
 
26
- {% if test_group_path != "" %}# The Xcode group path to new tests
26
+ {% if test_group_path != nil and test_group_path != "" %}# The Xcode group path to new tests
27
27
  test_group_path: {{ test_group_path }}{% endif %}
28
+ {% endif %}
28
29
 
29
30
  {% if podfile_path != nil or cartfile_path != nil %}### Dependencies settings section{% endif %}
30
31
  {% if podfile_path != nil %}podfile_path: {{ podfile_path }}{% endif %}
@@ -1,5 +1,4 @@
1
1
  require 'liquid'
2
- require 'tilt'
3
2
 
4
3
  module Generamba
5
4
 
@@ -13,13 +12,17 @@ module Generamba
13
12
  #
14
13
  # @return [String] The generated body
15
14
  def self.create_file_content(file, code_module, template)
16
- file_template = Tilt.new(template.template_path.join(file[TEMPLATE_FILE_PATH_KEY]))
17
- file_name = File.basename(file[TEMPLATE_FILE_NAME_KEY])
15
+ file_source = IO.read(template.template_path.join(file[TEMPLATE_FILE_PATH_KEY]))
16
+ Liquid::Template.file_system = Liquid::LocalFileSystem.new(template.template_path.join('snippets'), '%s.liquid')
17
+
18
+ template = Liquid::Template.parse(file_source)
19
+ file_name = File.basename(file[TEMPLATE_FILE_NAME_KEY])
20
+
18
21
  module_info = {
19
22
  'name' => code_module.name,
20
23
  'file_name' => file_name,
21
24
  'description' => code_module.description,
22
- 'project_name' => code_module.project_name
25
+ 'project_name' => code_module.project_name
23
26
  }
24
27
 
25
28
  developer = {
@@ -35,7 +38,8 @@ module Generamba
35
38
  'prefix' => code_module.prefix
36
39
  }
37
40
 
38
- output = file_template.render(scope)
41
+ output = template.render(scope)
42
+
39
43
  return output
40
44
  end
41
45
  end
@@ -1,5 +1,4 @@
1
1
  require 'liquid'
2
- require 'tilt'
3
2
 
4
3
  module Generamba
5
4
 
@@ -11,8 +10,10 @@ module Generamba
11
10
  #
12
11
  # @return void
13
12
  def self.create_rambafile(properties)
14
- template = Tilt.new(File.dirname(__FILE__) + '/Rambafile.liquid')
15
- output = template.render(properties)
13
+ file_source = IO.read(File.dirname(__FILE__) + '/Rambafile.liquid')
14
+
15
+ template = Liquid::Template.parse(file_source)
16
+ output = template.render(properties).gsub!(/[\n]{3,}/, "\n\n");
16
17
 
17
18
  File.open(RAMBAFILE_NAME, 'w+') {|f|
18
19
  f.write(output)
@@ -0,0 +1,23 @@
1
+ module Generamba
2
+
3
+ # Provides methods for prepare parameters for displaying in table.
4
+ class GenCommandTableParametersFormatter
5
+
6
+ # This method prepared parameter for displaying
7
+ def self.prepare_parameters_for_displaying(parameters)
8
+ params = parameters.clone
9
+
10
+ templates = []
11
+
12
+ params['templates'].each do |param|
13
+ templates.push(param['name'])
14
+ end
15
+
16
+ params['templates'] = templates.join(', ')
17
+
18
+ return params
19
+ end
20
+
21
+ end
22
+
23
+ end
@@ -0,0 +1,21 @@
1
+ module Generamba
2
+
3
+ # Provides methods for print parameters in nice table.
4
+ class PrintTable
5
+
6
+ # This method prints out all the user inputs in a nice table.
7
+ def self.print_values(values: nil, title: nil)
8
+ require 'terminal-table'
9
+
10
+ params = {}
11
+ params[:rows] = values
12
+ params[:title] = title.green if title
13
+
14
+ puts ''
15
+ puts Terminal::Table.new(params)
16
+ puts ''
17
+ end
18
+
19
+ end
20
+
21
+ end
@@ -25,18 +25,32 @@ module Generamba
25
25
  file_name = File.basename(file_path)
26
26
  targets_name.each do |target|
27
27
  xcode_target = self.obtain_target(target, project)
28
- xcode_target.add_file_references([xcode_file])
29
- end if self.add_file_to_target?(file_name)
28
+
29
+ if self.is_compile_source?(file_name)
30
+ xcode_target.add_file_references([xcode_file])
31
+ elsif self.is_bundle_resource?(file_name)
32
+ xcode_target.add_resources([xcode_file])
33
+ end
34
+
35
+ end
30
36
  end
31
37
 
32
- # Decides should file be added
33
- # @param file_name [String] Array of targets name
38
+ # File is a compiled source
39
+ # @param file_name [String] String of file name
34
40
  #
35
41
  # @return [TrueClass or FalseClass]
36
- def self.add_file_to_target?(file_name)
42
+ def self.is_compile_source?(file_name)
37
43
  File.extname(file_name) == '.m' || File.extname(file_name) == '.swift' || File.extname(file_name) == '.mm'
38
44
  end
39
45
 
46
+ # File is a resource
47
+ # @param resource_name [String] String of resource name
48
+ #
49
+ # @return [TrueClass or FalseClass]
50
+ def self.is_bundle_resource?(resource_name)
51
+ File.extname(resource_name) == '.xib' || File.extname(resource_name) == '.storyboard'
52
+ end
53
+
40
54
  # Recursively clears children of the given group
41
55
  # @param project [Xcodeproj::Project] The working Xcode project file
42
56
  # @param group_path [Pathname] The full group path
@@ -75,7 +89,7 @@ module Generamba
75
89
  #
76
90
  # @return [PBXGroup]
77
91
  def self.retreive_group_or_create_if_needed(group_path, project, create_group_if_not_exists)
78
- group_names = group_names_from_group_path(group_path)
92
+ group_names = path_names_from_path(group_path)
79
93
 
80
94
  final_group = project
81
95
 
@@ -112,13 +126,13 @@ module Generamba
112
126
  raise StandardError.new(error_description)
113
127
  end
114
128
 
115
- # Splits the provided Xcode group path to an array of separate groups
116
- # @param group_path The full group path
129
+ # Splits the provided Xcode path to an array of separate paths
130
+ # @param path The full group or file path
117
131
  #
118
132
  # @return [[String]]
119
- def self.group_names_from_group_path(group_path)
120
- groups = group_path.to_s.split('/')
121
- return groups
133
+ def self.path_names_from_path(path)
134
+ paths = path.to_s.split('/')
135
+ return paths
122
136
  end
123
137
 
124
138
  # Remove build file from target build phase
@@ -128,14 +142,28 @@ module Generamba
128
142
  #
129
143
  # @return [Void]
130
144
  def self.remove_file_by_file_path(file_path, targets_name, project)
131
- build_phases = self.build_phases_from_targets(targets_name, project)
132
-
145
+ file_names = path_names_from_path(file_path)
146
+
147
+ build_phases = nil
148
+
149
+ if self.is_compile_source?(file_names.last)
150
+ build_phases = self.build_phases_from_targets(targets_name, project)
151
+ elsif self.is_bundle_resource?(file_names.last)
152
+ build_phases = self.resources_build_phase_from_targets(targets_name, project)
153
+ end
154
+
155
+ self.remove_file_from_build_phases(file_path, build_phases)
156
+ end
157
+
158
+ def self.remove_file_from_build_phases(file_path, build_phases)
159
+ return if build_phases == nil
160
+
133
161
  build_phases.each do |build_phase|
134
162
  build_phase.files.each do |build_file|
135
163
  next if build_file.nil? || build_file.file_ref.nil?
136
164
 
137
165
  build_file_path = self.configure_file_ref_path(build_file.file_ref)
138
-
166
+
139
167
  if build_file_path == file_path
140
168
  build_phase.remove_build_file(build_file)
141
169
  end
@@ -163,6 +191,22 @@ module Generamba
163
191
  return build_phases
164
192
  end
165
193
 
194
+ # Find and return target resources build phase
195
+ # @param targets_name [String] Array of targets
196
+ # @param project [Xcodeproj::Project] The target xcodeproj file
197
+ #
198
+ # @return [[PBXResourcesBuildPhase]]
199
+ def self.resources_build_phase_from_targets(targets_name, project)
200
+ resource_build_phase = []
201
+
202
+ targets_name.each do |target_name|
203
+ xcode_target = self.obtain_target(target_name, project)
204
+ resource_build_phase.push(xcode_target.resources_build_phase)
205
+ end
206
+
207
+ return resource_build_phase
208
+ end
209
+
166
210
  # Get configure file full path
167
211
  # @param file_ref [PBXFileReference] Build file
168
212
  #
@@ -13,13 +13,14 @@ module Generamba
13
13
  #
14
14
  # @return [Void]
15
15
  def create_template(properties)
16
- template_dir_path = Pathname.new(File.dirname(__FILE__))
17
- .join(NEW_TEMPLATE_FOLDER)
16
+ template_dir_path = Pathname.new(File.dirname(__FILE__)).join(NEW_TEMPLATE_FOLDER)
18
17
  rambaspec_template_file_path = template_dir_path.join(RAMBASPEC_TEMPLATE_NAME)
19
18
  code_file_path = template_dir_path.join(CODE_FOLDER)
20
19
  tests_file_path = template_dir_path.join(TESTS_FOLDER)
21
20
 
22
- template = Tilt.new(rambaspec_template_file_path)
21
+ file_source = IO.read(rambaspec_template_file_path)
22
+
23
+ template = Liquid::Template.parse(file_source)
23
24
  output = template.render(properties)
24
25
 
25
26
  result_name = properties[TEMPLATE_NAME_KEY] + RAMBASPEC_EXTENSION
@@ -1,3 +1,3 @@
1
1
  module Generamba
2
- VERSION = '0.7.3'
2
+ VERSION = '0.7.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: generamba
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3
4
+ version: 0.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Egor Tolstoy
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-01-24 00:00:00.000000000 Z
12
+ date: 2016-02-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -54,47 +54,47 @@ dependencies:
54
54
  - !ruby/object:Gem::Version
55
55
  version: 3.0.6
56
56
  - !ruby/object:Gem::Dependency
57
- name: tilt
57
+ name: git
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - '='
61
61
  - !ruby/object:Gem::Version
62
- version: 2.0.1
62
+ version: 1.2.9.1
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - '='
68
68
  - !ruby/object:Gem::Version
69
- version: 2.0.1
69
+ version: 1.2.9.1
70
70
  - !ruby/object:Gem::Dependency
71
- name: git
71
+ name: cocoapods-core
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - '='
75
75
  - !ruby/object:Gem::Version
76
- version: 1.2.9.1
76
+ version: 0.39.0
77
77
  type: :runtime
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - '='
82
82
  - !ruby/object:Gem::Version
83
- version: 1.2.9.1
83
+ version: 0.39.0
84
84
  - !ruby/object:Gem::Dependency
85
- name: cocoapods-core
85
+ name: terminal-table
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
88
  - - '='
89
89
  - !ruby/object:Gem::Version
90
- version: 0.39.0
90
+ version: 1.4.5
91
91
  type: :runtime
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - '='
96
96
  - !ruby/object:Gem::Version
97
- version: 0.39.0
97
+ version: 1.4.5
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: bundler
100
100
  requirement: !ruby/object:Gem::Requirement
@@ -163,6 +163,7 @@ files:
163
163
  - ".gitignore"
164
164
  - ".rspec"
165
165
  - ".travis.yml"
166
+ - CHANGELOG.md
166
167
  - Gemfile
167
168
  - Gemfile.lock
168
169
  - LICENSE.txt
@@ -195,6 +196,8 @@ files:
195
196
  - lib/generamba/constants/rambaspec_constants.rb
196
197
  - lib/generamba/constants/user_preferences_constants.rb
197
198
  - lib/generamba/helpers/dependency_checker.rb
199
+ - lib/generamba/helpers/gen_command_table_parameters_formatter.rb
200
+ - lib/generamba/helpers/print_table.rb
198
201
  - lib/generamba/helpers/rambafile_validator.rb
199
202
  - lib/generamba/helpers/template_helper.rb
200
203
  - lib/generamba/helpers/xcodeproj_helper.rb