prigner 0.3.0 → 0.3.1

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/CHANGELOG CHANGED
@@ -1,8 +1,18 @@
1
- = Prigner v0.3.0 (2010-11-25) - Changelog
1
+ = Prigner v0.3.1 (2010-11-26) - Changelog
2
+
3
+ == 2010-11-26
4
+
5
+ * Releasing of version 0.3.1.
6
+ * Improvements in listing of the templates.
7
+ * Details of templates can be showed in list.
8
+ * The list show if user has customized templates.
9
+ * Small improvements in code.
10
+ * Fixes in Ruby/Sinatra template.
2
11
 
3
12
  == 2010-11-25
4
13
 
5
- * * Adding of command to copy templates.
14
+ * Releasing of version 0.3.0.
15
+ * Adding of command to copy templates.
6
16
  * Fixes in the templates that includes test.
7
17
 
8
18
  == 2010-11-19
@@ -0,0 +1,10 @@
1
+ = Prigner v0.3.0
2
+
3
+ Bug fixes and new commands for line interface.
4
+
5
+ * Fixes in the shared templates that includes test.
6
+ * Adding of command to copy templates to user home directory.
7
+ * Small updates in documentation.
8
+
9
+ For more informations about this release, please see the CHANGELOG file.
10
+
@@ -0,0 +1,11 @@
1
+ = Prigner v0.3.1
2
+
3
+ Improvements in command line interface.
4
+
5
+ * Details of templates can be showed in list.
6
+ * The list show if user has customized templates.
7
+ * Small improvements in code.
8
+ * Fixes in Ruby/Sinatra template.
9
+
10
+ For more informations about this release, please see the CHANGELOG file.
11
+
data/lib/prigner.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  #@ ---
2
2
  #@ :timestamp: 2009-07-16 14:05:16 -04:00
3
- #@ :date: 2010-11-25
4
- #@ :tag: 0.3.0
3
+ #@ :date: 2010-11-26
4
+ #@ :tag: 0.3.1
5
5
 
6
6
  # ---
7
7
  # encoding: UTF-8
data/lib/prigner/cli.rb CHANGED
@@ -19,7 +19,7 @@ module Prigner::CLI
19
19
  # List all templates as commands.
20
20
  def self.templates
21
21
  Prigner::Template.all.map do |namespace, templates|
22
- templates.map{ |template| template.mask }
22
+ templates.map{ |template, custom| template.mask }
23
23
  end.flatten
24
24
  end
25
25
 
@@ -27,7 +27,16 @@ begin
27
27
 
28
28
  arguments.separator "Options:"
29
29
 
30
- arguments.on("-f", "--force", TrueClass, "Force copy.") { noforce = false }
30
+ arguments.on("-h", "--help", nil, "Show this message.") do
31
+ puts arguments
32
+ exit 0
33
+ end
34
+
35
+ arguments.on("-f", "--force", TrueClass, "Force copy.") do
36
+ noforce = false
37
+ end
38
+
39
+ arguments.separator ""
31
40
 
32
41
  unless ARGV.empty?
33
42
  arguments.parse!
@@ -5,48 +5,97 @@ require "prigner"
5
5
 
6
6
  program = :prign
7
7
  command = File.basename(__FILE__, ".rb")
8
- @options = {}
9
8
 
10
- def templates_by_namespace(indent)
11
- templates = Prigner::Template.all
9
+ def templates_by_namespace(options = { :indent => nil, :details => false })
10
+ puts "#{Prigner::Version}"
11
+ puts "\nThe templates tagged with '*' are customized by user."
12
12
  message = []
13
- templates.map do |namespace, list|
14
- message << "* #{namespace}"
15
- list.map do |template|
16
- message << ("#{indent}> %-16s %s" % [template.name, template.spec.description])
13
+ Prigner::Template.all.map do |namespace, list|
14
+ message << "#{namespace}:"
15
+ list.map do |template, custom|
16
+ formatting = "#{options[:indent]}#{custom ? :* : :-} %s (%s)"
17
+ attributes = [template.name, template.spec.version]
18
+ if options[:details]
19
+ formatting = "#{options[:indent]}#{custom ? :* : :-} %s (%s)\n" +
20
+ "#{options[:indent]} %s\n" +
21
+ "#{options[:indent]} Written by %s <%s>\n"
22
+ attributes = [
23
+ template.name,
24
+ template.spec.version,
25
+ template.spec.description,
26
+ template.spec.author,
27
+ template.spec.email
28
+ ]
29
+ end
30
+ message << (formatting % attributes)
17
31
  end
18
32
  end
19
- message.join("\n")
20
- end
21
-
22
- def show(message)
23
- puts "#{Prigner::Version}"
24
- puts "\n#{message}"
33
+ puts "\n#{message.join("\n")}"
25
34
  end
26
35
 
27
36
  begin
37
+ ARGV.options do |arguments|
38
+
39
+ arguments.summary_indent = " "
40
+ arguments.summary_width = 24
41
+ arguments.banner = <<-end_banner.gsub /^[ ]{4}/, ''
42
+ #{Prigner::Version}
28
43
 
29
- ARGV.options do |arguments|
44
+ List all templates.
30
45
 
31
- arguments.summary_indent = " "
32
- arguments.summary_width = 24
33
- arguments.banner = <<-end_banner.gsub /^[ ]{4}/, ''
34
- #{Prigner::Version}
46
+ Usage:
47
+ #{program} #{command} <namespace>[:template] [options]
48
+ #{program} #{command} [options]
35
49
 
36
- List all templates.
50
+ end_banner
37
51
 
38
- Usage:
39
- #{program} #{command}
52
+ arguments.separator "Options:"
53
+
54
+ options = {
55
+ :indent => arguments.summary_indent,
56
+ :details => false
57
+ }
58
+
59
+ arguments.on("-h", "--help", nil, "Show this message.") do
60
+ puts arguments
61
+ exit 0
62
+ end
63
+
64
+ arguments.on("-d", "--details", nil, "Show template details.") do
65
+ options[:details] = true
66
+ end
40
67
 
41
- end_banner
68
+ arguments.separator ""
42
69
 
43
- if ARGV.empty?
44
- show(templates_by_namespace(arguments.summary_indent))
45
- exit 0
46
- else
47
70
  arguments.parse!
71
+
72
+ unless ARGV.empty?
73
+ name = ARGV.shift
74
+
75
+ if template = Prigner::Template.load(*name.split(":"))
76
+ arguments.banner = <<-end_banner.gsub /^[ ]{10}/, ''
77
+ #{Prigner::Version}
78
+
79
+ Template:
80
+ #{template.mask} v#{template.spec.version}
81
+
82
+ #{template.spec.description}
83
+
84
+ Written by #{template.spec.author} <#{template.spec.email}>.
85
+
86
+ Usage:
87
+ #{program} #{command} #{template.mask} <path> [options]
88
+
89
+ end_banner
90
+ else
91
+ raise RuntimeError, "unable to load template '#{name}'"
92
+ end
93
+ else
94
+ templates_by_namespace(options)
95
+ exit 0
96
+ end
97
+
48
98
  end
49
- end
50
99
 
51
100
  rescue => error
52
101
  puts "\n#{program}: #{command}: #{error.message} (#{error.class})"
@@ -86,8 +86,9 @@ class Prigner::Template
86
86
  all_template_paths.map do |path|
87
87
  new(path)
88
88
  end.inject({}) do |group, template|
89
+ customized = template.path.to_s =~ %r/#{Prigner.user_home_basedir}/
89
90
  group[template.namespace] ||= []
90
- group[template.namespace] << template
91
+ group[template.namespace] << [ template, customized ]
91
92
  group
92
93
  end
93
94
  end
data/prigner.gemspec CHANGED
@@ -3,7 +3,7 @@ Gem::Specification.new do |spec|
3
3
 
4
4
  #about
5
5
  spec.name = "prigner"
6
- spec.summary = "Project designer."
6
+ spec.summary = "Prigner is a Project Design Kit (a.k.a. project builder)."
7
7
  spec.description = "Prigner is a Project Design Kit (a.k.a. project builder). That is, it is a tool which builds your projects using templates."
8
8
  spec.authors = ["Hallison Batista"]
9
9
  spec.email = "hallison@codigorama.com"
@@ -14,8 +14,8 @@ Gem::Specification.new do |spec|
14
14
  #
15
15
 
16
16
  #version
17
- spec.version = "0.3.0"
18
- spec.date = "2010-11-25"
17
+ spec.version = "0.3.1"
18
+ spec.date = "2010-11-26"
19
19
  #
20
20
 
21
21
  #dependencies
@@ -34,6 +34,8 @@ Gem::Specification.new do |spec|
34
34
  "doc/releases/v0.2.0.rdoc",
35
35
  "doc/releases/v0.2.1.rdoc",
36
36
  "doc/releases/v0.2.2.rdoc",
37
+ "doc/releases/v0.3.0.rdoc",
38
+ "doc/releases/v0.3.1.rdoc",
37
39
  "doc/templates.rdoc",
38
40
  "lib/prigner.rb",
39
41
  "lib/prigner/builder.rb",
@@ -28,7 +28,7 @@ end
28
28
  def tag
29
29
  git(:tag).split("\n").last
30
30
  end
31
-
31
+ <%if option.gem.enabled%>
32
32
  def specfile
33
33
  @specfile ||= Pathname.new("<%=project.name%>.gemspec")
34
34
  end
@@ -36,7 +36,7 @@ end
36
36
  def gemspec
37
37
  @gemspec ||= eval(specfile.read)
38
38
  end
39
-
39
+ <%end%>
40
40
  # Test
41
41
  # =============================================================================
42
42
 
@@ -45,14 +45,14 @@ Rake::TestTask.new do |test|
45
45
  test.test_files = FileList["test/*_test.rb"]
46
46
  test.verbose = true
47
47
  end
48
-
48
+ <%if option.gem.enabled%>
49
49
  # Packaging
50
50
  # =============================================================================
51
51
 
52
52
  Rake::GemPackageTask.new gemspec do |spec|
53
53
  spec.need_tar = true
54
54
  end
55
-
55
+ <%end%>
56
56
  # Documentation
57
57
  # =============================================================================
58
58
 
@@ -96,6 +96,7 @@ namespace :version do
96
96
  puts version.to_hash.to_yaml
97
97
  end
98
98
  end
99
+ <%if option.gem.enabled%>
99
100
  #
100
101
  # Packaging
101
102
  # =============================================================================
@@ -138,7 +139,7 @@ desc "Uninstall gem package #{gemspec.file_name}."
138
139
  task :uninstall do
139
140
  sh "gem uninstall #{gemspec.name} --version #{gemspec.version}"
140
141
  end
141
-
142
+ <%end%>
142
143
  # Default
143
144
  # =============================================================================
144
145
 
@@ -15,10 +15,10 @@ module <%=project.upper_camel_case_namespace%>
15
15
  # Standard library requirements
16
16
  require "pathname"
17
17
  require "yaml"
18
-
18
+ <%if option.mvc.enabled%>
19
19
  # Internal requirements
20
20
  require "<%=project.name%>/config"
21
-
21
+ <%end%>
22
22
  # Return the current version.
23
23
  def self.version
24
24
  @version ||= Version.current
@@ -3,7 +3,7 @@ author:
3
3
  email:
4
4
  hallison@codigorama.com
5
5
  version:
6
- 0.1.0
6
+ 0.1.1
7
7
  description:
8
8
  Ruby/Sinatra application template.
9
9
 
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: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 0
10
- version: 0.3.0
9
+ - 1
10
+ version: 0.3.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-11-25 00:00:00 -04:00
18
+ date: 2010-11-26 00:00:00 -04:00
19
19
  default_executable: prign
20
20
  dependencies: []
21
21
 
@@ -40,6 +40,8 @@ files:
40
40
  - doc/releases/v0.2.0.rdoc
41
41
  - doc/releases/v0.2.1.rdoc
42
42
  - doc/releases/v0.2.2.rdoc
43
+ - doc/releases/v0.3.0.rdoc
44
+ - doc/releases/v0.3.1.rdoc
43
45
  - doc/templates.rdoc
44
46
  - lib/prigner.rb
45
47
  - lib/prigner/builder.rb
@@ -128,7 +130,7 @@ licenses: []
128
130
 
129
131
  post_install_message: |
130
132
  ------------------------------------------------------------------------------
131
- Prigner v0.3.0
133
+ Prigner v0.3.1
132
134
 
133
135
  Thanks for use Prigner. See all shared templates running:
134
136
 
@@ -143,7 +145,7 @@ rdoc_options:
143
145
  - --main
144
146
  - Prigner
145
147
  - --title
146
- - Prigner v0.3.0 API Documentation
148
+ - Prigner v0.3.1 API Documentation
147
149
  require_paths:
148
150
  - lib
149
151
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -170,6 +172,6 @@ rubyforge_project: prigner
170
172
  rubygems_version: 1.3.7
171
173
  signing_key:
172
174
  specification_version: 3
173
- summary: Project designer.
175
+ summary: Prigner is a Project Design Kit (a.k.a. project builder).
174
176
  test_files: []
175
177