projen 0.1.0
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.
- data/README.md +21 -0
- data/bin/projen +44 -0
- data/projen.gemspec +12 -0
- metadata +67 -0
data/README.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# Projen
|
2
|
+
|
3
|
+
A tool for developers to quickly create new projects based on directory
|
4
|
+
templates
|
5
|
+
|
6
|
+
## License
|
7
|
+
|
8
|
+
Copyright (c) 2011, Curtis McEnroe <programble@gmail.com>
|
9
|
+
|
10
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
11
|
+
purpose with or without fee is hereby granted, provided that the above
|
12
|
+
copyright notice and this permission notice appear in all copies.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
15
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
16
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
17
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
18
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
19
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
20
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
21
|
+
|
data/bin/projen
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'fileutils'
|
4
|
+
require 'find'
|
5
|
+
require 'liquid'
|
6
|
+
|
7
|
+
TEMPLATE_DIR = File.join(Dir.home, '.projen')
|
8
|
+
|
9
|
+
def relative_path(path, base)
|
10
|
+
path.start_with?(base) ? path[base.length+1..-1] : path
|
11
|
+
end
|
12
|
+
|
13
|
+
if ARGV.length < 2
|
14
|
+
puts 'usage: projen TEMPLATE PROJECT [DESCRIPTION]...'
|
15
|
+
exit 1
|
16
|
+
end
|
17
|
+
|
18
|
+
template = ARGV[0]
|
19
|
+
project = ARGV[1]
|
20
|
+
template_path = File.join(TEMPLATE_DIR, template)
|
21
|
+
project_path = File.expand_path(project)
|
22
|
+
|
23
|
+
unless File.directory?(template_path)
|
24
|
+
puts "error: the template '#{template}' does not exist"
|
25
|
+
exit 1
|
26
|
+
end
|
27
|
+
|
28
|
+
if File.exist?(project_path)
|
29
|
+
puts "error: '#{project}' already exists"
|
30
|
+
exit 1
|
31
|
+
end
|
32
|
+
|
33
|
+
Find.find(template_path) do |template_file|
|
34
|
+
next unless File.file?(template_file)
|
35
|
+
next if template_file[-1] == '~'
|
36
|
+
|
37
|
+
project_file = File.join(project_path, relative_path(template_file, template_path))
|
38
|
+
|
39
|
+
FileUtils.mkdir_p(File.dirname(project_file))
|
40
|
+
File.open(project_file, 'w') do |f|
|
41
|
+
liquid = Liquid::Template.parse(File.open(template_file).read)
|
42
|
+
f.write(liquid.render('project' => project, 'description' => ARGV[2], 'argv' => ARGV[1..-1]))
|
43
|
+
end
|
44
|
+
end
|
data/projen.gemspec
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'projen'
|
3
|
+
s.version = '0.1.0'
|
4
|
+
s.authors = ['Curtis McEnroe']
|
5
|
+
s.email = ['programble@gmail.com']
|
6
|
+
s.homepage = 'https://github.com/programble/projen'
|
7
|
+
s.summary = 'A project templating tool'
|
8
|
+
s.description = 'A tool for developers to quickly create new projects based on directory templates'
|
9
|
+
|
10
|
+
s.files = `git ls-files`.split("\n")
|
11
|
+
s.executables = 'projen'
|
12
|
+
end
|
metadata
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: projen
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
version: 0.1.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Curtis McEnroe
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2011-11-05 00:00:00 -04:00
|
18
|
+
default_executable:
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: A tool for developers to quickly create new projects based on directory templates
|
22
|
+
email:
|
23
|
+
- programble@gmail.com
|
24
|
+
executables:
|
25
|
+
- projen
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files: []
|
29
|
+
|
30
|
+
files:
|
31
|
+
- README.md
|
32
|
+
- bin/projen
|
33
|
+
- projen.gemspec
|
34
|
+
has_rdoc: true
|
35
|
+
homepage: https://github.com/programble/projen
|
36
|
+
licenses: []
|
37
|
+
|
38
|
+
post_install_message:
|
39
|
+
rdoc_options: []
|
40
|
+
|
41
|
+
require_paths:
|
42
|
+
- lib
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
+
none: false
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
segments:
|
49
|
+
- 0
|
50
|
+
version: "0"
|
51
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
segments:
|
57
|
+
- 0
|
58
|
+
version: "0"
|
59
|
+
requirements: []
|
60
|
+
|
61
|
+
rubyforge_project:
|
62
|
+
rubygems_version: 1.3.7
|
63
|
+
signing_key:
|
64
|
+
specification_version: 3
|
65
|
+
summary: A project templating tool
|
66
|
+
test_files: []
|
67
|
+
|