turple 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.travis.yml +2 -2
- data/Gemfile +1 -1
- data/Gemfile.lock +1 -1
- data/README.md +17 -17
- data/lib/turple.rb +16 -19
- data/lib/turple/cli.rb +2 -7
- metadata +10 -32
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
N2QwZDRkNTM2YWY2YjExNjMxYjAyMTA2MmExZTIxZTczY2RiYzUwNg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZTJkYTVjN2VhZjIyMDQ3NjBkODlmMDk5OTI4MjcwYzhhNDBiZmMzOA==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
Yzc0ZjYxMDZjY2Y3MTkwOTI5Y2YyOTJmYTNkZWZmNWM3MTUxNmJkMGJlY2Ri
|
10
|
+
NmExZTc2NDU2MWNjZTJkNjEyNjQwNDcyNmI4NDllM2FmMWYyZmQyYzM5NWYz
|
11
|
+
ZDgyZDBkYzg2ZjhlYzUzYzRkYjMxMmNiNjYzMmEwMTNjYjBmN2Q=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YjNhZGFkMWVhMGE1Y2I4NWQyZDE4MGJkZmM2NDhlZDdkNmIxNWExOTU5ZTAx
|
14
|
+
NmFkZDRjY2IxNjMwYjc4ODUwYzg0NmNlZjRlNDBiM2ZlOTgzNGUxMjczMmY0
|
15
|
+
ZTBhODczNzc1MzM4MzIzMzA5NjNlZjMwMWU5MWIzNGZiM2FiYzA=
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -9,28 +9,30 @@ Turple can take a custom template and use it to bootstrap projects structures yo
|
|
9
9
|
|
10
10
|
### Usage
|
11
11
|
|
12
|
-
I always make projects the same way.
|
12
|
+
I always make projects the same way. There are a bunch of tools for (supposedly) making this easier/faster, but I don't like any of them. They are either too opinionated or too limiting. This is what I like.
|
13
13
|
|
14
14
|
Turple takes any kind of template format you want, a bunch of data, and in*turple*ates it.
|
15
15
|
|
16
|
-
Turple is best used from a command line, but it can be used directly in ruby as well.
|
16
|
+
Turple is best used from a command line, but it can be used directly in ruby as well. **CLI FIRST...**
|
17
17
|
|
18
18
|
### CLI
|
19
19
|
|
20
|
-
Turple requires a path to a template, and an optional destination.
|
20
|
+
Turple requires a path to a template, and an optional destination. If no destination is passed, it will put everything in a `turple` folder from your current working directory.
|
21
21
|
|
22
22
|
```sh
|
23
23
|
turple --template /path/to/template --destination my_new_project_name
|
24
|
+
|
25
|
+
# or with shorter aliases
|
26
|
+
turple -t /path/to/template -d my_new_project_name
|
24
27
|
```
|
25
28
|
|
26
|
-
Turple will scan the template, determine what data is needed to process it, and prompt you for any missing data.
|
29
|
+
Turple will scan the template, determine what data is needed to process it, and prompt you for any missing data. If you wanted to run turple without the wizard, just throw a `Turplefile` into your destination directory with the necessary data.
|
27
30
|
|
28
31
|
### Turplefile
|
29
32
|
|
30
|
-
`Turplefile` files are yaml formatted files that provided various information to turple.
|
33
|
+
`Turplefile` files are yaml formatted files that provided various information to turple. Assuming our template requires a single piece of information called `foo`, our destination Turplefile could look something like this.
|
31
34
|
|
32
35
|
```yaml
|
33
|
-
template: /path/to/template
|
34
36
|
data:
|
35
37
|
foo: bar
|
36
38
|
```
|
@@ -39,21 +41,19 @@ Turple templates also have a Turplefile
|
|
39
41
|
|
40
42
|
### Turple Templates
|
41
43
|
|
42
|
-
A turple template is simply a directory containing a Turplefile, and any amount of custom folders and files your project template needs.
|
44
|
+
A turple template is simply a directory containing a Turplefile, and any amount of custom folders and files your project template needs. The Turplefile inside a template has different data than a destination file. It has instructions on how to prompt a user for data, and the configuration details on how the template is built. _This example uses the default turple configuration._
|
43
45
|
|
44
46
|
###### Remote Template
|
45
|
-
You can easily share other user's templates by
|
47
|
+
You can easily use remote templates directly, or share other user's templates by passing turple a remote source in addition to a template name. Simply separate the source name from the template name with 2 hashes (`##`).
|
46
48
|
|
47
|
-
|
48
|
-
turple --template 'git@github.com:brewster1134/turple_templates.git|ruby_template'
|
49
|
-
```
|
50
|
-
|
51
|
-
Turple uses the [Sourcerer](https://github.com/brewster1134/sourcerer) gem to download remote sources to a tmp directory, which supports github shorthand...
|
49
|
+
Turple uses the [Sourcerer](https://github.com/brewster1134/sourcerer) gem to download remote sources to a tmp directory, so you can use any supported Sourcerer format *(including github shorthand!)*
|
52
50
|
|
53
51
|
```
|
54
|
-
turple
|
52
|
+
turple -t brewster1134/turple_templates##javascript
|
55
53
|
```
|
56
54
|
|
55
|
+
To customize a template, you can modify the configuration in a template's Turplefile
|
56
|
+
|
57
57
|
### Configuration
|
58
58
|
|
59
59
|
```yaml
|
@@ -68,7 +68,7 @@ data_map:
|
|
68
68
|
foo: What is the foo called?
|
69
69
|
```
|
70
70
|
|
71
|
-
* `name` is just a friendly name for the template.
|
71
|
+
* `name` is just a friendly name for the template. its optional. we can use the template directory name for that.
|
72
72
|
* `configuration` has some very important details. (again, these are the defaults, so if your template does not have a custom configuration, it uses these values)
|
73
73
|
* `file_ext` is the file extension turple looks for to tell it there is content inside the file that needs processed
|
74
74
|
* `path_regex` this is a string representing a regex match to variable names
|
@@ -78,7 +78,7 @@ data_map:
|
|
78
78
|
|
79
79
|
## Example Template
|
80
80
|
|
81
|
-
Say you design a template using
|
81
|
+
Say you design a template using the turple default configuration, and you create a file structure like so...
|
82
82
|
```
|
83
83
|
foo_template
|
84
84
|
|__ my_[FOO.BAR]_dir
|
@@ -125,7 +125,7 @@ Paths Turpleated: 2
|
|
125
125
|
```
|
126
126
|
|
127
127
|
### Ruby
|
128
|
-
You can run turple directly in ruby if needed as well.
|
128
|
+
You can run turple directly in ruby if needed as well. _This example matches the template from the above example._
|
129
129
|
|
130
130
|
```ruby
|
131
131
|
require 'turple'
|
data/lib/turple.rb
CHANGED
@@ -27,10 +27,10 @@ class Turple
|
|
27
27
|
:default => 'brewster1134/turple-templates'
|
28
28
|
},
|
29
29
|
|
30
|
-
# default destination
|
31
|
-
:destination => File.join(Dir.pwd, 'turple'),
|
32
|
-
|
33
30
|
:configuration => {
|
31
|
+
# default destination
|
32
|
+
:destination => File.join(Dir.pwd, 'turple'),
|
33
|
+
|
34
34
|
# default regex for file names to interpolate content of
|
35
35
|
# matches files with an extension of `.turple`
|
36
36
|
# (e.g. foo.txt.turple)
|
@@ -129,26 +129,23 @@ class Turple
|
|
129
129
|
private
|
130
130
|
|
131
131
|
def initialize template_path, data_hash = {}, configuration_hash = {}
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
# load Turplefiles in order...
|
138
|
-
# home, template, destination
|
139
|
-
[
|
140
|
-
'~',
|
141
|
-
template_path,
|
142
|
-
@destination_path
|
143
|
-
].each do |path|
|
144
|
-
Turple.load_turplefile File.join(File.expand_path(path), 'Turplefile')
|
145
|
-
end
|
146
|
-
|
147
|
-
# create turplefile sources
|
132
|
+
# create sources
|
133
|
+
# load home & template turplefile first for possible additional sources
|
134
|
+
Turple.load_turplefile File.join(File.expand_path('~'), 'Turplefile')
|
135
|
+
Turple.load_turplefile File.join(File.expand_path(template_path), 'Turplefile')
|
148
136
|
Turple.sources.each do |source_name, source_path|
|
149
137
|
Turple::Source.new source_name, source_path
|
150
138
|
end
|
151
139
|
|
140
|
+
# find the destination and load it's optional Turplefile
|
141
|
+
configuration_hash = Turple.configuration.deep_merge configuration_hash
|
142
|
+
@destination_path = configuration_hash[:destination]
|
143
|
+
Turple.load_turplefile File.join(File.expand_path(@destination_path), 'Turplefile')
|
144
|
+
|
145
|
+
# collect data
|
146
|
+
data_hash = Turple.data.deep_merge data_hash
|
147
|
+
data_map_hash = Turple.data_map
|
148
|
+
|
152
149
|
if configuration_hash[:cli]
|
153
150
|
S.ay 'Saving to: ', :preset => :prompt, :newline => false
|
154
151
|
S.ay @destination_path
|
data/lib/turple/cli.rb
CHANGED
@@ -8,9 +8,9 @@ class Turple::Cli < Thor
|
|
8
8
|
# update turpleobject object with cli options
|
9
9
|
Turple.turpleobject = {
|
10
10
|
template: options['template'] || Turple.template,
|
11
|
-
destination: options['destination'] || Turple.destination,
|
12
11
|
configuration: {
|
13
|
-
cli: true
|
12
|
+
cli: true,
|
13
|
+
destination: options['destination'] || Turple.configuration[:destination],
|
14
14
|
}
|
15
15
|
}
|
16
16
|
|
@@ -18,10 +18,5 @@ class Turple::Cli < Thor
|
|
18
18
|
Turple.ate Turple.template
|
19
19
|
end
|
20
20
|
|
21
|
-
desc 'version', 'Turple version'
|
22
|
-
def version
|
23
|
-
'1.2.3'
|
24
|
-
end
|
25
|
-
|
26
21
|
default_task :ate
|
27
22
|
end
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turple
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.7
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Ryan Brewster
|
@@ -14,23 +13,20 @@ dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: activesupport
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: '4.
|
19
|
+
version: '4.2'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: '4.
|
26
|
+
version: '4.2'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: cli_miami
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ~>
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ~>
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -46,7 +41,6 @@ dependencies:
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: recursive-open-struct
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - ~>
|
52
46
|
- !ruby/object:Gem::Version
|
@@ -54,7 +48,6 @@ dependencies:
|
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - ~>
|
60
53
|
- !ruby/object:Gem::Version
|
@@ -62,7 +55,6 @@ dependencies:
|
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: sourcerer_
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
59
|
- - ~>
|
68
60
|
- !ruby/object:Gem::Version
|
@@ -70,7 +62,6 @@ dependencies:
|
|
70
62
|
type: :runtime
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
66
|
- - ~>
|
76
67
|
- !ruby/object:Gem::Version
|
@@ -78,7 +69,6 @@ dependencies:
|
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: thor
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
73
|
- - ~>
|
84
74
|
- !ruby/object:Gem::Version
|
@@ -86,7 +76,6 @@ dependencies:
|
|
86
76
|
type: :runtime
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
80
|
- - ~>
|
92
81
|
- !ruby/object:Gem::Version
|
@@ -94,7 +83,6 @@ dependencies:
|
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: coveralls
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
87
|
- - ~>
|
100
88
|
- !ruby/object:Gem::Version
|
@@ -102,7 +90,6 @@ dependencies:
|
|
102
90
|
type: :development
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
94
|
- - ~>
|
108
95
|
- !ruby/object:Gem::Version
|
@@ -110,7 +97,6 @@ dependencies:
|
|
110
97
|
- !ruby/object:Gem::Dependency
|
111
98
|
name: guard
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
100
|
requirements:
|
115
101
|
- - ~>
|
116
102
|
- !ruby/object:Gem::Version
|
@@ -118,7 +104,6 @@ dependencies:
|
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
107
|
requirements:
|
123
108
|
- - ~>
|
124
109
|
- !ruby/object:Gem::Version
|
@@ -126,7 +111,6 @@ dependencies:
|
|
126
111
|
- !ruby/object:Gem::Dependency
|
127
112
|
name: guard-rspec
|
128
113
|
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
114
|
requirements:
|
131
115
|
- - ~>
|
132
116
|
- !ruby/object:Gem::Version
|
@@ -134,7 +118,6 @@ dependencies:
|
|
134
118
|
type: :development
|
135
119
|
prerelease: false
|
136
120
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
121
|
requirements:
|
139
122
|
- - ~>
|
140
123
|
- !ruby/object:Gem::Version
|
@@ -142,7 +125,6 @@ dependencies:
|
|
142
125
|
- !ruby/object:Gem::Dependency
|
143
126
|
name: rspec
|
144
127
|
requirement: !ruby/object:Gem::Requirement
|
145
|
-
none: false
|
146
128
|
requirements:
|
147
129
|
- - ~>
|
148
130
|
- !ruby/object:Gem::Version
|
@@ -150,7 +132,6 @@ dependencies:
|
|
150
132
|
type: :development
|
151
133
|
prerelease: false
|
152
134
|
version_requirements: !ruby/object:Gem::Requirement
|
153
|
-
none: false
|
154
135
|
requirements:
|
155
136
|
- - ~>
|
156
137
|
- !ruby/object:Gem::Version
|
@@ -158,7 +139,6 @@ dependencies:
|
|
158
139
|
- !ruby/object:Gem::Dependency
|
159
140
|
name: terminal-notifier-guard
|
160
141
|
requirement: !ruby/object:Gem::Requirement
|
161
|
-
none: false
|
162
142
|
requirements:
|
163
143
|
- - ~>
|
164
144
|
- !ruby/object:Gem::Version
|
@@ -166,7 +146,6 @@ dependencies:
|
|
166
146
|
type: :development
|
167
147
|
prerelease: false
|
168
148
|
version_requirements: !ruby/object:Gem::Requirement
|
169
|
-
none: false
|
170
149
|
requirements:
|
171
150
|
- - ~>
|
172
151
|
- !ruby/object:Gem::Version
|
@@ -178,6 +157,9 @@ executables:
|
|
178
157
|
extensions: []
|
179
158
|
extra_rdoc_files: []
|
180
159
|
files:
|
160
|
+
- .gitignore
|
161
|
+
- .rspec
|
162
|
+
- .travis.yml
|
181
163
|
- Gemfile
|
182
164
|
- Gemfile.lock
|
183
165
|
- Guardfile
|
@@ -190,32 +172,28 @@ files:
|
|
190
172
|
- lib/turple/source.rb
|
191
173
|
- lib/turple/template.rb
|
192
174
|
- yuyi_menu
|
193
|
-
- .gitignore
|
194
|
-
- .rspec
|
195
|
-
- .travis.yml
|
196
175
|
homepage: https://github.com/brewster1134/turple
|
197
176
|
licenses:
|
198
177
|
- MIT
|
178
|
+
metadata: {}
|
199
179
|
post_install_message:
|
200
180
|
rdoc_options: []
|
201
181
|
require_paths:
|
202
182
|
- lib
|
203
183
|
required_ruby_version: !ruby/object:Gem::Requirement
|
204
|
-
none: false
|
205
184
|
requirements:
|
206
185
|
- - ! '>='
|
207
186
|
- !ruby/object:Gem::Version
|
208
|
-
version:
|
187
|
+
version: 1.9.3.pre.p550
|
209
188
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
210
|
-
none: false
|
211
189
|
requirements:
|
212
190
|
- - ! '>='
|
213
191
|
- !ruby/object:Gem::Version
|
214
192
|
version: '0'
|
215
193
|
requirements: []
|
216
194
|
rubyforge_project:
|
217
|
-
rubygems_version:
|
195
|
+
rubygems_version: 2.4.5
|
218
196
|
signing_key:
|
219
|
-
specification_version:
|
197
|
+
specification_version: 4
|
220
198
|
summary: Quick Project Templating
|
221
199
|
test_files: []
|