pgxn_utils 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. data/LICENSE +9 -0
  2. data/META.json +32 -10
  3. data/Makefile +1 -1
  4. data/README.md +179 -39
  5. data/Rakefile +77 -14
  6. data/bin/pgxn-bundle +22 -0
  7. data/bin/pgxn-change +22 -0
  8. data/bin/pgxn-release +22 -0
  9. data/bin/pgxn-skeleton +22 -0
  10. data/bin/pgxn-utils +15 -3
  11. data/lib/pgxn_utils/cli.rb +34 -19
  12. data/lib/pgxn_utils/no_tasks.rb +63 -0
  13. data/lib/pgxn_utils/templates/c/%extension_name%.control.tt +5 -0
  14. data/lib/pgxn_utils/templates/c/.gitignore.tt +8 -0
  15. data/lib/pgxn_utils/templates/c/.template +1 -0
  16. data/lib/pgxn_utils/templates/c/META.json.tt +37 -0
  17. data/lib/pgxn_utils/templates/c/Makefile.tt +24 -0
  18. data/lib/pgxn_utils/templates/c/README.md.tt +80 -0
  19. data/lib/pgxn_utils/templates/c/doc/%extension_name%.md.tt +33 -0
  20. data/lib/pgxn_utils/templates/c/sql/%extension_name%.sql.tt +17 -0
  21. data/lib/pgxn_utils/templates/c/sql/uninstall_%extension_name%.sql.tt +1 -0
  22. data/lib/pgxn_utils/templates/c/src/%extension_name%.c.tt +26 -0
  23. data/lib/pgxn_utils/templates/c/test/expected/base.out.tt +9 -0
  24. data/lib/pgxn_utils/templates/c/test/sql/base.sql.tt +10 -0
  25. data/lib/pgxn_utils/templates/fdw/%extension_name%.control.tt +5 -0
  26. data/lib/pgxn_utils/templates/fdw/.gitignore.tt +8 -0
  27. data/lib/pgxn_utils/templates/fdw/.template +1 -0
  28. data/lib/pgxn_utils/templates/fdw/META.json.tt +37 -0
  29. data/lib/pgxn_utils/templates/fdw/Makefile.tt +24 -0
  30. data/lib/pgxn_utils/templates/fdw/README.md.tt +80 -0
  31. data/lib/pgxn_utils/templates/fdw/doc/%extension_name%.md.tt +33 -0
  32. data/lib/pgxn_utils/templates/fdw/sql/%extension_name%.sql.tt +31 -0
  33. data/lib/pgxn_utils/templates/fdw/sql/uninstall_%extension_name%.sql.tt +14 -0
  34. data/lib/pgxn_utils/templates/fdw/src/%extension_name%_fdw.c.tt +323 -0
  35. data/lib/pgxn_utils/templates/fdw/test/expected/base.out.tt +4 -0
  36. data/lib/pgxn_utils/templates/fdw/test/sql/base.sql.tt +8 -0
  37. data/lib/pgxn_utils/templates/root/.gitignore.tt +8 -0
  38. data/lib/pgxn_utils/templates/root/META.json.tt +21 -21
  39. data/lib/pgxn_utils/templates/sql/%extension_name%.control.tt +4 -0
  40. data/lib/pgxn_utils/templates/sql/.gitignore.tt +8 -0
  41. data/lib/pgxn_utils/templates/sql/.template +1 -0
  42. data/lib/pgxn_utils/templates/sql/META.json.tt +27 -0
  43. data/lib/pgxn_utils/templates/sql/Makefile.tt +28 -0
  44. data/lib/pgxn_utils/templates/sql/README.md.tt +80 -0
  45. data/lib/pgxn_utils/templates/sql/doc/%extension_name%.md.tt +33 -0
  46. data/lib/pgxn_utils/templates/sql/sql/%extension_name%.sql.tt +31 -0
  47. data/lib/pgxn_utils/templates/sql/sql/uninstall_%extension_name%.sql.tt +21 -0
  48. data/lib/pgxn_utils/templates/sql/test/expected/base.out.tt +49 -0
  49. data/lib/pgxn_utils/templates/sql/test/sql/base.sql.tt +25 -0
  50. data/lib/pgxn_utils/version.rb +1 -1
  51. data/lib/pgxn_utils.rb +1 -1
  52. data/pgxn_utils.gemspec +21 -30
  53. data/spec/cli_spec.rb +73 -8
  54. data/spec/no_tasks_spec.rb +2 -0
  55. data/spec/spec_helper.rb +21 -4
  56. metadata +87 -30
data/LICENSE ADDED
@@ -0,0 +1,9 @@
1
+ Copyright (c) 2011-2012 Dickson S. Guedes.
2
+
3
+ This module is free software; you can redistribute it and/or modify it under the PostgreSQL License.
4
+
5
+ Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without a written agreement is hereby granted, provided that the above copyright notice and this paragraph and the following two paragraphs appear in all copies.
6
+
7
+ In no event shall Dickson S. Guedes be liable to any party for direct, indirect, special, incidental, or consequential damages, including lost profits, arising out of the use of this software and its documentation, even if Dickson S. Guedes has been advised of the possibility of such damage.
8
+
9
+ Dickson S. Guedes specifically disclaims any warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The software provided hereunder is on an "as is" basis, and Dickson S. Guedes has no obligations to provide maintenance, support, updates, enhancements, or modifications.
data/META.json CHANGED
@@ -1,12 +1,34 @@
1
1
  {
2
- "name": "pgxn_utils",
3
- "abstract": "pgxn_utils is a development tool to create PostgreSQL extensions",
4
- "version": "0.1.3",
5
- "maintainer": "Dickson S. Guedes <guedes@guedesoft.net>",
6
- "license": "postgres",
7
- "release_status": "stable",
8
- "repository": {
9
- "url": "git://github.com/guedes/pgxn-utils.git",
10
- "type": "git"
11
- }
2
+ "name": "pgxn_utils",
3
+ "abstract": "pgxn-utils is a development tool to create PostgreSQL extensions",
4
+ "description": "pgxn-utils provides a set of tasks that help developers to create PostgreSQL extensions, putting the extension's files in the recomended places and helping to bundle and release them to PGXN.",
5
+ "version": "0.1.4",
6
+ "maintainer": "Dickson S. Guedes <guedes@guedesoft.net>",
7
+ "license": "postgresql",
8
+ "release_status": "stable",
9
+ "resources": {
10
+ "repository": {
11
+ "url": "git://github.com/guedes/pgxn-utils.git",
12
+ "web": "https://github.com/guedes/pgxn-utils",
13
+ "type": "git"
14
+ },
15
+ "bugtracker": {
16
+ "web": "https://github.com/guedes/pgxn-utils/issues"
17
+ }
18
+ },
19
+ "provides": {
20
+ "pgxn_utils": {
21
+ "file": "pgxn_utils",
22
+ "version": "0.1.4"
23
+ }
24
+ },
25
+ "meta-spec": {
26
+ "version": "1.0.0",
27
+ "url": "http://pgxn.org/meta/spec.txt"
28
+ },
29
+ "tags": [
30
+ "automation",
31
+ "tools",
32
+ "extension tools"
33
+ ]
12
34
  }
data/Makefile CHANGED
@@ -1,3 +1,3 @@
1
1
  all:
2
2
  install:
3
- gem install --no-rdoc --no-ri -v=0.1.3 pgxn_utils
3
+ gem install --no-rdoc --no-ri -v=0.1.4 pgxn_utils
data/README.md CHANGED
@@ -2,39 +2,44 @@ pgxn utils
2
2
  ==========
3
3
 
4
4
  What is it?
5
- --------
5
+ -----------
6
6
 
7
- It aims to be a set of task to help PostgreSQL extension's developers to focus more on the problem that they wants to solve than in all structure and files and control files need to PGXS to build the extension.
7
+ PGXN Utils are a set of tasks that help developers to create PostgreSQL
8
+ extensions, putting the extension's files in the recomended places and helping
9
+ to bundle and release them to PGXN.
8
10
 
9
11
  How to install it?
10
12
  ------------------
11
13
 
12
- If you have pgxn client installed you can do:
14
+ If you have the [PGXN client](http://pgxnclient.projects.postgresql.org/)
15
+ installed you can do:
13
16
 
14
17
  pgxn install pgxn_utils
15
18
 
16
- Or you can install it by rubygems:
19
+ Or you can install it with rubygems:
17
20
 
18
21
  gem install pgxn_utils
19
22
 
20
- How it works?
21
- -------------
23
+ How does it work?
24
+ -----------------
22
25
 
23
- It is all about tasks. Let's see what tasks we have:
26
+ It is all about tasks. Let's see them:
24
27
 
25
- $ pgxn_utils help
28
+ $ pgxn-utils help
26
29
  Tasks:
27
- pgxn_utils bundle [extension_name] # Bundles an extension.
28
- pgxn_utils change [extension_name] # Change META's attributes in current extension.
29
- pgxn_utils help [TASK] # Describe available tasks or one specific task
30
- pgxn_utils release filename # Release a extension
31
- pgxn_utils skeleton extension_name # Creates an extension skeleton in current directory.
30
+ pgxn-utils bundle [extension_name] # Bundle the extension in a zip file
31
+ pgxn-utils change [extension_name] # Change META.json attributes
32
+ pgxn-utils help [TASK] # Describe available tasks or one specific task
33
+ pgxn-utils release filename # Release an extension to PGXN
34
+ pgxn-utils skeleton extension_name # Create an extension skeleton in current directory
32
35
 
33
36
  # Creating a new extension
34
37
 
35
- $ pgxn_utils skeleton my_cool_extension
38
+ $ pgxn-utils skeleton my_cool_extension
36
39
  create my_cool_extension
37
40
  create my_cool_extension/my_cool_extension.control
41
+ create my_cool_extension/.gitignore
42
+ create my_cool_extension/.template
38
43
  create my_cool_extension/META.json
39
44
  create my_cool_extension/Makefile
40
45
  create my_cool_extension/README.md
@@ -44,16 +49,102 @@ It is all about tasks. Let's see what tasks we have:
44
49
  create my_cool_extension/test/expected/base.out
45
50
  create my_cool_extension/test/sql/base.sql
46
51
 
52
+
47
53
  Thats it! Just start coding! ":)
48
54
 
55
+ ## Git support
56
+
57
+ You can start a new extension with or without version control. By default `pgxn-utils`
58
+ supports [git](http://git-scm.org) but it will not create a repository unless you
59
+ use `--git` option in the skeleton task.
60
+
61
+ $ pgxn-utils skeleton my_cool_versioned_extension --git
62
+ create my_cool_versioned_extension
63
+ create my_cool_versioned_extension/my_cool_versioned_extension.control
64
+ create my_cool_versioned_extension/.gitignore
65
+ create my_cool_versioned_extension/.template
66
+ create my_cool_versioned_extension/META.json
67
+ create my_cool_versioned_extension/Makefile
68
+ create my_cool_versioned_extension/README.md
69
+ create my_cool_versioned_extension/doc/my_cool_versioned_extension.md
70
+ create my_cool_versioned_extension/sql/my_cool_versioned_extension.sql
71
+ create my_cool_versioned_extension/sql/uninstall_my_cool_versioned_extension.sql
72
+ create my_cool_versioned_extension/test/expected/base.out
73
+ create my_cool_versioned_extension/test/sql/base.sql
74
+ init /tmp/my_cool_versioned_extension
75
+ commit initial commit
76
+
77
+ When you create a new extension with git support in addition to creating the skeleton,
78
+ `pgxn-utils` will initialize a git repository and create the initial commit.
79
+
80
+ Once you have your extension in a git repository your `bundle` will use only the
81
+ committed files to create the archive, but if your repository is dirty then `pgxn-utils`
82
+ will suggest that you to commit or stash your changes before bundling.
83
+
84
+ You must be careful with new files not added to repository, because they will **not**
85
+ be archived.
86
+
87
+ ## Default templates
88
+
89
+ `pgxn-utils` has three templates: `sql`, `c` and `fdw`. If you call `skeleton` without
90
+ specifying a template, `sql` is the default. But if your extension will supply some C
91
+ modules or you will create a FDW, you can create the extension calling `skeleton` with a
92
+ `--template` option.
93
+
94
+ $ pgxn-utils skeleton my_cool_c_extension --template=c
95
+ create my_cool_c_extension
96
+ create my_cool_c_extension/my_cool_c_extension.control
97
+ create my_cool_c_extension/.gitignore
98
+ create my_cool_c_extension/.template
99
+ create my_cool_c_extension/META.json
100
+ create my_cool_c_extension/Makefile
101
+ create my_cool_c_extension/README.md
102
+ create my_cool_c_extension/doc/my_cool_c_extension.md
103
+ create my_cool_c_extension/sql/my_cool_c_extension.sql
104
+ create my_cool_c_extension/sql/uninstall_my_cool_c_extension.sql
105
+ create my_cool_c_extension/src/my_cool_c_extension.c
106
+ create my_cool_c_extension/test/expected/base.out
107
+ create my_cool_c_extension/test/sql/base.sql
108
+
109
+ $ pgxn-utils skeleton my_cool_fdw_extension --template=fdw
110
+ create my_cool_fdw_extension
111
+ create my_cool_fdw_extension/my_cool_fdw_extension.control
112
+ create my_cool_fdw_extension/.gitignore
113
+ create my_cool_fdw_extension/.template
114
+ create my_cool_fdw_extension/META.json
115
+ create my_cool_fdw_extension/Makefile
116
+ create my_cool_fdw_extension/README.md
117
+ create my_cool_fdw_extension/doc/my_cool_fdw_extension.md
118
+ create my_cool_fdw_extension/sql/my_cool_fdw_extension.sql
119
+ create my_cool_fdw_extension/sql/uninstall_my_cool_fdw_extension.sql
120
+ create my_cool_fdw_extension/src/my_cool_fdw_extension_fdw.c
121
+ create my_cool_fdw_extension/test/expected/base.out
122
+ create my_cool_fdw_extension/test/sql/base.sql
123
+
124
+ The templates contain example code and some links to PostgreSQL documentation
125
+ that will try to help you to start coding. SQL and C templates contains some test
126
+ examples, and the example code will compile and pass `make installcheck`.
127
+ However, this code is intended to be an example, and you must write your own
128
+ tests and code.
129
+
130
+ ## Custom templates
131
+
132
+ If you don't like the templates provided by `pgxn-utils` you can create you own.
133
+ Just create a directory with at least a `META.json` or
134
+ `META.json.tt` file and then use your directory as argument to the `--template`
135
+ option.
136
+
137
+ To know how create your own template, see the examples in the
138
+ [templates directory](https://github.com/guedes/pgxn-utils/tree/master/lib/pgxn_utils/templates).
139
+
49
140
  # Changing something
50
141
 
51
- Well suppose you want to change the default maintainer's name and the license, well just do:
142
+ Suppose you want to change the default maintainer's name and the license, just do:
52
143
 
53
- $ pgxn_utils change my_cool_extension --maintainer "Dickson Guedes" --license bsd
144
+ $ pgxn-utils change my_cool_extension --maintainer "Dickson Guedes" --license bsd
54
145
  conflict META.json
55
- Overwrite /tmp/my_cool_extension/META.json? (enter "h" for help) [Ynaqdh] d
56
- {
146
+ Overwrite /tmp/my_cool_extension/META.json? (enter "h" for help) [Ynaqdh]
147
+ {
57
148
  "name": "my_cool_extension",
58
149
  "abstract": "A short description",
59
150
  "description": "A long description",
@@ -71,28 +162,25 @@ Well suppose you want to change the default maintainer's name and the license, w
71
162
  }
72
163
  },
73
164
  "release_status": "unstable",
74
-
75
165
  "generated_by": "The maintainer's name",
76
-
77
-
78
166
  "meta-spec": {
79
167
  "version": "1.0.0",
80
168
  "url": "http://pgxn.org/meta/spec.txt"
81
169
  }
82
170
  }
83
171
  Retrying...
84
- Overwrite /tmp/my_cool_extension/META.json? (enter "h" for help) [Ynaqdh] Y
85
- force META.json
172
+ Overwrite /tmp/my_cool_extension/META.json? (enter "h" for help) [Ynaqdh]
173
+ force META.json
86
174
  identical my_cool_extension.control
87
175
 
88
- It will wait you decide what to do.
176
+ It will wait until you decide what to do.
89
177
 
90
178
  For all switches that you can use with *change*, type:
91
179
 
92
- $ pgxn_utils help change
180
+ $ pgxn-utils help change
93
181
  Usage:
94
- pgxn_utils change [extension_name]
95
-
182
+ pgxn-utils change [extension_name]
183
+
96
184
  Options:
97
185
  -p, [--target=TARGET] # Define the target directory
98
186
  # Default: .
@@ -104,39 +192,91 @@ For all switches that you can use with *change*, type:
104
192
  -b, [--generated-by=GENERATED_BY] # Name of extension's generator
105
193
  -t, [--tags=one two three] # Defines extension's tags
106
194
  -r, [--release-status=RELEASE_STATUS] # Initial extension's release status
107
-
108
- Change META's attributes in current extension.
195
+
196
+ Changes META's attributes in current extension
109
197
 
110
198
  # Bundling and Releasing!
111
199
 
112
- Well, since you finished your work you can bundle it to send to [PGXN](http://pgxn.org).
200
+ Assuming you've created a [PGXN Manager](http://manager.pgxn.org/) account,
201
+ once you've finished your work you can bundle it to send to [PGXN](http://pgxn.org).
202
+ Note that if your extension is in a git repository, `bundle` will use only the
203
+ committed files to create the archive, and if your repository is dirty, `pgxn-utils`
204
+ will suggest that you commit or stash your changes before bundling.
113
205
 
114
- Bundle it:
206
+ Let's bundle it:
115
207
 
116
- $ pgxn_utils bundle my_cool_extension
117
- Extension generated at: /home/guedes/extensions/my_cool_extension-0.0.1.zip
208
+ $ pgxn-utils bundle my_cool_extension
209
+ create /home/guedes/extensions/my_cool_extension-0.0.1.zip
118
210
 
119
211
  and release it:
120
212
 
121
- $ pgxn_utils release my_cool_extension-0.0.1.zip
213
+ $ pgxn-utils release my_cool_extension-0.0.1.zip
122
214
  Enter your PGXN username: guedes
123
215
  Enter your PGXN password: ******
124
216
  Trying to release my_cool_extension-0.0.1.zip ... released successfully!
125
217
  Visit: https://manager.pgxn.org/distributions/my_cool_extension/0.0.1
126
218
 
127
- You can export `PGXN_USER` and `PGXN_PASSWORD` environment variables to avoid
128
- type username and password everytime.
219
+ You can export the `PGXN_USER` and `PGXN_PASSWORD` environment variables to avoid
220
+ typing your username and password every time.
221
+
222
+ # PGXN Client integration
223
+
224
+ If you have [PGXN client](http://pgxnclient.projects.postgresql.org/) installed you
225
+ can change the command line from `pgxn-utils some_task` to `pgxn some_task` and this
226
+ will save you some typing. See:
227
+
228
+ $ cd /tmp
229
+ $ pgxn skeleton --help
230
+ PGXN Utils version: 0.1.4
231
+ Usage:
232
+ pgxn skeleton extension_name
233
+
234
+ Options:
235
+ [--git] # Initialize a git repository after create the extension
236
+ -a, [--abstract=ABSTRACT] # Defines a short description to abstract
237
+ -p, [--target=TARGET] # Define the target directory
238
+ # Default: .
239
+ [--template=TEMPLATE] # The template that will be used to create the extension. Expected values are: sql, c, fdw
240
+ # Default: sql
241
+ -r, [--release-status=RELEASE_STATUS] # Initial extension's release status
242
+ -d, [--description=DESCRIPTION] # A long text that contains more information about extension
243
+ -b, [--generated-by=GENERATED_BY] # Name of extension's generator
244
+ -l, [--license=LICENSE] # The extension license
245
+ -t, [--tags=one two three] # Defines extension's tags
246
+ -v, [--version=VERSION] # Initial version
247
+ -m, [--maintainer=MAINTAINER] # Maintainer's name <maintainer@email>
248
+
249
+ Creates an extension skeleton in current directory
250
+
251
+ $ pgxn skeleton test
252
+ create test
253
+ create test/test.control
254
+ create test/.gitignore
255
+ create test/.template
256
+ create test/META.json
257
+ create test/Makefile
258
+ create test/README.md
259
+ create test/doc/test.md
260
+ create test/sql/test.sql
261
+ create test/sql/uninstall_test.sql
262
+ create test/test/expected/base.out
263
+ create test/test/sql/base.sql
264
+
265
+ $ cd test/
266
+ $ pgxn bundle
267
+ run make distclean from "."
268
+ create /tmp/test-0.0.1.zip
129
269
 
130
270
  # Working in progress
131
271
 
132
- * [git](http://git-scm.org) support
133
272
  * proxy support
134
- * custom templates
273
+ * improve [git](http://git-scm.org) support
274
+ * improve custom templates
135
275
 
136
276
  Copyright and License
137
277
  ---------------------
138
278
 
139
- Copyright (c) 2011 Dickson S. Guedes.
279
+ Copyright (c) 2011-2012 Dickson S. Guedes.
140
280
 
141
281
  This module is free software; you can redistribute it and/or modify it under
142
282
  the [PostgreSQL License](http://www.opensource.org/licenses/postgresql).
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ Bundler::GemHelper.install_tasks
4
4
  require 'rspec/core/rake_task'
5
5
 
6
6
  def format_cmd_output(cmd)
7
- `./bin/pgxn_utils #{cmd} | sed 's/^/ /' | sed 's/\[[0-9]*m//g'`
7
+ `./bin/pgxn-utils #{cmd} | sed 's/^/ /' | sed 's/\[[0-9]*m//g'`
8
8
  end
9
9
 
10
10
  desc "Run RSpec"
@@ -22,6 +22,9 @@ end
22
22
  desc "Generate README.md"
23
23
  task :generate_readme do
24
24
  rm_r "/tmp/my_cool_extension" if File.exist?("/tmp/my_cool_extension")
25
+ rm_r "/tmp/my_cool_c_extension" if File.exist?("/tmp/my_cool_c_extension")
26
+ rm_r "/tmp/my_cool_fdw_extension" if File.exist?("/tmp/my_cool_fdw_extension")
27
+ rm_r "/tmp/my_cool_versioned_extension" if File.exist?("/tmp/my_cool_versioned_extension")
25
28
  readme = File.new("README.md.new", 'w')
26
29
  readme.puts <<-README
27
30
  pgxn utils
@@ -30,54 +33,114 @@ pgxn utils
30
33
  What is it?
31
34
  --------
32
35
 
33
- It aims to be a set of task to help PostgreSQL extension's 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.
36
+ It is a set of task that help developers to create PostgreSQL's extensions, putting
37
+ the extension's files in the recomended places and supplying tasks to help bundle
38
+ and release your extension to PGXN.
34
39
 
35
40
  How to install it?
36
41
  ------------------
37
42
 
43
+ If you have pgxn client installed you can do:
44
+
45
+ pgxn install pgxn_utils
46
+
47
+ Or you can install it by rubygems:
48
+
38
49
  gem install pgxn_utils
39
50
 
40
51
  How it works?
41
52
  -------------
42
53
 
43
- It is all about tasks. Let's see what tasks we have:
54
+ It is all about tasks. Let's see them:
44
55
 
45
- $ pgxn_utils help
56
+ $ pgxn-utils help
46
57
  #{format_cmd_output("help")}
47
58
 
48
59
  # Creating a new extension
49
60
 
50
- $ pgxn_utils skeleton my_cool_extension
61
+ $ pgxn-utils skeleton my_cool_extension
51
62
  #{format_cmd_output("skeleton my_cool_extension -p /tmp")}
52
63
 
53
64
  Thats it! Just start coding! ":)
54
65
 
66
+ ## Git support
67
+
68
+ You can start a new extension with or without version control. By default `pgxn-utils`
69
+ supports [git](http://git-scm.org) but it will not create a repository unless you
70
+ use `--git` option in the skeleton task.
71
+
72
+ $ pgxn-utils skeleton my_cool_versioned_extension --git
73
+ #{format_cmd_output("skeleton my_cool_versioned_extension --git -p /tmp")}
74
+
75
+
76
+ When you create a new extension with git support in addition to create skeleton,
77
+ `pgxn-utils` will initialize a git repository and create the initial commit.
78
+
79
+ Once you have your extension in a git repository your `bundle` will use only the
80
+ commited files to create the archive, but if your repository is dirty then `pgxn-utils`
81
+ will hint you to commit or stash your changes, before bundle.
82
+
83
+ You must be careful with new files not added to repository, because they will NOT
84
+ be archived.
85
+
86
+ ## Default templates
87
+
88
+ `pgxn-utils` has three templates: `sql`, `c` and `fdw`. If you call `skeleton` without
89
+ specifying a template the `sql` is the default. But if your extension will supply some C
90
+ modules or you will create a FDW, you can create the extension calling `skeleton` with a
91
+ `--template` option.
92
+
93
+ $ pgxn-utils skeleton my_cool_c_extension --template=c
94
+ #{format_cmd_output("skeleton my_cool_c_extension --template=c -p /tmp")}
95
+
96
+
97
+ $ pgxn-utils skeleton my_cool_fdw_extension --template=fdw
98
+ #{format_cmd_output("skeleton my_cool_fdw_extension --template=fdw -p /tmp")}
99
+
100
+ The templates contains examples codes and some links to PostgreSQL documentation
101
+ that will try to help you to start coding. SQL and C templates contains some tests
102
+ examples, and the example code will compiles and pass `make installcheck`, but they
103
+ are examples and you must write your own tests and code.
104
+
105
+ ## Custom templates
106
+
107
+ If you don't like the templates provided by `pgxn-utils` you can create you own
108
+ templates. Just create a directory where you want with at least a META.json or
109
+ META.json.tt file then you can use your directory as argument to the `--template`
110
+ option.
111
+
112
+ To see how create your own template, you can use, as example, the
113
+ [templates directory](https://github.com/guedes/pgxn-utils/tree/master/lib/pgxn_utils/templates).
114
+
55
115
  # Changing something
56
116
 
57
- Well suppose you want to change the default maintainer's name and the license, well just do:
117
+ Well suppose you want to change the default maintainer's name and the license, just do:
58
118
 
59
- $ pgxn_utils change my_cool_extension --maintainer "Dickson Guedes" --license bsd
119
+ $ pgxn-utils change my_cool_extension --maintainer "Dickson Guedes" --license bsd
60
120
  #{format_cmd_output("change my_cool_extension -p /tmp --maintainer 'Dickson Guedes' --license bsd")}
61
121
 
62
- It will wait you decide what to do.
122
+ It will wait until you decide what to do.
63
123
 
64
124
  For all switches that you can use with *change*, type:
65
125
 
66
- $ pgxn_utils help change
126
+ $ pgxn-utils help change
67
127
  #{format_cmd_output("help change")}
68
128
 
69
129
  # Bundling and Releasing!
70
130
 
71
131
  Well, since you finished your work you can bundle it to send to [PGXN](http://pgxn.org).
132
+ Note that if you have your extension in a git repository `bundle` will use only the
133
+ commited files to create the archive, but if your repository is dirty then `pgxn-utils`
134
+ will hint you to commit or stash your changes, before bundle.
72
135
 
73
- Bundle it:
136
+ Let's bundle it:
74
137
 
75
- $ pgxn_utils bundle my_cool_extension
76
- Extension generated at: /home/guedes/extensions/my_cool_extension-0.0.1.zip
138
+ $ pgxn-utils bundle my_cool_extension
139
+ create /home/guedes/extensions/my_cool_extension-0.0.1.zip
77
140
 
78
141
  and release it:
79
142
 
80
- $ pgxn_utils release my_cool_extension-0.0.1.zip
143
+ $ pgxn-utils release my_cool_extension-0.0.1.zip
81
144
  Enter your PGXN username: guedes
82
145
  Enter your PGXN password: ******
83
146
  Trying to release my_cool_extension-0.0.1.zip ... released successfully!
@@ -88,7 +151,7 @@ type username and password everytime.
88
151
 
89
152
  # Working in progress
90
153
 
91
- * [git](http://git-scm.org) support
154
+ * improve [git](http://git-scm.org) support
92
155
  * proxy support
93
156
  * custom templates
94
157
 
data/bin/pgxn-bundle ADDED
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env ruby
2
+ $:.unshift File.expand_path('..', __FILE__)
3
+ $:.unshift File.expand_path('../../lib', __FILE__)
4
+ require 'pgxn_utils'
5
+
6
+ command_args = []
7
+
8
+ if ARGV.include? "--help"
9
+ command_args = [ 'help' ]
10
+ end
11
+
12
+ task = File.basename(__FILE__).gsub(/pgxn-/,'') if File.basename(__FILE__) =~ /^pgxn-(skeleton|bundle|change|release)/
13
+
14
+ if task
15
+ command_args = command_args + [ task ]
16
+ $0 = $0.gsub(/pgxn-.*/,'/pgxn')
17
+ end
18
+
19
+ command_args = command_args + ARGV
20
+
21
+ puts "PGXN Utils version: #{PgxnUtils::VERSION}" if command_args.include?('help')
22
+ PgxnUtils::CLI.start( command_args || ARGV )
data/bin/pgxn-change ADDED
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env ruby
2
+ $:.unshift File.expand_path('..', __FILE__)
3
+ $:.unshift File.expand_path('../../lib', __FILE__)
4
+ require 'pgxn_utils'
5
+
6
+ command_args = []
7
+
8
+ if ARGV.include? "--help"
9
+ command_args = [ 'help' ]
10
+ end
11
+
12
+ task = File.basename(__FILE__).gsub(/pgxn-/,'') if File.basename(__FILE__) =~ /^pgxn-(skeleton|bundle|change|release)/
13
+
14
+ if task
15
+ command_args = command_args + [ task ]
16
+ $0 = $0.gsub(/pgxn-.*/,'/pgxn')
17
+ end
18
+
19
+ command_args = command_args + ARGV
20
+
21
+ puts "PGXN Utils version: #{PgxnUtils::VERSION}" if command_args.include?('help')
22
+ PgxnUtils::CLI.start( command_args || ARGV )
data/bin/pgxn-release ADDED
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env ruby
2
+ $:.unshift File.expand_path('..', __FILE__)
3
+ $:.unshift File.expand_path('../../lib', __FILE__)
4
+ require 'pgxn_utils'
5
+
6
+ command_args = []
7
+
8
+ if ARGV.include? "--help"
9
+ command_args = [ 'help' ]
10
+ end
11
+
12
+ task = File.basename(__FILE__).gsub(/pgxn-/,'') if File.basename(__FILE__) =~ /^pgxn-(skeleton|bundle|change|release)/
13
+
14
+ if task
15
+ command_args = command_args + [ task ]
16
+ $0 = $0.gsub(/pgxn-.*/,'/pgxn')
17
+ end
18
+
19
+ command_args = command_args + ARGV
20
+
21
+ puts "PGXN Utils version: #{PgxnUtils::VERSION}" if command_args.include?('help')
22
+ PgxnUtils::CLI.start( command_args || ARGV )
data/bin/pgxn-skeleton ADDED
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env ruby
2
+ $:.unshift File.expand_path('..', __FILE__)
3
+ $:.unshift File.expand_path('../../lib', __FILE__)
4
+ require 'pgxn_utils'
5
+
6
+ command_args = []
7
+
8
+ if ARGV.include? "--help"
9
+ command_args = [ 'help' ]
10
+ end
11
+
12
+ task = File.basename(__FILE__).gsub(/pgxn-/,'') if File.basename(__FILE__) =~ /^pgxn-(skeleton|bundle|change|release)/
13
+
14
+ if task
15
+ command_args = command_args + [ task ]
16
+ $0 = $0.gsub(/pgxn-.*/,'/pgxn')
17
+ end
18
+
19
+ command_args = command_args + ARGV
20
+
21
+ puts "PGXN Utils version: #{PgxnUtils::VERSION}" if command_args.include?('help')
22
+ PgxnUtils::CLI.start( command_args || ARGV )
data/bin/pgxn-utils CHANGED
@@ -3,8 +3,20 @@ $:.unshift File.expand_path('..', __FILE__)
3
3
  $:.unshift File.expand_path('../../lib', __FILE__)
4
4
  require 'pgxn_utils'
5
5
 
6
- task = __FILE__.gsub(/pgxn-utils-/,'').gsub(/-/,'_') if File.basename(__FILE__) =~ /^pgxn-utils-/
7
- command_args = [ task ] + ARGV if task
6
+ command_args = []
8
7
 
9
- puts "PGXN Utils version: #{PgxnUtils::VERSION}" if ARGV.empty?
8
+ if ARGV.include? "--help"
9
+ command_args = [ 'help' ]
10
+ end
11
+
12
+ task = File.basename(__FILE__).gsub(/pgxn-/,'') if File.basename(__FILE__) =~ /^pgxn-(skeleton|bundle|change|release)/
13
+
14
+ if task
15
+ command_args = command_args + [ task ]
16
+ $0 = $0.gsub(/pgxn-.*/,'/pgxn')
17
+ end
18
+
19
+ command_args = command_args + ARGV
20
+
21
+ puts "PGXN Utils version: #{PgxnUtils::VERSION}" if command_args.include?('help')
10
22
  PgxnUtils::CLI.start( command_args || ARGV )