turple 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -1
- data/Gemfile.lock +10 -1
- data/README.md +13 -0
- data/lib/turple/template.rb +24 -1
- data/lib/turple.rb +0 -1
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 085546359d95c95a2ff9606bb32064200bc47932
|
4
|
+
data.tar.gz: 15530e590730ead076deed65817663344ca45a5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44c35d882b0707901ec0cde574f906862efbddcc4c17f4c8e02ade91d167781918e3439ccb6a3eb9d5e1e914e5e785f35244ead47b370fcbce2b3889182cf242
|
7
|
+
data.tar.gz: dcb66d642ab9d988c66fb8204bb79308e3c12fe7ee812c554142dde958d7ad9b299b627818a3ce6aab29883a30c27cd128e1c3cefce596001105c058639927d6
|
data/Gemfile
CHANGED
@@ -3,8 +3,9 @@ source 'https://rubygems.org'
|
|
3
3
|
gem 'activesupport', '~> 4.1'
|
4
4
|
gem 'cli_miami', '~> 0.0'
|
5
5
|
gem 'colorize', '~> 0.7'
|
6
|
-
gem 'coveralls', :require => false
|
6
|
+
gem 'coveralls', '~> 0.7', :require => false
|
7
7
|
gem 'recursive-open-struct', '~> 0.5'
|
8
|
+
gem 'sourcerer_', '~> 0.0', :require => 'sourcerer'
|
8
9
|
gem 'thor', '~> 0.19'
|
9
10
|
|
10
11
|
group :test do
|
data/Gemfile.lock
CHANGED
@@ -7,6 +7,8 @@ GEM
|
|
7
7
|
minitest (~> 5.1)
|
8
8
|
thread_safe (~> 0.3, >= 0.3.4)
|
9
9
|
tzinfo (~> 1.1)
|
10
|
+
archive-zip (0.7.0)
|
11
|
+
io-like (~> 0.3.0)
|
10
12
|
celluloid (0.16.0)
|
11
13
|
timers (~> 4.0.0)
|
12
14
|
cli_miami (0.0.6)
|
@@ -23,6 +25,7 @@ GEM
|
|
23
25
|
docile (1.1.5)
|
24
26
|
ffi (1.9.6)
|
25
27
|
formatador (0.2.5)
|
28
|
+
git (1.2.8)
|
26
29
|
guard (2.10.5)
|
27
30
|
formatador (>= 0.2.4)
|
28
31
|
listen (~> 2.7)
|
@@ -37,6 +40,7 @@ GEM
|
|
37
40
|
rspec (>= 2.99.0, < 4.0)
|
38
41
|
hitimes (1.2.2)
|
39
42
|
i18n (0.7.0)
|
43
|
+
io-like (0.3.0)
|
40
44
|
json (1.8.1)
|
41
45
|
listen (2.8.4)
|
42
46
|
celluloid (>= 0.15.2)
|
@@ -78,6 +82,10 @@ GEM
|
|
78
82
|
simplecov-html (~> 0.8.0)
|
79
83
|
simplecov-html (0.8.0)
|
80
84
|
slop (3.6.0)
|
85
|
+
sourcerer_ (0.0.6)
|
86
|
+
activesupport (~> 4.1)
|
87
|
+
archive-zip (~> 0.7)
|
88
|
+
git (~> 1.2)
|
81
89
|
term-ansicolor (1.3.0)
|
82
90
|
tins (~> 1.0)
|
83
91
|
terminal-notifier-guard (1.6.4)
|
@@ -96,10 +104,11 @@ DEPENDENCIES
|
|
96
104
|
activesupport (~> 4.1)
|
97
105
|
cli_miami (~> 0.0)
|
98
106
|
colorize (~> 0.7)
|
99
|
-
coveralls
|
107
|
+
coveralls (~> 0.7)
|
100
108
|
guard (~> 2.6)
|
101
109
|
guard-rspec (~> 4.3)
|
102
110
|
recursive-open-struct (~> 0.5)
|
103
111
|
rspec (~> 3.1)
|
112
|
+
sourcerer_ (~> 0.0)
|
104
113
|
terminal-notifier-guard (~> 1.5)
|
105
114
|
thor (~> 0.19)
|
data/README.md
CHANGED
@@ -41,6 +41,19 @@ Turple templates also have a Turplefile
|
|
41
41
|
|
42
42
|
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
43
|
|
44
|
+
###### Remote Template
|
45
|
+
You can easily share other user's templates by giving turple a remote source in addition to a template name. This allows you to, for example, use templates stored in another user's github repo without having to clone or download it yourself. Simply separate the source name from the template name with a pipe `|`. __You will need to use quotes around template names when using remote templates__
|
46
|
+
|
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...
|
52
|
+
|
53
|
+
```
|
54
|
+
turple --template 'brewster1134/turple_templates|ruby_template'
|
55
|
+
```
|
56
|
+
|
44
57
|
### Configuration
|
45
58
|
|
46
59
|
```yaml
|
data/lib/turple/template.rb
CHANGED
@@ -1,14 +1,18 @@
|
|
1
1
|
require 'active_support/core_ext/hash/deep_merge'
|
2
2
|
require 'cli_miami'
|
3
3
|
require 'find'
|
4
|
+
require 'sourcerer'
|
4
5
|
|
5
6
|
class Turple::Template
|
6
7
|
attr_accessor :path, :required_data, :configuration, :name
|
7
8
|
|
9
|
+
# character used to split a remote source from a template name
|
10
|
+
SOURCE_SPLITTER = '|'
|
11
|
+
|
8
12
|
private
|
9
13
|
|
10
14
|
def initialize path, configuration
|
11
|
-
@path = path
|
15
|
+
@path = get_path path
|
12
16
|
@configuration = configuration
|
13
17
|
|
14
18
|
# validate template path
|
@@ -31,6 +35,25 @@ private
|
|
31
35
|
@name = Turple.turpleobject[:name] || File.basename(@path)
|
32
36
|
end
|
33
37
|
|
38
|
+
# process path for possible a remote source
|
39
|
+
# use Sourcerer to download source
|
40
|
+
#
|
41
|
+
# @param path [String] template path
|
42
|
+
# @return [String] valid path to local directory containing template
|
43
|
+
#
|
44
|
+
def get_path path
|
45
|
+
# detect a remote source
|
46
|
+
if path.include? SOURCE_SPLITTER
|
47
|
+
source_template = path.split SOURCE_SPLITTER
|
48
|
+
source = Sourcerer.new source_template[0]
|
49
|
+
template = source_template[1]
|
50
|
+
|
51
|
+
File.join(source.destination, template)
|
52
|
+
else
|
53
|
+
return File.expand_path path
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
34
57
|
# Scan a path and determine the required data needed to interpolate it
|
35
58
|
# @param template_path [String] path to a template file
|
36
59
|
# @return [Hash] a hash of all the data needed
|
data/lib/turple.rb
CHANGED
@@ -107,7 +107,6 @@ class Turple
|
|
107
107
|
private
|
108
108
|
|
109
109
|
def initialize template_path, data_hash, configuration_hash
|
110
|
-
template_path = File.expand_path template_path
|
111
110
|
data_hash = Turple.data.deep_merge data_hash
|
112
111
|
data_map_hash = Turple.data_map
|
113
112
|
configuration_hash = Turple.configuration.deep_merge configuration_hash
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turple
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Brewster
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0.5'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: sourcerer_
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: thor
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|