skeletor 0.6.4 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -3
- data/lib/skeletor/builder.rb +21 -7
- data/lib/skeletor/cli.rb +1 -1
- data/lib/skeletor/includes.rb +5 -5
- data/lib/skeletor/skeletons/loader.rb +1 -1
- data/lib/skeletor/skeletons/validator.rb +2 -0
- data/lib/skeletor/templates/js-lib/includes/LICENSE +20 -0
- data/lib/skeletor/templates/js-lib/js-lib.yml +2 -0
- data/lib/skeletor/templates/rb-gem/includes/Gemfile +4 -0
- data/lib/skeletor/templates/rb-gem/includes/LICENSE +20 -0
- data/lib/skeletor/templates/rb-gem/includes/sample.gemspec +15 -0
- data/lib/skeletor/templates/rb-gem/rb-gem.yml +18 -0
- data/lib/skeletor/version.rb +1 -1
- metadata +9 -4
data/README.md
CHANGED
@@ -161,19 +161,18 @@ put your templates in a `templates` folder under that. This way you just have t
|
|
161
161
|
|
162
162
|
###Supplied Templates###
|
163
163
|
|
164
|
-
Skeletor comes with
|
164
|
+
Skeletor comes with 2 presupplied template but I'll be adding a few more as I have time.
|
165
165
|
|
166
166
|
* `js-lib` Creates a skeleton for a Javascript library. This is based on the structure I use for most Javascript projects which is in turn based on the structures of libraries such
|
167
167
|
as Prototype and Scriptaculous.
|
168
|
+
* `rb-gem` Creates a skeleton for a Ruby Gem. This is based on the structure I used for this gem, which was generated from Jeweler and stripped back and simplified.
|
168
169
|
|
169
170
|
Coming Soon
|
170
171
|
-----------
|
171
172
|
|
172
|
-
* Add rDoc comments so rubygems.org can generate proper documentation
|
173
173
|
* Add Tests
|
174
174
|
* More Templates
|
175
175
|
* Option to turn off or lessen output
|
176
|
-
* Include parsing
|
177
176
|
* Option to deal with file/folder existing conflicts.
|
178
177
|
|
179
178
|
Notes
|
data/lib/skeletor/builder.rb
CHANGED
@@ -52,6 +52,8 @@ module Skeletor
|
|
52
52
|
node.each_pair{
|
53
53
|
|dir,content|
|
54
54
|
|
55
|
+
dir = replace_tags(dir)
|
56
|
+
|
55
57
|
puts 'Creating directory ' + File.join(path,dir)
|
56
58
|
Dir.mkdir(File.join(path,dir))
|
57
59
|
|
@@ -94,20 +96,21 @@ module Skeletor
|
|
94
96
|
# Checks if file is listed in the includes list and if so copies it from
|
95
97
|
# the given location. If not it creates a blank file.
|
96
98
|
def write_file(file,path)
|
97
|
-
|
98
99
|
#if a pre-existing file is specified in the includes list, copy that, if not write a blank file
|
99
100
|
if @template.includes.has_key?(file)
|
100
101
|
begin
|
101
|
-
Includes.copy_include(@template.includes[file]
|
102
|
+
content = Includes.copy_include(@template.includes[file],@template.path)
|
103
|
+
file = replace_tags(file)
|
102
104
|
rescue TypeError => e
|
103
105
|
puts e.message
|
104
106
|
exit
|
105
107
|
end
|
106
108
|
else
|
109
|
+
file = replace_tags(file)
|
107
110
|
puts 'Creating blank file: ' + File.join(path,file)
|
108
|
-
|
111
|
+
content=''
|
109
112
|
end
|
110
|
-
|
113
|
+
File.open(File.join(path,file),'w'){|f| f.write(replace_tags(content))}
|
111
114
|
end
|
112
115
|
|
113
116
|
# Parses the task string and runs the task.
|
@@ -125,9 +128,7 @@ module Skeletor
|
|
125
128
|
|
126
129
|
puts 'Running Task: ' + task
|
127
130
|
|
128
|
-
task = task
|
129
|
-
task = task.gsub('<skeleton_project>',@project)
|
130
|
-
task = task.gsub('<skelton_template>',@template_name)
|
131
|
+
task = replace_tags(task);
|
131
132
|
|
132
133
|
options = task.split(', ')
|
133
134
|
action = options.slice!(0)
|
@@ -142,6 +143,19 @@ module Skeletor
|
|
142
143
|
|
143
144
|
end
|
144
145
|
|
146
|
+
# Parses supplied string and replaces any instances of following tags with the relavant
|
147
|
+
# internal variable:
|
148
|
+
#
|
149
|
+
# <skeleton_path>,
|
150
|
+
# <skeleton_project>,
|
151
|
+
# <skeleton_template>
|
152
|
+
def replace_tags(str)
|
153
|
+
str = str.gsub('<skeleton_path>',@path)
|
154
|
+
str = str.gsub('<skeleton_project>',@project)
|
155
|
+
str = str.gsub('<skelton_template>',@template_name)
|
156
|
+
return str
|
157
|
+
end
|
158
|
+
|
145
159
|
end
|
146
160
|
|
147
161
|
end
|
data/lib/skeletor/cli.rb
CHANGED
@@ -30,7 +30,7 @@ module Skeletor
|
|
30
30
|
# Cleans out the specified directory
|
31
31
|
def clean
|
32
32
|
print 'Are you sure you want to clean this project directory? (Y|n): '
|
33
|
-
confirm = gets.chomp
|
33
|
+
confirm = $stdin.gets.chomp
|
34
34
|
if confirm != 'Y' && confirm != 'n'
|
35
35
|
puts 'Please enter Y or n'
|
36
36
|
elsif confirm == 'Y'
|
data/lib/skeletor/includes.rb
CHANGED
@@ -16,7 +16,7 @@ module Skeletor
|
|
16
16
|
|
17
17
|
# Reads the required include from either the remote url or the local path and writes it to the
|
18
18
|
# required location in the skeleton.
|
19
|
-
def self.copy_include(include,
|
19
|
+
def self.copy_include(include,path)
|
20
20
|
|
21
21
|
#if include path includes a protocol. Load from that
|
22
22
|
matches = PROTOCOL_PATTERN.match(include).to_a
|
@@ -36,17 +36,17 @@ module Skeletor
|
|
36
36
|
else
|
37
37
|
raise TypeError, 'Unsupported protocol ' + protocol + ' for remote file. Only the following are supported: ' + SUPPORTED_PROTOCOLS.join(', ')
|
38
38
|
end
|
39
|
-
puts '
|
39
|
+
puts 'Reading remote file ' + include
|
40
40
|
else
|
41
41
|
raise TypeError, 'Unsupported protocol for remote file. Only the following are supported: ' + SUPPORTED_PROTOCOLS.join(', ')
|
42
42
|
end
|
43
43
|
else
|
44
|
-
puts '
|
44
|
+
puts 'Reading ' + include + ' from template directory'
|
45
45
|
file = File.open(File.join(path,include))
|
46
|
-
content = file.gets
|
46
|
+
content = file.gets nil
|
47
47
|
end
|
48
48
|
|
49
|
-
|
49
|
+
return content
|
50
50
|
|
51
51
|
end
|
52
52
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 <Your Name Here>
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 <Your Name Here>
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,15 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "<skeleton_project>"
|
3
|
+
s.version = "0.0.0"
|
4
|
+
s.summary = "[Insert Gem Summary Here]"
|
5
|
+
s.description = "[Insert Longer Gem Description Here]"
|
6
|
+
|
7
|
+
s.files = Dir["README", "LICENSE", "lib/**/*.rb"]
|
8
|
+
s.authors = ["[Your Name Here]"]
|
9
|
+
s.email = ["[Your Email Here]"]
|
10
|
+
s.homepage = "[Gem Homepage Here]"
|
11
|
+
s.rubyforge_project = "<skeleton_project>"
|
12
|
+
s.licenses = ["MIT"]
|
13
|
+
|
14
|
+
end
|
15
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
directory_structure:
|
2
|
+
-
|
3
|
+
lib:
|
4
|
+
-
|
5
|
+
<skeleton_project>:
|
6
|
+
-
|
7
|
+
- <skeleton_project>.rb
|
8
|
+
test:
|
9
|
+
-
|
10
|
+
- <skeleton_project>.gemspec
|
11
|
+
- README
|
12
|
+
- LICENSE
|
13
|
+
- GemFile
|
14
|
+
includes:
|
15
|
+
<skeleton_project>.gemspec: includes/sample.gemspec
|
16
|
+
LICENSE: includes/LICENSE
|
17
|
+
GemFile: includes/GemFile
|
18
|
+
|
data/lib/skeletor/version.rb
CHANGED
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
7
|
+
- 7
|
8
|
+
- 0
|
9
|
+
version: 0.7.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Will McKenzie
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-09-
|
17
|
+
date: 2011-09-29 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -54,7 +54,12 @@ files:
|
|
54
54
|
- lib/skeletor/version.rb
|
55
55
|
- lib/skeletor.rb
|
56
56
|
- bin/skeletor
|
57
|
+
- lib/skeletor/templates/js-lib/includes/LICENSE
|
57
58
|
- lib/skeletor/templates/js-lib/js-lib.yml
|
59
|
+
- lib/skeletor/templates/rb-gem/includes/Gemfile
|
60
|
+
- lib/skeletor/templates/rb-gem/includes/LICENSE
|
61
|
+
- lib/skeletor/templates/rb-gem/includes/sample.gemspec
|
62
|
+
- lib/skeletor/templates/rb-gem/rb-gem.yml
|
58
63
|
- lib/skeletor/templates/template-schema.yml
|
59
64
|
has_rdoc: true
|
60
65
|
homepage: http://github.com/OiNutter/skeletor
|