summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDickson S. Guedes2011-05-12 22:45:12 +0000
committerDickson S. Guedes2011-05-12 22:45:12 +0000
commit9d5561effe59723a9509e85cd69c57e78ef2a772 (patch)
treeac9903b48d501e992a2e66771e3eb394f3031533
parent7875168610ed954842946128b9f23d22a8961053 (diff)
added some new options to 'skeleton'
-rw-r--r--lib/pgxn_utils/cli.rb4
-rw-r--r--lib/pgxn_utils/templates/root/META.json.tt17
-rw-r--r--spec/cli_spec.rb8
3 files changed, 18 insertions, 11 deletions
diff --git a/lib/pgxn_utils/cli.rb b/lib/pgxn_utils/cli.rb
index 2afa018..44c07e1 100644
--- a/lib/pgxn_utils/cli.rb
+++ b/lib/pgxn_utils/cli.rb
@@ -1,7 +1,7 @@
module PgxnUtils
class CLI < Thor
attr_accessor :extension_name, :target, :maintainer, :maintainer_mail
- attr_accessor :abstract, :description, :tags
+ attr_accessor :abstract, :description, :version, :tags
attr_accessor :license, :release_status, :generated_by
include Thor::Actions
@@ -19,7 +19,7 @@ module PgxnUtils
# META optional fields
method_option :description, :aliases => "-d", :type => :string, :default => "A long description", :desc => "A long text that contains more information about extension"
- method_option :generated_by, :aliases => "-b", :type => :string, :default => "Generator's name", :desc => "Name of extension's generator"
+ method_option :generated_by, :aliases => "-b", :type => :string, :desc => "Name of extension's generator"
method_option :tags, :aliases => "-t", :type => :array, :desc => "Defines extension's tags"
method_option :release_status, :aliases => "-r", :type => :string, :default => "unstable", :desc => "Initial extension's release status"
diff --git a/lib/pgxn_utils/templates/root/META.json.tt b/lib/pgxn_utils/templates/root/META.json.tt
index cc21246..3e1d4e9 100644
--- a/lib/pgxn_utils/templates/root/META.json.tt
+++ b/lib/pgxn_utils/templates/root/META.json.tt
@@ -2,21 +2,24 @@
"name": "<%= extension_name %>",
"abstract": "<%= abstract %>",
"description": "<%= description %>",
- "version": "1.0.0",
+ "version": "<%= version %>",
"maintainer": "<%= maintainer %> <<%= maintainer_mail %>>",
- "license": "postgresql",
+ "license": "<%= license %>",
"provides": {
"<%= extension_name %>": {
"abstract": "<%= abstract %>",
"file": "sql/<%= extension_name %>.sql",
"docfile": "doc/<%= extension_name %>.md",
- "version": "1.0.0"
+ "version": "<%= version %>"
}
},
- "generated_by": "<%= maintainer %>",
- <% if tags %>
- "tags": [ <%= tags.collect { |t| %Q|"#{t}"| }.join(",") %> ],
- <% end %>
+ "release_status": "<%= release_status %>",
+<% if generated_by %>
+ "generated_by": "<%= generated_by %>",
+<% end %>
+<% if tags %>
+ "tags": [ <%= tags.collect { |t| %Q|"#{t}"| }.join(",") %> ],
+<% end %>
"meta-spec": {
"version": "1.0.0",
"url": "http://pgxn.org/meta/spec.txt"
diff --git a/spec/cli_spec.rb b/spec/cli_spec.rb
index 9a28ca8..2005756 100644
--- a/spec/cli_spec.rb
+++ b/spec/cli_spec.rb
@@ -31,17 +31,21 @@ describe PgxnUtils::CLI do
expected_abstract = "Short description"
expected_description = "Very Long description for my cool extension"
expected_tags = "one two tree"
+ expected_version = "1.0.0"
- skeleton expected_extension, "-p /tmp -m #{expected_name} -e #{expected_mail} -t #{expected_tags} -a '#{expected_abstract}' -d '#{expected_description}'"
+ skeleton expected_extension, "-p /tmp -m #{expected_name} -e #{expected_mail} -t #{expected_tags} -a '#{expected_abstract}' -d '#{expected_description}' -v #{expected_version}"
meta = File.read("/tmp/#{expected_extension}/META.json")
meta.should match(/"name": "#{expected_extension}"/)
meta.should match(/"abstract": "#{expected_abstract}"/)
meta.should match(/"description": "#{expected_description}"/)
+ meta.should match(/"version": "#{expected_version}"/)
+ meta.should match(/"license": "postgresql"/)
+ meta.should match(/"release_status": "unstable"/)
meta.should match(/"#{expected_name} <#{expected_mail}>"/)
meta.should match(/"file": "sql\/#{expected_extension}.sql"/)
meta.should match(/"docfile": "doc\/#{expected_extension}.md"/)
- meta.should match(/"generated_by": "#{expected_name}"/)
+ meta.should_not match(/"generated_by":/)
meta.should match(/"tags": \[ "one","two","tree" \],/)
makefile = File.read("/tmp/#{expected_extension}/Makefile")