xfabricator 0.1.1 → 0.1.2
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 +4 -4
- data/README.md +67 -6
- data/lib/xfabricator/fabricator.rb +9 -1
- data/lib/xfabricator/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 645a21806994d33b4928c8ff917164bd7ee10e0f
|
4
|
+
data.tar.gz: 675a34495eba71982d963f6c0125d691852e747c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98352f3416adb271fc9bd3d73379cdb018670e3072e6d7a1050cfb7e8108e18dddb7c129054bc0734c1599a3e74d5c41cc238a0cc964bcbfe605a022dfe765d8
|
7
|
+
data.tar.gz: 725e357afccdf7fa7e87495108454cc5c15e0b2d7baa09752319add13fd86aa60039147c1807275833e02b145e2140f6b11a50d1f7492d3575b5914f42554268
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
#
|
1
|
+
# xfabricator
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
Generate files from mustache templates and add them directly to an xcode projects.
|
4
|
+
* Generated files can be added to specific targets, groups and paths
|
5
|
+
* Generated files can be added to groups automatically based on the path
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -22,7 +22,69 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
### Project configuration
|
26
|
+
|
27
|
+
This configuration file should be located somewhere in the root of your project directory. When the `xfabricate` CLI
|
28
|
+
tool is run it will scan up the folder hierarchy until it finds this file.
|
29
|
+
|
30
|
+
**.xfabricate**
|
31
|
+
```ruby
|
32
|
+
FabricationConfig.create_config lambda { |config|
|
33
|
+
variables = {}
|
34
|
+
variables[:project_variable] = "value specific to the project"
|
35
|
+
variables[:some_interesting_value] = "another value specific to the project"
|
36
|
+
|
37
|
+
#Any project specific variables. This can be omitted.
|
38
|
+
config[:variables] = variables
|
39
|
+
|
40
|
+
#The project file to add generated files to
|
41
|
+
config[:project_file] = "#{relative_path}/ExampleProj.xcodeproj"
|
42
|
+
|
43
|
+
#The location of template definitions and associated files; can be absolute or relative
|
44
|
+
config[:template_location] = "#{relative_path}/xftemplates"
|
45
|
+
|
46
|
+
#The target to associate any generated files when no specific target is specified
|
47
|
+
config[:default_target] = 'ExampleProj'
|
48
|
+
}
|
49
|
+
```
|
50
|
+
|
51
|
+
### Template definitions
|
52
|
+
|
53
|
+
The template definition file should be located in the template_location specified in the `.xfabricate` configuration file.
|
54
|
+
A file named `Test.xftemplate` could be used for template fabrication using the following `xfabricate -t Test` anywhere
|
55
|
+
inside the project.
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
TemplateDefinition.create_definition lambda { |template_definition|
|
59
|
+
#Declare template files and generated file names
|
60
|
+
#Generated file names can include any project or template variable
|
61
|
+
template_files = [
|
62
|
+
TemplateFileDefinition.new("ExampleTemplate.h", '{{some_variable}}Widget.h'),
|
63
|
+
TemplateFileDefinition.new("ExampleTemplate.m", '{{some_variable}}Widget.m')
|
64
|
+
]
|
65
|
+
|
66
|
+
template_definition[:template_files] = template_files
|
67
|
+
|
68
|
+
#declare variable names and appropriate prompts to request variable values
|
69
|
+
template_definition[:variable_prompts] = {
|
70
|
+
some_variable: 'some_variable value:',
|
71
|
+
a_variable_used_in_template: 'Please enter a value for the variable used in the template...'
|
72
|
+
}
|
73
|
+
}
|
74
|
+
```
|
75
|
+
|
76
|
+
The template files are mustache templates with access to any variables in the project configuration or supplied at
|
77
|
+
prompts defined in the template definition.
|
78
|
+
|
79
|
+
### Command line tool
|
80
|
+
|
81
|
+
```
|
82
|
+
Usage: xfabricate [options]
|
83
|
+
-t, --template=template_name specify template to fabricate
|
84
|
+
-a, --target=target_name specify target to add created files
|
85
|
+
-g, --group=group_name specify group to add created files
|
86
|
+
-p, --path=path_name specify path to generate created files
|
87
|
+
```
|
26
88
|
|
27
89
|
## Development
|
28
90
|
|
@@ -34,7 +96,6 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
34
96
|
|
35
97
|
Bug reports and pull requests are welcome on GitHub at https://github.com/nicholascross/xfabricator.
|
36
98
|
|
37
|
-
|
38
99
|
## License
|
39
100
|
|
40
101
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
@@ -71,7 +71,15 @@ module Xfabricator
|
|
71
71
|
|
72
72
|
def find_current_group
|
73
73
|
project = @config.project
|
74
|
-
|
74
|
+
main_group = project.main_group
|
75
|
+
|
76
|
+
main_group_path = "#{project.path.parent.to_s}#{main_group.hierarchy_path}"
|
77
|
+
puts "#{main_group_path} == #{@fabrication_path.to_s}"
|
78
|
+
if main_group_path == @fabrication_path.to_s
|
79
|
+
return main_group
|
80
|
+
end
|
81
|
+
|
82
|
+
find_group_for_directory(main_group, @fabrication_path, project)
|
75
83
|
end
|
76
84
|
|
77
85
|
def find_group_for_directory(current_group, directory, project)
|
data/lib/xfabricator/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xfabricator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicholas Cross
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|