prigner 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +123 -200
- data/{README.mkd → README.rdoc} +36 -42
- data/Rakefile +140 -112
- data/lib/prigner/cli/copy.rb +39 -0
- data/lib/prigner/cli/new.rb +10 -8
- data/lib/prigner/extensions.rb +17 -2
- data/lib/prigner/template.rb +2 -24
- data/lib/prigner.rb +46 -10
- data/prigner.gemspec +27 -30
- data/test/fixtures/templates/shared/templates/ruby/sinatra/models/README.mkd +2 -0
- data/test/fixtures/templates/shared/templates/ruby/sinatra/models/Rakefile +7 -0
- data/test/fixtures/templates/shared/templates/ruby/sinatra/models/empty_test.rb +21 -0
- data/test/fixtures/templates/shared/templates/ruby/sinatra/models/module.rb +6 -0
- data/test/fixtures/templates/shared/templates/ruby/sinatra/specfile +18 -0
- data/test/fixtures/templates/user/.prigner/sources +1 -0
- data/test/helpers.rb +36 -1
- data/test/spec_test.rb +1 -1
- data/test/template_test.rb +7 -9
- metadata +30 -32
- /data/test/fixtures/templates/shared/{ruby → templates/ruby}/default/README.mkd +0 -0
- /data/test/fixtures/templates/shared/{ruby → templates/ruby}/default/models/README.mkd +0 -0
- /data/test/fixtures/templates/shared/{ruby → templates/ruby}/default/models/Rakefile +0 -0
- /data/test/fixtures/templates/shared/{ruby → templates/ruby}/default/models/empty_test.rb +0 -0
- /data/test/fixtures/templates/shared/{ruby → templates/ruby}/default/models/module.rb +0 -0
- /data/test/fixtures/templates/shared/{ruby → templates/ruby}/default/specfile +0 -0
- /data/test/fixtures/templates/user/{bash → .prigner/templates/bash}/default/specfile +0 -0
- /data/test/fixtures/templates/user/{ruby → .prigner/templates/ruby}/program/models/README.erb +0 -0
- /data/test/fixtures/templates/user/{ruby → .prigner/templates/ruby}/program/models/cli.rb.erb +0 -0
- /data/test/fixtures/templates/user/{ruby → .prigner/templates/ruby}/program/models/module.rb.erb +0 -0
- /data/test/fixtures/templates/user/{ruby → .prigner/templates/ruby}/program/models/program.rb.erb +0 -0
- /data/test/fixtures/templates/user/{ruby → .prigner/templates/ruby}/program/specfile +0 -0
- /data/test/fixtures/templates/user/{vim → .prigner/templates/vim}/default/specfile +0 -0
- /data/test/fixtures/templates/user/{vim → .prigner/templates/vim}/plugin/specfile +0 -0
- /data/test/fixtures/templates/user/{vim → .prigner/templates/vim}/syntax/specfile +0 -0
data/prigner.gemspec
CHANGED
@@ -8,13 +8,14 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ["Hallison Batista"]
|
9
9
|
spec.email = "hallison@codigorama.com"
|
10
10
|
spec.homepage = "http://codigorama.com/products/prigner"
|
11
|
+
spec.rubyforge_project = spec.name
|
11
12
|
spec.executables = [ "prign" ]
|
12
13
|
spec.default_executable = "prign"
|
13
14
|
#
|
14
15
|
|
15
16
|
#version
|
16
|
-
spec.version = "0.1.
|
17
|
-
spec.date = "2010-10-
|
17
|
+
spec.version = "0.1.1"
|
18
|
+
spec.date = "2010-10-21"
|
18
19
|
#
|
19
20
|
|
20
21
|
#dependencies
|
@@ -25,7 +26,7 @@ Gem::Specification.new do |spec|
|
|
25
26
|
spec.files = [
|
26
27
|
"CHANGELOG",
|
27
28
|
"COPYING",
|
28
|
-
"README.
|
29
|
+
"README.rdoc",
|
29
30
|
"Rakefile",
|
30
31
|
"bin/prign",
|
31
32
|
"lib/prigner.rb",
|
@@ -54,21 +55,27 @@ Gem::Specification.new do |spec|
|
|
54
55
|
"share/templates/ruby/gem/specfile",
|
55
56
|
"test/builder_test.rb",
|
56
57
|
"test/fixtures/model.rb.erb",
|
57
|
-
"test/fixtures/templates/shared/ruby/default/README.mkd",
|
58
|
-
"test/fixtures/templates/shared/ruby/default/models/README.mkd",
|
59
|
-
"test/fixtures/templates/shared/ruby/default/models/Rakefile",
|
60
|
-
"test/fixtures/templates/shared/ruby/default/models/empty_test.rb",
|
61
|
-
"test/fixtures/templates/shared/ruby/default/models/module.rb",
|
62
|
-
"test/fixtures/templates/shared/ruby/default/specfile",
|
63
|
-
"test/fixtures/templates/
|
64
|
-
"test/fixtures/templates/
|
65
|
-
"test/fixtures/templates/
|
66
|
-
"test/fixtures/templates/
|
67
|
-
"test/fixtures/templates/
|
68
|
-
"test/fixtures/templates/user/
|
69
|
-
"test/fixtures/templates/user/
|
70
|
-
"test/fixtures/templates/user/
|
71
|
-
"test/fixtures/templates/user/
|
58
|
+
"test/fixtures/templates/shared/templates/ruby/default/README.mkd",
|
59
|
+
"test/fixtures/templates/shared/templates/ruby/default/models/README.mkd",
|
60
|
+
"test/fixtures/templates/shared/templates/ruby/default/models/Rakefile",
|
61
|
+
"test/fixtures/templates/shared/templates/ruby/default/models/empty_test.rb",
|
62
|
+
"test/fixtures/templates/shared/templates/ruby/default/models/module.rb",
|
63
|
+
"test/fixtures/templates/shared/templates/ruby/default/specfile",
|
64
|
+
"test/fixtures/templates/shared/templates/ruby/sinatra/models/README.mkd",
|
65
|
+
"test/fixtures/templates/shared/templates/ruby/sinatra/models/Rakefile",
|
66
|
+
"test/fixtures/templates/shared/templates/ruby/sinatra/models/empty_test.rb",
|
67
|
+
"test/fixtures/templates/shared/templates/ruby/sinatra/models/module.rb",
|
68
|
+
"test/fixtures/templates/shared/templates/ruby/sinatra/specfile",
|
69
|
+
"test/fixtures/templates/user/.prigner/sources",
|
70
|
+
"test/fixtures/templates/user/.prigner/templates/bash/default/specfile",
|
71
|
+
"test/fixtures/templates/user/.prigner/templates/ruby/program/models/README.erb",
|
72
|
+
"test/fixtures/templates/user/.prigner/templates/ruby/program/models/cli.rb.erb",
|
73
|
+
"test/fixtures/templates/user/.prigner/templates/ruby/program/models/module.rb.erb",
|
74
|
+
"test/fixtures/templates/user/.prigner/templates/ruby/program/models/program.rb.erb",
|
75
|
+
"test/fixtures/templates/user/.prigner/templates/ruby/program/specfile",
|
76
|
+
"test/fixtures/templates/user/.prigner/templates/vim/default/specfile",
|
77
|
+
"test/fixtures/templates/user/.prigner/templates/vim/plugin/specfile",
|
78
|
+
"test/fixtures/templates/user/.prigner/templates/vim/syntax/specfile",
|
72
79
|
"test/helpers.rb",
|
73
80
|
"test/model_test.rb",
|
74
81
|
"test/project_test.rb",
|
@@ -84,7 +91,7 @@ Gem::Specification.new do |spec|
|
|
84
91
|
#documentation
|
85
92
|
spec.has_rdoc = true
|
86
93
|
spec.extra_rdoc_files = [
|
87
|
-
"README.
|
94
|
+
"README.rdoc",
|
88
95
|
"COPYING",
|
89
96
|
"CHANGELOG"
|
90
97
|
]
|
@@ -96,23 +103,13 @@ Gem::Specification.new do |spec|
|
|
96
103
|
"--title", "Prigner v#{spec.version} API Documentation"
|
97
104
|
]
|
98
105
|
|
99
|
-
#rubygems
|
100
|
-
spec.rubyforge_project = spec.name
|
101
106
|
spec.post_install_message = <<-end_message.gsub(/^[ ]{4}/,'')
|
102
107
|
#{'-'*78}
|
103
108
|
Prigner v#{spec.version}
|
104
109
|
|
105
|
-
Thanks for use Prigner.
|
106
|
-
|
107
|
-
Try run:
|
110
|
+
Thanks for use Prigner. See all shared templates running:
|
108
111
|
|
109
112
|
$ prign list
|
110
|
-
|
111
|
-
See all shared templates. If you want customize a template, just run:
|
112
|
-
|
113
|
-
$ prign copy <namespace>[:template]
|
114
|
-
|
115
|
-
Please, feedback in http://github.com/codigorama/prigner/issues.
|
116
113
|
#{'-'*78}
|
117
114
|
end_message
|
118
115
|
#
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<%= '# $Id$' if option.svn.enabled %>
|
2
|
+
BASE_PATH = "#{File.expand_path(File.dirname(__FILE__))}/.."
|
3
|
+
|
4
|
+
$LOAD_PATH.unshift(BASE_PATH) unless $LOAD_PATH.include? BASE_PATH
|
5
|
+
|
6
|
+
require "test/unit"
|
7
|
+
require "test/helpers"
|
8
|
+
require "lib/<%=project.name%>"
|
9
|
+
|
10
|
+
class <%=project.class_name%>Test < Test::Unit::TestCase
|
11
|
+
|
12
|
+
def setup
|
13
|
+
# start here
|
14
|
+
end
|
15
|
+
|
16
|
+
should "check the truth" do
|
17
|
+
assert true
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
author : John Doe
|
2
|
+
email : john.doe@se7en.com
|
3
|
+
version : 0.1.0
|
4
|
+
description : Default template for Ruby/Sinatra projects
|
5
|
+
|
6
|
+
options:
|
7
|
+
svn: Include Subversion keywords in code.
|
8
|
+
git: Enable Git flags in templates.
|
9
|
+
|
10
|
+
directories:
|
11
|
+
- test/fixtures
|
12
|
+
- lib/(project)
|
13
|
+
|
14
|
+
files:
|
15
|
+
README.mkd :
|
16
|
+
module.rb : lib/(project).rb
|
17
|
+
empty_test.rb : test/(project)_test.rb
|
18
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
|
data/test/helpers.rb
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
# This code extracted from book "Ruby Best Practices" and the code be found
|
2
2
|
# in http://github.com/sandal/rbp/blob/master/testing/test_unit_extensions.rb
|
3
3
|
|
4
|
-
|
4
|
+
TEST_HOME = File.expand_path(File.dirname(__FILE__)) unless defined? TEST_HOME
|
5
|
+
FIXTURES = File.join(TEST_HOME, "fixtures") unless defined? FIXTURES
|
6
|
+
|
7
|
+
ENV['HOME'] = "#{FIXTURES}/templates/user"
|
5
8
|
|
6
9
|
module Test::Unit
|
7
10
|
class TestCase
|
@@ -20,3 +23,35 @@ module Test::Unit
|
|
20
23
|
end
|
21
24
|
end
|
22
25
|
|
26
|
+
module Test::HTTPUtils
|
27
|
+
require "webrick"
|
28
|
+
|
29
|
+
def localhost_ip
|
30
|
+
raise "Please, set the HOSTIP variable for tests" unless ENV["HOSTIP"]
|
31
|
+
@localhost_ip ||= ENV["HOSTIP"]
|
32
|
+
end
|
33
|
+
|
34
|
+
def config
|
35
|
+
@config ||= {
|
36
|
+
:Ip => self.localhost_ip,
|
37
|
+
:Port => "9000",
|
38
|
+
:DocumentRoot => "#{FIXTURES}/templates/shared",
|
39
|
+
:Logger => WEBrick::Log::new($stderr.reopen("/dev/null"), 7)
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
def webrick(&block)
|
44
|
+
@pid = fork do
|
45
|
+
server = WEBrick::HTTPServer.new(self.config)
|
46
|
+
thread = Thread.new { server.start }
|
47
|
+
trap "INT" do
|
48
|
+
server.shutdown
|
49
|
+
end
|
50
|
+
thread.join
|
51
|
+
end
|
52
|
+
yield
|
53
|
+
ensure
|
54
|
+
system "kill -INT #{@pid}" if @pid
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
data/test/spec_test.rb
CHANGED
@@ -24,7 +24,7 @@ class SpecTest < Test::Unit::TestCase
|
|
24
24
|
"module.rb" => "lib/(project).rb",
|
25
25
|
"empty_test.rb" => "test/(project)_test.rb"
|
26
26
|
}
|
27
|
-
specfile = "#{FIXTURES}/templates/shared/ruby/default/specfile"
|
27
|
+
specfile = "#{FIXTURES}/templates/shared/templates/ruby/default/specfile"
|
28
28
|
@spec = Prigner::Spec.load(specfile)
|
29
29
|
end
|
30
30
|
|
data/test/template_test.rb
CHANGED
@@ -2,11 +2,10 @@ require "test/unit"
|
|
2
2
|
require "test/helpers"
|
3
3
|
require "lib/prigner"
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
end
|
5
|
+
|
6
|
+
def Prigner.shared_path
|
7
|
+
[ "#{ENV['HOME']}/.prigner/templates",
|
8
|
+
"#{FIXTURES}/templates/shared/templates" ]
|
10
9
|
end
|
11
10
|
|
12
11
|
class TemplateTest < Test::Unit::TestCase
|
@@ -16,7 +15,7 @@ class TemplateTest < Test::Unit::TestCase
|
|
16
15
|
:svn => "Include Subversion keywords in code.",
|
17
16
|
:git => "Enable Git flags in templates."
|
18
17
|
}
|
19
|
-
@path = "#{FIXTURES}/templates/shared/ruby/default"
|
18
|
+
@path = "#{FIXTURES}/templates/shared/templates/ruby/default"
|
20
19
|
@project_path = "#{FIXTURES}/project/foo"
|
21
20
|
@template = Prigner::Template.new(@path)
|
22
21
|
end
|
@@ -50,7 +49,6 @@ class TemplateTest < Test::Unit::TestCase
|
|
50
49
|
end
|
51
50
|
|
52
51
|
should "load a template looking home user directory" do
|
53
|
-
ENV['HOME'] = "#{FIXTURES}/templates/user"
|
54
52
|
template = Prigner::Template.load(:ruby, :program)
|
55
53
|
assert_equal "ruby", template.namespace
|
56
54
|
assert_equal "program", template.name
|
@@ -62,13 +60,13 @@ class TemplateTest < Test::Unit::TestCase
|
|
62
60
|
end
|
63
61
|
|
64
62
|
should "list all template paths from shared path" do
|
65
|
-
assert_equal
|
63
|
+
assert_equal 7, Prigner::Template.all_template_paths.size
|
66
64
|
end
|
67
65
|
|
68
66
|
should "list all templates grouped by namespace" do
|
69
67
|
assert_equal 3, Prigner::Template.all.keys.size
|
70
68
|
assert_equal 1, Prigner::Template.all["bash"].size
|
71
|
-
assert_equal
|
69
|
+
assert_equal 3, Prigner::Template.all["ruby"].size
|
72
70
|
assert_equal 3, Prigner::Template.all["vim"].size
|
73
71
|
end
|
74
72
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prigner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Hallison Batista
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-10-
|
18
|
+
date: 2010-10-21 00:00:00 -04:00
|
19
19
|
default_executable: prign
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -26,13 +26,13 @@ executables:
|
|
26
26
|
extensions: []
|
27
27
|
|
28
28
|
extra_rdoc_files:
|
29
|
-
- README.
|
29
|
+
- README.rdoc
|
30
30
|
- COPYING
|
31
31
|
- CHANGELOG
|
32
32
|
files:
|
33
33
|
- CHANGELOG
|
34
34
|
- COPYING
|
35
|
-
- README.
|
35
|
+
- README.rdoc
|
36
36
|
- Rakefile
|
37
37
|
- bin/prign
|
38
38
|
- lib/prigner.rb
|
@@ -61,21 +61,27 @@ files:
|
|
61
61
|
- share/templates/ruby/gem/specfile
|
62
62
|
- test/builder_test.rb
|
63
63
|
- test/fixtures/model.rb.erb
|
64
|
-
- test/fixtures/templates/shared/ruby/default/README.mkd
|
65
|
-
- test/fixtures/templates/shared/ruby/default/models/README.mkd
|
66
|
-
- test/fixtures/templates/shared/ruby/default/models/Rakefile
|
67
|
-
- test/fixtures/templates/shared/ruby/default/models/empty_test.rb
|
68
|
-
- test/fixtures/templates/shared/ruby/default/models/module.rb
|
69
|
-
- test/fixtures/templates/shared/ruby/default/specfile
|
70
|
-
- test/fixtures/templates/
|
71
|
-
- test/fixtures/templates/
|
72
|
-
- test/fixtures/templates/
|
73
|
-
- test/fixtures/templates/
|
74
|
-
- test/fixtures/templates/
|
75
|
-
- test/fixtures/templates/user/
|
76
|
-
- test/fixtures/templates/user/
|
77
|
-
- test/fixtures/templates/user/
|
78
|
-
- test/fixtures/templates/user/
|
64
|
+
- test/fixtures/templates/shared/templates/ruby/default/README.mkd
|
65
|
+
- test/fixtures/templates/shared/templates/ruby/default/models/README.mkd
|
66
|
+
- test/fixtures/templates/shared/templates/ruby/default/models/Rakefile
|
67
|
+
- test/fixtures/templates/shared/templates/ruby/default/models/empty_test.rb
|
68
|
+
- test/fixtures/templates/shared/templates/ruby/default/models/module.rb
|
69
|
+
- test/fixtures/templates/shared/templates/ruby/default/specfile
|
70
|
+
- test/fixtures/templates/shared/templates/ruby/sinatra/models/README.mkd
|
71
|
+
- test/fixtures/templates/shared/templates/ruby/sinatra/models/Rakefile
|
72
|
+
- test/fixtures/templates/shared/templates/ruby/sinatra/models/empty_test.rb
|
73
|
+
- test/fixtures/templates/shared/templates/ruby/sinatra/models/module.rb
|
74
|
+
- test/fixtures/templates/shared/templates/ruby/sinatra/specfile
|
75
|
+
- test/fixtures/templates/user/.prigner/sources
|
76
|
+
- test/fixtures/templates/user/.prigner/templates/bash/default/specfile
|
77
|
+
- test/fixtures/templates/user/.prigner/templates/ruby/program/models/README.erb
|
78
|
+
- test/fixtures/templates/user/.prigner/templates/ruby/program/models/cli.rb.erb
|
79
|
+
- test/fixtures/templates/user/.prigner/templates/ruby/program/models/module.rb.erb
|
80
|
+
- test/fixtures/templates/user/.prigner/templates/ruby/program/models/program.rb.erb
|
81
|
+
- test/fixtures/templates/user/.prigner/templates/ruby/program/specfile
|
82
|
+
- test/fixtures/templates/user/.prigner/templates/vim/default/specfile
|
83
|
+
- test/fixtures/templates/user/.prigner/templates/vim/plugin/specfile
|
84
|
+
- test/fixtures/templates/user/.prigner/templates/vim/syntax/specfile
|
79
85
|
- test/helpers.rb
|
80
86
|
- test/model_test.rb
|
81
87
|
- test/project_test.rb
|
@@ -87,19 +93,11 @@ licenses: []
|
|
87
93
|
|
88
94
|
post_install_message: |
|
89
95
|
------------------------------------------------------------------------------
|
90
|
-
Prigner v0.1.
|
91
|
-
|
92
|
-
Thanks for use Prigner.
|
96
|
+
Prigner v0.1.1
|
93
97
|
|
94
|
-
|
98
|
+
Thanks for use Prigner. See all shared templates running:
|
95
99
|
|
96
100
|
$ prign list
|
97
|
-
|
98
|
-
See all shared templates. If you want customize a template, just run:
|
99
|
-
|
100
|
-
$ prign copy <namespace>[:template]
|
101
|
-
|
102
|
-
Please, feedback in http://github.com/codigorama/prigner/issues.
|
103
101
|
------------------------------------------------------------------------------
|
104
102
|
|
105
103
|
rdoc_options:
|
@@ -110,7 +108,7 @@ rdoc_options:
|
|
110
108
|
- --main
|
111
109
|
- Prigner
|
112
110
|
- --title
|
113
|
-
- Prigner v0.1.
|
111
|
+
- Prigner v0.1.1 API Documentation
|
114
112
|
require_paths:
|
115
113
|
- lib
|
116
114
|
required_ruby_version: !ruby/object:Gem::Requirement
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
/data/test/fixtures/templates/user/{ruby → .prigner/templates/ruby}/program/models/README.erb
RENAMED
File without changes
|
/data/test/fixtures/templates/user/{ruby → .prigner/templates/ruby}/program/models/cli.rb.erb
RENAMED
File without changes
|
/data/test/fixtures/templates/user/{ruby → .prigner/templates/ruby}/program/models/module.rb.erb
RENAMED
File without changes
|
/data/test/fixtures/templates/user/{ruby → .prigner/templates/ruby}/program/models/program.rb.erb
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|