pgxn_utils 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/Gemfile +4 -0
- data/README.md +81 -0
- data/Rakefile +15 -0
- data/bin/pgxn_utils +5 -0
- data/lib/pgxn_utils/cli.rb +56 -0
- data/lib/pgxn_utils/templates/root/%extension_name%.control.tt +5 -0
- data/lib/pgxn_utils/templates/root/META.json.tt +27 -0
- data/lib/pgxn_utils/templates/root/Makefile.tt +24 -0
- data/lib/pgxn_utils/templates/root/README.md.tt +80 -0
- data/lib/pgxn_utils/templates/root/doc/%extension_name%.md.tt +33 -0
- data/lib/pgxn_utils/templates/root/sql/%extension_name%.sql.tt +6 -0
- data/lib/pgxn_utils/templates/root/sql/uninstall_%extension_name%.sql +0 -0
- data/lib/pgxn_utils/templates/root/test/expected/base.out +2 -0
- data/lib/pgxn_utils/templates/root/test/sql/base.sql.tt +8 -0
- data/lib/pgxn_utils/version.rb +3 -0
- data/lib/pgxn_utils.rb +5 -0
- data/pgxn_utils.gemspec +38 -0
- data/spec/cli_spec.rb +93 -0
- data/spec/spec_helper.rb +26 -0
- metadata +97 -0
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
pgxn utils
|
2
|
+
==========
|
3
|
+
|
4
|
+
What is?
|
5
|
+
--------
|
6
|
+
|
7
|
+
This is a set of task that aims to help PostgreSQL developers to focus more on the problem that they wants to solve than in the all structure and files and control files need to PGXS to build the extension.
|
8
|
+
|
9
|
+
It's a WIP but very functional. Please use it and help me improve it.
|
10
|
+
|
11
|
+
How to install it?
|
12
|
+
------------------
|
13
|
+
|
14
|
+
gem install pgxn_utils
|
15
|
+
|
16
|
+
How it works?
|
17
|
+
-------------
|
18
|
+
|
19
|
+
$ pgxn_utils help skeleton
|
20
|
+
Usage:
|
21
|
+
pgxn_utils skeleton extension_name
|
22
|
+
|
23
|
+
Options:
|
24
|
+
-p, [--target=TARGET] # Define the target directory
|
25
|
+
# Default: .
|
26
|
+
-m, [--maintainer=MAINTAINER] # Maintainer's name
|
27
|
+
# Default: The maintainer's name
|
28
|
+
-e, [--maintainer-mail=MAINTAINER_MAIL] # Maintainer's mail
|
29
|
+
# Default: maintainer@email.here
|
30
|
+
-a, [--abstract=ABSTRACT] # Defines a short description to abstract
|
31
|
+
# Default: A short description
|
32
|
+
-l, [--license=LICENSE] # The extension license.
|
33
|
+
# Default: postgresql
|
34
|
+
-v, [--version=VERSION] # Initial version
|
35
|
+
# Default: 0.0.1
|
36
|
+
-d, [--description=DESCRIPTION] # A long text that contains more information about extension
|
37
|
+
# Default: A long description
|
38
|
+
-b, [--generated-by=GENERATED_BY] # Name of extension's generator
|
39
|
+
-t, [--tags=one two three] # Defines extension's tags
|
40
|
+
-r, [--release-status=RELEASE_STATUS] # Initial extension's release status
|
41
|
+
# Default: unstable
|
42
|
+
|
43
|
+
See in action...
|
44
|
+
|
45
|
+
$ pgxn_utils skeleton my_cool_extension
|
46
|
+
create my_cool_extension
|
47
|
+
create my_cool_extension/my_cool_extension.control
|
48
|
+
create my_cool_extension/META.json
|
49
|
+
create my_cool_extension/Makefile
|
50
|
+
create my_cool_extension/README.md
|
51
|
+
create my_cool_extension/doc/my_cool_extension.md
|
52
|
+
create my_cool_extension/sql/my_cool_extension.sql
|
53
|
+
create my_cool_extension/sql/uninstall_my_cool_extension.sql
|
54
|
+
create my_cool_extension/test/expected/base.out
|
55
|
+
create my_cool_extension/test/sql/base.sql
|
56
|
+
|
57
|
+
Thats it! Start coding! ":)
|
58
|
+
|
59
|
+
Copyright and License
|
60
|
+
---------------------
|
61
|
+
|
62
|
+
Copyright (c) 2011 Dickson S. Guedes.
|
63
|
+
|
64
|
+
This module is free software; you can redistribute it and/or modify it under
|
65
|
+
the [PostgreSQL License](http://www.opensource.org/licenses/postgresql).
|
66
|
+
|
67
|
+
Permission to use, copy, modify, and distribute this software and its
|
68
|
+
documentation for any purpose, without fee, and without a written agreement is
|
69
|
+
hereby granted, provided that the above copyright notice and this paragraph
|
70
|
+
and the following two paragraphs appear in all copies.
|
71
|
+
|
72
|
+
In no event shall Dickson S. Guedes be liable to any party for direct,
|
73
|
+
indirect, special, incidental, or consequential damages, including lost
|
74
|
+
profits, arising out of the use of this software and its documentation, even
|
75
|
+
if Dickson S. Guedes has been advised of the possibility of such damage.
|
76
|
+
|
77
|
+
Dickson S. Guedes specifically disclaims any warranties, including, but not
|
78
|
+
limited to, the implied warranties of merchantability and fitness for a
|
79
|
+
particular purpose. The software provided hereunder is on an "as is" basis,
|
80
|
+
and Dickson S. Guedes has no obligations to provide maintenance, support,
|
81
|
+
updates, enhancements, or modifications.
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
3
|
+
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
|
6
|
+
desc "Run RSpec"
|
7
|
+
RSpec::Core::RakeTask.new do |t|
|
8
|
+
t.verbose = false
|
9
|
+
#t.rspec_opts = %w(-fs --color)
|
10
|
+
t.rspec_opts = %w(--color)
|
11
|
+
#dont show warnings here yet
|
12
|
+
#t.ruby_opts = %w(-w)
|
13
|
+
end
|
14
|
+
|
15
|
+
task :default => :spec
|
data/bin/pgxn_utils
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
module PgxnUtils
|
2
|
+
class CLI < Thor
|
3
|
+
attr_accessor :extension_name, :target, :maintainer, :maintainer_mail
|
4
|
+
attr_accessor :abstract, :description, :version, :tags
|
5
|
+
attr_accessor :license, :release_status, :generated_by
|
6
|
+
|
7
|
+
include Thor::Actions
|
8
|
+
|
9
|
+
desc "skeleton extension_name", "Creates an extension skeleton in current directory."
|
10
|
+
|
11
|
+
method_option :target, :aliases => "-p", :default => ".", :desc => "Define the target directory"
|
12
|
+
|
13
|
+
# META required fields
|
14
|
+
method_option :maintainer, :aliases => "-m", :type => :string, :default => "The maintainer's name", :desc => "Maintainer's name"
|
15
|
+
method_option :maintainer_mail, :aliases => "-e", :type => :string, :default => "maintainer@email.here", :desc => "Maintainer's mail"
|
16
|
+
method_option :abstract, :aliases => "-a", :type => :string, :default => "A short description", :desc => "Defines a short description to abstract"
|
17
|
+
method_option :license, :aliases => "-l", :type => :string, :default => "postgresql", :desc => "The extension license."
|
18
|
+
method_option :version, :aliases => "-v", :type => :string, :default => "0.0.1", :desc => "Initial version"
|
19
|
+
|
20
|
+
# META optional fields
|
21
|
+
method_option :description, :aliases => "-d", :type => :string, :default => "A long description", :desc => "A long text that contains more information about extension"
|
22
|
+
method_option :generated_by, :aliases => "-b", :type => :string, :desc => "Name of extension's generator"
|
23
|
+
method_option :tags, :aliases => "-t", :type => :array, :desc => "Defines extension's tags"
|
24
|
+
method_option :release_status, :aliases => "-r", :type => :string, :default => "unstable", :desc => "Initial extension's release status"
|
25
|
+
|
26
|
+
def skeleton(extension_name)
|
27
|
+
self.set_accessors extension_name
|
28
|
+
|
29
|
+
directory "root", extension_name
|
30
|
+
end
|
31
|
+
|
32
|
+
no_tasks do
|
33
|
+
def set_accessors(extension_name="your_extension_name")
|
34
|
+
self.extension_name = extension_name
|
35
|
+
|
36
|
+
self.target = options[:target]
|
37
|
+
self.maintainer = options[:maintainer]
|
38
|
+
self.maintainer_mail = options[:maintainer_mail]
|
39
|
+
self.abstract = options[:abstract]
|
40
|
+
self.license = options[:license]
|
41
|
+
self.version = options[:version]
|
42
|
+
|
43
|
+
self.description = options[:description]
|
44
|
+
self.generated_by = options[:generated_by]
|
45
|
+
self.tags = options[:tags]
|
46
|
+
self.release_status = options[:release_status]
|
47
|
+
|
48
|
+
self.destination_root = target
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.source_root
|
53
|
+
@_source_root ||= File.expand_path('../templates', __FILE__)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
{
|
2
|
+
"name": "<%= extension_name %>",
|
3
|
+
"abstract": "<%= abstract %>",
|
4
|
+
"description": "<%= description %>",
|
5
|
+
"version": "<%= version %>",
|
6
|
+
"maintainer": "<%= maintainer %> <<%= maintainer_mail %>>",
|
7
|
+
"license": "<%= license %>",
|
8
|
+
"provides": {
|
9
|
+
"<%= extension_name %>": {
|
10
|
+
"abstract": "<%= abstract %>",
|
11
|
+
"file": "sql/<%= extension_name %>.sql",
|
12
|
+
"docfile": "doc/<%= extension_name %>.md",
|
13
|
+
"version": "<%= version %>"
|
14
|
+
}
|
15
|
+
},
|
16
|
+
"release_status": "<%= release_status %>",
|
17
|
+
<% if generated_by %>
|
18
|
+
"generated_by": "<%= generated_by %>",
|
19
|
+
<% end %>
|
20
|
+
<% if tags %>
|
21
|
+
"tags": [ <%= tags.collect { |t| %Q|"#{t}"| }.join(",") %> ],
|
22
|
+
<% end %>
|
23
|
+
"meta-spec": {
|
24
|
+
"version": "1.0.0",
|
25
|
+
"url": "http://pgxn.org/meta/spec.txt"
|
26
|
+
}
|
27
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
EXTENSION = <%= extension_name %>
|
2
|
+
EXTVERSION = $(shell grep default_version $(EXTENSION).control | sed -e "s/default_version[[:space:]]*=[[:space:]]*'\([^']*\)'/\1/")
|
3
|
+
|
4
|
+
DATA = $(filter-out $(wildcard sql/*--*.sql),$(wildcard sql/*.sql))
|
5
|
+
DOCS = $(wildcard doc/*.txt)
|
6
|
+
TESTS = $(wildcard test/sql/*.sql)
|
7
|
+
REGRESS = $(patsubst test/sql/%.sql,%,$(TESTS))
|
8
|
+
REGRESS_OPTS = --inputdir=test --load-language=plpgsql
|
9
|
+
MODULES = $(patsubst %.c,%,$(wildcard src/*.c))
|
10
|
+
PG_CONFIG = pg_config
|
11
|
+
PG91 = $(shell $(PG_CONFIG) --version | grep -qE " 8\.| 9\.0" && echo no || echo yes)
|
12
|
+
|
13
|
+
ifeq ($(PG91),yes)
|
14
|
+
all: sql/$(EXTENSION)--$(EXTVERSION).sql
|
15
|
+
|
16
|
+
sql/$(EXTENSION)--$(EXTVERSION).sql: sql/$(EXTENSION).sql
|
17
|
+
cp $< $@
|
18
|
+
|
19
|
+
DATA = $(wildcard sql/*--*.sql) sql/$(EXTENSION)--$(EXTVERSION).sql
|
20
|
+
EXTRA_CLEAN = sql/$(EXTENSION)--$(EXTVERSION).sql
|
21
|
+
endif
|
22
|
+
|
23
|
+
PGXS := $(shell $(PG_CONFIG) --pgxs)
|
24
|
+
include $(PGXS)
|
@@ -0,0 +1,80 @@
|
|
1
|
+
<%= extension_name %>
|
2
|
+
<%= extension_name.gsub(/./,"=") %>
|
3
|
+
|
4
|
+
<%= description %>
|
5
|
+
|
6
|
+
To build it, just do this:
|
7
|
+
|
8
|
+
make
|
9
|
+
make installcheck
|
10
|
+
make install
|
11
|
+
|
12
|
+
If you encounter an error such as:
|
13
|
+
|
14
|
+
"Makefile", line 8: Need an operator
|
15
|
+
|
16
|
+
You need to use GNU make, which may well be installed on your system as
|
17
|
+
`gmake`:
|
18
|
+
|
19
|
+
gmake
|
20
|
+
gmake install
|
21
|
+
gmake installcheck
|
22
|
+
|
23
|
+
If you encounter an error such as:
|
24
|
+
|
25
|
+
make: pg_config: Command not found
|
26
|
+
|
27
|
+
Be sure that you have `pg_config` installed and in your path. If you used a
|
28
|
+
package management system such as RPM to install PostgreSQL, be sure that the
|
29
|
+
`-devel` package is also installed. If necessary tell the build process where
|
30
|
+
to find it:
|
31
|
+
|
32
|
+
env PG_CONFIG=/path/to/pg_config make && make installcheck && make install
|
33
|
+
|
34
|
+
And finally, if all that fails (and if you're on PostgreSQL 8.1 or lower, it
|
35
|
+
likely will), copy the entire distribution directory to the `contrib/`
|
36
|
+
subdirectory of the PostgreSQL source tree and try it there without
|
37
|
+
`pg_config`:
|
38
|
+
|
39
|
+
env NO_PGXS=1 make && make installcheck && make install
|
40
|
+
|
41
|
+
If you encounter an error such as:
|
42
|
+
|
43
|
+
ERROR: must be owner of database regression
|
44
|
+
|
45
|
+
You need to run the test suite using a super user, such as the default
|
46
|
+
"postgres" super user:
|
47
|
+
|
48
|
+
make installcheck PGUSER=postgres
|
49
|
+
|
50
|
+
Once <%= extension_name %> is installed, you can add it to a database. If you're running
|
51
|
+
PostgreSQL 9.1.0 or greater, it's a simple as connecting to a database as a
|
52
|
+
super user and running:
|
53
|
+
|
54
|
+
CREATE EXTENSION <%= extension_name %>;
|
55
|
+
|
56
|
+
If you've upgraded your cluster to PostgreSQL 9.1 and already had <%= extension_name %>
|
57
|
+
installed, you can upgrade it to a properly packaged extension with:
|
58
|
+
|
59
|
+
CREATE EXTENSION <%= extension_name %> FROM unpackaged;
|
60
|
+
|
61
|
+
For versions of PostgreSQL less than 9.1.0, you'll need to run the
|
62
|
+
installation script:
|
63
|
+
|
64
|
+
psql -d mydb -f /path/to/pgsql/share/contrib/<%= extension_name %>.sql
|
65
|
+
|
66
|
+
If you want to install <%= extension_name %> and all of its supporting objects into a specific
|
67
|
+
schema, use the `PGOPTIONS` environment variable to specify the schema, like
|
68
|
+
so:
|
69
|
+
|
70
|
+
PGOPTIONS=--search_path=extensions psql -d mydb -f <%= extension_name %>.sql
|
71
|
+
|
72
|
+
Dependencies
|
73
|
+
------------
|
74
|
+
The `<%= extension_name %>` data type has no dependencies other than PostgreSQL.
|
75
|
+
|
76
|
+
Copyright and License
|
77
|
+
---------------------
|
78
|
+
|
79
|
+
Copyright (c) <%= Time.now.strftime("%Y") %> <%= maintainer %>.
|
80
|
+
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<%= extension_name %>
|
2
|
+
<%= extension_name.gsub(/./,"=") %>
|
3
|
+
|
4
|
+
Synopsis
|
5
|
+
--------
|
6
|
+
|
7
|
+
Show a brief synopsis of the extension.
|
8
|
+
|
9
|
+
Description
|
10
|
+
-----------
|
11
|
+
|
12
|
+
<%= description %>
|
13
|
+
|
14
|
+
Usage
|
15
|
+
-----
|
16
|
+
|
17
|
+
Show usage.
|
18
|
+
|
19
|
+
Support
|
20
|
+
-------
|
21
|
+
|
22
|
+
There is issues tracker? Github? Put this information here.
|
23
|
+
|
24
|
+
Author
|
25
|
+
------
|
26
|
+
|
27
|
+
[<%= maintainer %>]
|
28
|
+
|
29
|
+
Copyright and License
|
30
|
+
---------------------
|
31
|
+
|
32
|
+
Copyright (c) <%= Time.now.strftime("%Y") %> <%= maintainer %>.
|
33
|
+
|
File without changes
|
data/lib/pgxn_utils.rb
ADDED
data/pgxn_utils.gemspec
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "pgxn_utils/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "pgxn_utils"
|
7
|
+
s.version = PgxnUtils::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.date = %q{2011-05-06}
|
10
|
+
s.authors = ["Dickson S. Guedes"]
|
11
|
+
s.email = ["guedes@guedesoft.net"]
|
12
|
+
s.homepage = "http://github.com/guedes/pgxn-utils"
|
13
|
+
s.summary = %q{A PGXN set of tools to developers}
|
14
|
+
s.description = %q{A PGXN set of tools to help developers create and publish your PostgreSQL extensions without pain}
|
15
|
+
|
16
|
+
s.rubyforge_project = "pgxn_utils"
|
17
|
+
|
18
|
+
s.files = `git ls-files`.split("\n")
|
19
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
20
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
21
|
+
s.require_paths = ["lib"]
|
22
|
+
|
23
|
+
# dev
|
24
|
+
s.add_development_dependency "rspec"
|
25
|
+
|
26
|
+
# prod
|
27
|
+
if s.respond_to? :specification_version then
|
28
|
+
s.specification_version = 3
|
29
|
+
|
30
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
31
|
+
s.add_runtime_dependency(%q<thor>, ["~> 0.14"])
|
32
|
+
else
|
33
|
+
s.add_dependency(%q<thor>, ["~> 0.14"])
|
34
|
+
end
|
35
|
+
else
|
36
|
+
s.add_dependency(%q<thor>, ["~> 0.14"])
|
37
|
+
end
|
38
|
+
end
|
data/spec/cli_spec.rb
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
require File.expand_path('spec/spec_helper')
|
2
|
+
|
3
|
+
describe PgxnUtils::CLI do
|
4
|
+
|
5
|
+
after(:all) do
|
6
|
+
system "rm -rf /tmp/extension.*"
|
7
|
+
system "rm -rf extension.*"
|
8
|
+
end
|
9
|
+
|
10
|
+
context "create skeleton" do
|
11
|
+
before(:each) do
|
12
|
+
@cli = PgxnUtils::CLI.new
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should accepts or not a target" do
|
16
|
+
expected_extension = next_extension
|
17
|
+
|
18
|
+
File.should_not exist(expected_extension)
|
19
|
+
skeleton "#{expected_extension}", "-p /tmp"
|
20
|
+
File.should exist("/tmp/#{expected_extension}")
|
21
|
+
|
22
|
+
File.should_not exist(expected_extension)
|
23
|
+
skeleton "#{expected_extension}"
|
24
|
+
File.should exist(expected_extension)
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should store author's name, email, short_description, long_desctiption, tags" do
|
28
|
+
expected_extension = next_extension
|
29
|
+
expected_name = "Guedes"
|
30
|
+
expected_mail = "guedes@none.here"
|
31
|
+
expected_abstract = "Short description"
|
32
|
+
expected_description = "Very Long description for my cool extension"
|
33
|
+
expected_tags = "one two tree"
|
34
|
+
expected_version = "1.0.0"
|
35
|
+
|
36
|
+
skeleton expected_extension, "-p /tmp -m #{expected_name} -e #{expected_mail} -t #{expected_tags} -a '#{expected_abstract}' -d '#{expected_description}' -v #{expected_version}"
|
37
|
+
|
38
|
+
meta = File.read("/tmp/#{expected_extension}/META.json")
|
39
|
+
meta.should match(/"name": "#{expected_extension}"/)
|
40
|
+
meta.should match(/"abstract": "#{expected_abstract}"/)
|
41
|
+
meta.should match(/"description": "#{expected_description}"/)
|
42
|
+
meta.should match(/"version": "#{expected_version}"/)
|
43
|
+
meta.should match(/"license": "postgresql"/)
|
44
|
+
meta.should match(/"release_status": "unstable"/)
|
45
|
+
meta.should match(/"#{expected_name} <#{expected_mail}>"/)
|
46
|
+
meta.should match(/"file": "sql\/#{expected_extension}.sql"/)
|
47
|
+
meta.should match(/"docfile": "doc\/#{expected_extension}.md"/)
|
48
|
+
meta.should_not match(/"generated_by":/)
|
49
|
+
meta.should match(/"tags": \[ "one","two","tree" \],/)
|
50
|
+
|
51
|
+
makefile = File.read("/tmp/#{expected_extension}/Makefile")
|
52
|
+
makefile.should match(/EXTENSION = #{expected_extension}/)
|
53
|
+
|
54
|
+
control = File.read("/tmp/#{expected_extension}/#{expected_extension}.control")
|
55
|
+
control.should match(/module_pathname = '\$libdir\/#{expected_extension}'/)
|
56
|
+
control.should match(/default_version = '#{expected_version}'/)
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should generates a skeleton" do
|
60
|
+
extension = next_extension
|
61
|
+
skeleton extension
|
62
|
+
|
63
|
+
Dir["#{extension}/**/*"].sort.should == [
|
64
|
+
"#{extension}/META.json",
|
65
|
+
"#{extension}/Makefile",
|
66
|
+
"#{extension}/README.md",
|
67
|
+
"#{extension}/doc",
|
68
|
+
"#{extension}/doc/#{extension}.md",
|
69
|
+
"#{extension}/sql",
|
70
|
+
"#{extension}/sql/#{extension}.sql",
|
71
|
+
"#{extension}/sql/uninstall_#{extension}.sql",
|
72
|
+
"#{extension}/test",
|
73
|
+
"#{extension}/test/expected",
|
74
|
+
"#{extension}/test/expected/base.out",
|
75
|
+
"#{extension}/test/sql",
|
76
|
+
"#{extension}/test/sql/base.sql",
|
77
|
+
"#{extension}/#{extension}.control"
|
78
|
+
].sort
|
79
|
+
end
|
80
|
+
|
81
|
+
it "should generates a git repo"
|
82
|
+
end
|
83
|
+
|
84
|
+
context "bundle" do
|
85
|
+
it "should bundle to zip by default"
|
86
|
+
it "should create the name in semver spec"
|
87
|
+
end
|
88
|
+
|
89
|
+
context "release" do
|
90
|
+
it "should send the bundle to PGXN"
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
$:.unshift File.expand_path('..', __FILE__)
|
2
|
+
$:.unshift File.expand_path('../../lib', __FILE__)
|
3
|
+
|
4
|
+
require 'rspec'
|
5
|
+
require 'pgxn_utils'
|
6
|
+
|
7
|
+
$counter = 0
|
8
|
+
|
9
|
+
LIB_PATH = File.expand_path('../../lib', __FILE__)
|
10
|
+
BIN_PATH = File.expand_path('../../bin/pgxn_utils', __FILE__)
|
11
|
+
|
12
|
+
DESTINATION_ROOT = File.expand_path('../pgxn_utils', __FILE__)
|
13
|
+
FileUtils.rm_rf(DESTINATION_ROOT)
|
14
|
+
|
15
|
+
def next_extension
|
16
|
+
$counter += 1
|
17
|
+
"extension.#{$counter}"
|
18
|
+
end
|
19
|
+
|
20
|
+
def skeleton(extension_name, args=nil)
|
21
|
+
run_pgxn_utils(:skeleton, "#{extension_name} #{args}")
|
22
|
+
end
|
23
|
+
|
24
|
+
def run_pgxn_utils(task, args)
|
25
|
+
system "#{BIN_PATH} #{task.to_s} #{args} >/dev/null"
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pgxn_utils
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.4
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Dickson S. Guedes
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-05-06 00:00:00 -03:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: rspec
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: "0"
|
25
|
+
type: :development
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: thor
|
29
|
+
prerelease: false
|
30
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
31
|
+
none: false
|
32
|
+
requirements:
|
33
|
+
- - ~>
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: "0.14"
|
36
|
+
type: :runtime
|
37
|
+
version_requirements: *id002
|
38
|
+
description: A PGXN set of tools to help developers create and publish your PostgreSQL extensions without pain
|
39
|
+
email:
|
40
|
+
- guedes@guedesoft.net
|
41
|
+
executables:
|
42
|
+
- pgxn_utils
|
43
|
+
extensions: []
|
44
|
+
|
45
|
+
extra_rdoc_files: []
|
46
|
+
|
47
|
+
files:
|
48
|
+
- .gitignore
|
49
|
+
- Gemfile
|
50
|
+
- README.md
|
51
|
+
- Rakefile
|
52
|
+
- bin/pgxn_utils
|
53
|
+
- lib/pgxn_utils.rb
|
54
|
+
- lib/pgxn_utils/cli.rb
|
55
|
+
- lib/pgxn_utils/templates/root/%extension_name%.control.tt
|
56
|
+
- lib/pgxn_utils/templates/root/META.json.tt
|
57
|
+
- lib/pgxn_utils/templates/root/Makefile.tt
|
58
|
+
- lib/pgxn_utils/templates/root/README.md.tt
|
59
|
+
- lib/pgxn_utils/templates/root/doc/%extension_name%.md.tt
|
60
|
+
- lib/pgxn_utils/templates/root/sql/%extension_name%.sql.tt
|
61
|
+
- lib/pgxn_utils/templates/root/sql/uninstall_%extension_name%.sql
|
62
|
+
- lib/pgxn_utils/templates/root/test/expected/base.out
|
63
|
+
- lib/pgxn_utils/templates/root/test/sql/base.sql.tt
|
64
|
+
- lib/pgxn_utils/version.rb
|
65
|
+
- pgxn_utils.gemspec
|
66
|
+
- spec/cli_spec.rb
|
67
|
+
- spec/spec_helper.rb
|
68
|
+
has_rdoc: true
|
69
|
+
homepage: http://github.com/guedes/pgxn-utils
|
70
|
+
licenses: []
|
71
|
+
|
72
|
+
post_install_message:
|
73
|
+
rdoc_options: []
|
74
|
+
|
75
|
+
require_paths:
|
76
|
+
- lib
|
77
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
+
none: false
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: "0"
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: "0"
|
89
|
+
requirements: []
|
90
|
+
|
91
|
+
rubyforge_project: pgxn_utils
|
92
|
+
rubygems_version: 1.5.2
|
93
|
+
signing_key:
|
94
|
+
specification_version: 3
|
95
|
+
summary: A PGXN set of tools to developers
|
96
|
+
test_files: []
|
97
|
+
|