vibedeck-comma 0.4.2
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/Gemfile +4 -0
- data/Gemfile.lock +30 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +218 -0
- data/Rakefile +47 -0
- data/VERSION +1 -0
- data/init.rb +1 -0
- data/lib/comma.rb +40 -0
- data/lib/comma/array.rb +5 -0
- data/lib/comma/association_proxy.rb +6 -0
- data/lib/comma/extractors.rb +74 -0
- data/lib/comma/generator.rb +35 -0
- data/lib/comma/named_scope.rb +5 -0
- data/lib/comma/object.rb +17 -0
- data/lib/comma/render_as_csv.rb +57 -0
- data/spec/comma/ar_spec.rb +38 -0
- data/spec/comma/comma_spec.rb +217 -0
- data/spec/comma/extractors_spec.rb +91 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +41 -0
- data/sudo +384 -0
- data/vibedeck-comma.gemspec +69 -0
- metadata +111 -0
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'spec'
|
3
|
+
require 'activerecord'
|
4
|
+
ActiveRecord::ActiveRecordError # http://tinyurl.com/24f84gf
|
5
|
+
|
6
|
+
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
7
|
+
|
8
|
+
require 'comma'
|
9
|
+
|
10
|
+
|
11
|
+
class Book
|
12
|
+
attr_accessor :name, :description, :isbn
|
13
|
+
|
14
|
+
def initialize(name, description, isbn)
|
15
|
+
@name, @description, @isbn = name, description, isbn
|
16
|
+
end
|
17
|
+
|
18
|
+
comma do
|
19
|
+
name 'Title'
|
20
|
+
description
|
21
|
+
|
22
|
+
isbn :authority => :issuer
|
23
|
+
isbn :number_10 => 'ISBN-10'
|
24
|
+
isbn :number_13 => 'ISBN-13'
|
25
|
+
end
|
26
|
+
|
27
|
+
comma :brief do
|
28
|
+
name
|
29
|
+
description
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
class Isbn
|
34
|
+
attr_accessor :number_10, :number_13
|
35
|
+
|
36
|
+
def initialize(isbn_10, isbn_13)
|
37
|
+
@number_10, @number_13 = isbn_10, isbn_13
|
38
|
+
end
|
39
|
+
|
40
|
+
def authority; 'ISBN'; end
|
41
|
+
end
|
data/sudo
ADDED
@@ -0,0 +1,384 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file, hub, is generated code.
|
4
|
+
# Please DO NOT EDIT or send patches for it.
|
5
|
+
#
|
6
|
+
# Please take a look at the source from
|
7
|
+
# http://github.com/defunkt/hub
|
8
|
+
# and submit patches against the individual files
|
9
|
+
# that build hub.
|
10
|
+
#
|
11
|
+
|
12
|
+
module Hub
|
13
|
+
class Args < Array
|
14
|
+
def after(command = nil, &block)
|
15
|
+
@after ||= block ? block : command
|
16
|
+
end
|
17
|
+
|
18
|
+
def after?
|
19
|
+
!!@after
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
module Hub
|
24
|
+
module Commands
|
25
|
+
instance_methods.each { |m| undef_method(m) unless m =~ /(^__|send|to\?$)/ }
|
26
|
+
extend self
|
27
|
+
|
28
|
+
PRIVATE = 'git@github.com:%s/%s.git'
|
29
|
+
PUBLIC = 'git://github.com/%s/%s.git'
|
30
|
+
USER = `git config --global github.user`.chomp
|
31
|
+
REPO = `basename $(pwd)`.chomp
|
32
|
+
LGHCONF = "http://github.com/guides/local-github-config"
|
33
|
+
|
34
|
+
def clone(args)
|
35
|
+
ssh = args.delete('-p')
|
36
|
+
args[1..-1].each_with_index do |arg, i|
|
37
|
+
i += 1
|
38
|
+
if arg.scan('/').size == 1 && !arg.include?(':')
|
39
|
+
url = ssh ? PRIVATE : PUBLIC
|
40
|
+
args[i] = url % arg.split('/')
|
41
|
+
break
|
42
|
+
elsif arg !~ /:|\//
|
43
|
+
url = ssh ? PRIVATE : PUBLIC
|
44
|
+
args[i] = url % [ github_user, arg ]
|
45
|
+
break
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def remote(args)
|
51
|
+
return unless args[1] == 'add'
|
52
|
+
|
53
|
+
if args[-1] !~ /:|\//
|
54
|
+
ssh = args.delete('-p')
|
55
|
+
user = args.last
|
56
|
+
url = ssh ? PRIVATE : PUBLIC
|
57
|
+
args << url % [ user, REPO ]
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def init(args)
|
62
|
+
if args.delete('-g')
|
63
|
+
|
64
|
+
url = PRIVATE % [ github_user, REPO ]
|
65
|
+
args.after "git remote add origin #{url}"
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def alias(args)
|
70
|
+
shells = {
|
71
|
+
'sh' => 'alias git=hub',
|
72
|
+
'bash' => 'alias git=hub',
|
73
|
+
'zsh' => 'alias git=hub',
|
74
|
+
'csh' => 'alias git hub',
|
75
|
+
'fish' => 'alias git hub'
|
76
|
+
}
|
77
|
+
|
78
|
+
silent = args.delete('-s')
|
79
|
+
|
80
|
+
if shell = args[1]
|
81
|
+
if silent.nil?
|
82
|
+
puts "Run this in your shell to start using `hub` as `git`:"
|
83
|
+
print " "
|
84
|
+
end
|
85
|
+
else
|
86
|
+
puts "usage: hub alias [-s] SHELL", ""
|
87
|
+
puts "You already have hub installed and available in your PATH,"
|
88
|
+
puts "but to get the full experience you'll want to alias it to"
|
89
|
+
puts "`git`.", ""
|
90
|
+
puts "To see how to accomplish this for your shell, run the alias"
|
91
|
+
puts "command again with the name of your shell.", ""
|
92
|
+
puts "Known shells:"
|
93
|
+
shells.map { |key, _| key }.sort.each do |key|
|
94
|
+
puts " " + key
|
95
|
+
end
|
96
|
+
puts "", "Options:"
|
97
|
+
puts " -s Silent. Useful when using the output with eval, e.g."
|
98
|
+
puts " $ eval `hub alias -s bash`"
|
99
|
+
|
100
|
+
exit
|
101
|
+
end
|
102
|
+
|
103
|
+
if shells[shell]
|
104
|
+
puts shells[shell]
|
105
|
+
else
|
106
|
+
abort "fatal: never heard of `#{shell}'"
|
107
|
+
end
|
108
|
+
|
109
|
+
exit
|
110
|
+
end
|
111
|
+
|
112
|
+
def version(args)
|
113
|
+
args.after do
|
114
|
+
puts "hub version %s" % Version
|
115
|
+
end
|
116
|
+
end
|
117
|
+
alias_method "--version", :version
|
118
|
+
|
119
|
+
def help(args)
|
120
|
+
if args[1] == 'hub'
|
121
|
+
puts hub_manpage
|
122
|
+
exit
|
123
|
+
elsif args.size == 1
|
124
|
+
puts improved_help_text
|
125
|
+
exit
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
def improved_help_text
|
130
|
+
<<-help
|
131
|
+
usage: git [--version] [--exec-path[=GIT_EXEC_PATH]] [--html-path]
|
132
|
+
[-p|--paginate|--no-pager] [--bare] [--git-dir=GIT_DIR]
|
133
|
+
[--work-tree=GIT_WORK_TREE] [--help] COMMAND [ARGS]
|
134
|
+
|
135
|
+
Basic Commands:
|
136
|
+
init Create an empty git repository or reinitialize an existing one
|
137
|
+
add Add new or modified files to the staging area
|
138
|
+
rm Remove files from the working directory and staging area
|
139
|
+
mv Move or rename a file, a directory, or a symlink
|
140
|
+
status Show the status of the working directory and staging area
|
141
|
+
commit Record changes to the repository
|
142
|
+
|
143
|
+
History Commands:
|
144
|
+
log Show the commit history log
|
145
|
+
diff Show changes between commits, commit and working tree, etc
|
146
|
+
show Show information about commits, tags or files
|
147
|
+
|
148
|
+
Branching Commands:
|
149
|
+
branch List, create, or delete branches
|
150
|
+
checkout Switch the active branch to another branch
|
151
|
+
merge Join two or more development histories (branches) together
|
152
|
+
tag Create, list, delete, sign or verify a tag object
|
153
|
+
|
154
|
+
Remote Commands:
|
155
|
+
clone Clone a remote repository into a new directory
|
156
|
+
fetch Download data, tags and branches from a remote repository
|
157
|
+
pull Fetch from and merge with another repository or a local branch
|
158
|
+
push Upload data, tags and branches to a remote repository
|
159
|
+
remote View and manage a set of remote repositories
|
160
|
+
|
161
|
+
Advanced commands:
|
162
|
+
reset Reset your staging area or working directory to another point
|
163
|
+
rebase Re-apply a series of patches in one branch onto another
|
164
|
+
bisect Find by binary search the change that introduced a bug
|
165
|
+
grep Print files with lines matching a pattern in your codebase
|
166
|
+
|
167
|
+
See 'git help COMMAND' for more information on a specific command.
|
168
|
+
help
|
169
|
+
end
|
170
|
+
|
171
|
+
private
|
172
|
+
|
173
|
+
def github_user
|
174
|
+
if USER.empty?
|
175
|
+
abort "** No GitHub user set. See #{LGHCONF}"
|
176
|
+
else
|
177
|
+
USER
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
def hub_manpage
|
182
|
+
return "** Can't find groff(1)" unless groff?
|
183
|
+
|
184
|
+
require 'open3'
|
185
|
+
out = nil
|
186
|
+
Open3.popen3(groff_command) do |stdin, stdout, _|
|
187
|
+
stdin.puts hub_raw_manpage
|
188
|
+
stdin.close
|
189
|
+
out = stdout.read.strip
|
190
|
+
end
|
191
|
+
out
|
192
|
+
end
|
193
|
+
|
194
|
+
def groff?
|
195
|
+
system("which groff")
|
196
|
+
end
|
197
|
+
|
198
|
+
def groff_command
|
199
|
+
"groff -Wall -mtty-char -mandoc -Tascii"
|
200
|
+
end
|
201
|
+
|
202
|
+
def hub_raw_manpage
|
203
|
+
if File.exists? file = File.dirname(__FILE__) + '/../../man/hub.1'
|
204
|
+
File.read(file)
|
205
|
+
else
|
206
|
+
DATA.read
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
def puts(*args)
|
211
|
+
page_stdout
|
212
|
+
super
|
213
|
+
end
|
214
|
+
|
215
|
+
def page_stdout
|
216
|
+
return unless $stdout.tty?
|
217
|
+
|
218
|
+
read, write = IO.pipe
|
219
|
+
|
220
|
+
if Kernel.fork
|
221
|
+
$stdin.reopen(read)
|
222
|
+
read.close
|
223
|
+
write.close
|
224
|
+
|
225
|
+
ENV['LESS'] = 'FSRX'
|
226
|
+
|
227
|
+
Kernel.select [STDIN]
|
228
|
+
|
229
|
+
pager = ENV['PAGER'] || 'less -isr'
|
230
|
+
exec pager rescue exec "/bin/sh", "-c", pager
|
231
|
+
else
|
232
|
+
$stdout.reopen(write)
|
233
|
+
$stderr.reopen(write) if $stderr.tty?
|
234
|
+
read.close
|
235
|
+
write.close
|
236
|
+
end
|
237
|
+
end
|
238
|
+
end
|
239
|
+
end
|
240
|
+
module Hub
|
241
|
+
class Runner
|
242
|
+
attr_reader :args
|
243
|
+
def initialize(*args)
|
244
|
+
@args = Args.new(args)
|
245
|
+
|
246
|
+
@args[0] = 'help' if @args.empty?
|
247
|
+
|
248
|
+
if Commands.respond_to?(@args[0])
|
249
|
+
Commands.send(@args[0], @args)
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
253
|
+
def self.execute(*args)
|
254
|
+
new(*args).execute
|
255
|
+
end
|
256
|
+
|
257
|
+
def after
|
258
|
+
args.after.to_s
|
259
|
+
end
|
260
|
+
|
261
|
+
def command
|
262
|
+
"git #{args.join(' ')}"
|
263
|
+
end
|
264
|
+
|
265
|
+
def execute
|
266
|
+
if args.after?
|
267
|
+
execute_with_after_callback
|
268
|
+
else
|
269
|
+
exec "git", *args
|
270
|
+
end
|
271
|
+
end
|
272
|
+
|
273
|
+
def execute_with_after_callback
|
274
|
+
after = args.after
|
275
|
+
if system("git", *args)
|
276
|
+
after.respond_to?(:call) ? after.call : exec(after)
|
277
|
+
exit
|
278
|
+
else
|
279
|
+
exit 1
|
280
|
+
end
|
281
|
+
end
|
282
|
+
end
|
283
|
+
end
|
284
|
+
module Hub
|
285
|
+
Version = '0.1.3'
|
286
|
+
end
|
287
|
+
Hub::Runner.execute(*ARGV)
|
288
|
+
__END__
|
289
|
+
.\" generated with Ron/v0.3
|
290
|
+
.\" http://github.com/rtomayko/ron/
|
291
|
+
.
|
292
|
+
.TH "HUB" "1" "December 2009" "DEFUNKT" "Git Manual"
|
293
|
+
.
|
294
|
+
.SH "NAME"
|
295
|
+
\fBhub\fR \-\- git + hub = github
|
296
|
+
.
|
297
|
+
.SH "SYNOPSIS"
|
298
|
+
\fBhub\fR \fICOMMAND\fR \fIOPTIONS\fR
|
299
|
+
.
|
300
|
+
.br
|
301
|
+
\fBhub alias\fR [\fB\-s\fR] \fISHELL\fR
|
302
|
+
.
|
303
|
+
.P
|
304
|
+
\fBgit init \-g\fR \fIOPTIONS\fR
|
305
|
+
.
|
306
|
+
.br
|
307
|
+
\fBgit clone\fR [\fB\-p\fR] \fIOPTIONS\fR [\fIUSER\fR/]\fIREPOSITORY\fR \fIDIRECTORY\fR
|
308
|
+
.
|
309
|
+
.br
|
310
|
+
\fBgit remote add\fR [\fB\-p\fR] \fIOPTIONS\fR \fIUSER\fR[/\fIREPOSITORY\fR]
|
311
|
+
.
|
312
|
+
.br
|
313
|
+
.
|
314
|
+
.SH "DESCRIPTION"
|
315
|
+
\fBhub\fR enhances various \fBgit\fR commands with GitHub remote expansion. The
|
316
|
+
alias command displays information on configuring your environment:
|
317
|
+
.
|
318
|
+
.TP
|
319
|
+
\fBhub alias\fR [\fB\-s\fR] \fISHELL\fR
|
320
|
+
Writes shell aliasing code for \fISHELL\fR (\fBbash\fR, \fBsh\fR, \fBzsh\fR, \fBcsh\fR) to standard output. With the \fB\-s\fR option, the output of
|
321
|
+
this command can be evaluated directly within the shell: \fBeval $(hub alias \-s bash)\fR
|
322
|
+
.
|
323
|
+
.P
|
324
|
+
After configuring the alias, the following commands have superpowers:
|
325
|
+
.
|
326
|
+
.TP
|
327
|
+
\fBgit init\fR \fB\-g\fR \fIOPTIONS\fR
|
328
|
+
Create a git repository as with git\-init(1) and add remote \fBorigin\fR at
|
329
|
+
"git@github.com:\fIUSER\fR/\fIREPOSITORY\fR.git"; \fIUSER\fR is your GitHub username and \fIREPOSITORY\fR is the current working directory's basename.
|
330
|
+
.
|
331
|
+
.TP
|
332
|
+
\fBgit clone\fR [\fB\-p\fR] \fIOPTIONS\fR [\fIUSER\fR\fB/\fR]\fIREPOSITORY\fR \fIDIRECTORY\fR
|
333
|
+
Clone repository "git://github.com/\fIUSER\fR/\fIREPOSITORY\fR.git" into \fIDIRECTORY\fR as with git\-clone(1). When \fIUSER\fR/ is omitted, assumes
|
334
|
+
your GitHub login. With \fB\-p\fR, use private remote
|
335
|
+
"git@github.com:\fIUSER\fR/\fIREPOSITORY\fR.git".
|
336
|
+
.
|
337
|
+
.TP
|
338
|
+
\fBgit remote add\fR [\fB\-p\fR] \fIOPTIONS\fR \fIUSER\fR[\fB/\fR\fIREPOSITORY\fR]
|
339
|
+
Add remote "git://github.com/\fIUSER\fR/\fIREPOSITORY\fR.git" as with
|
340
|
+
git\-remote(1). When /\fIREPOSITORY\fR is omitted, the basename of the
|
341
|
+
current working directory is used. With \fB\-p\fR, use private remote
|
342
|
+
"git@github.com:\fIUSER\fR/\fIREPOSITORY\fR.git".
|
343
|
+
.
|
344
|
+
.TP
|
345
|
+
\fBgit help\fR
|
346
|
+
Display enhanced git\-help(1).
|
347
|
+
.
|
348
|
+
.SH "CONFIGURATION"
|
349
|
+
Use git\-config(1) to display the currently configured GitHub username:
|
350
|
+
.
|
351
|
+
.IP "" 4
|
352
|
+
.
|
353
|
+
.nf
|
354
|
+
|
355
|
+
$ git config \-\-global github.user
|
356
|
+
.
|
357
|
+
.fi
|
358
|
+
.
|
359
|
+
.IP "" 0
|
360
|
+
.
|
361
|
+
.P
|
362
|
+
Or, set the GitHub username with:
|
363
|
+
.
|
364
|
+
.IP "" 4
|
365
|
+
.
|
366
|
+
.nf
|
367
|
+
|
368
|
+
$ git config \-\-global github.user <username>
|
369
|
+
.
|
370
|
+
.fi
|
371
|
+
.
|
372
|
+
.IP "" 0
|
373
|
+
.
|
374
|
+
.P
|
375
|
+
See \fIhttp://github.com/guides/local\-github\-config\fR for more information.
|
376
|
+
.
|
377
|
+
.SH "BUGS"
|
378
|
+
\fIhttp://github.com/defunkt/hub/issues\fR
|
379
|
+
.
|
380
|
+
.SH "AUTHOR"
|
381
|
+
Chris Wanstrath :: chris@ozmm.org :: @defunkt
|
382
|
+
.
|
383
|
+
.SH "SEE ALSO"
|
384
|
+
git(1), git\-clone(1), git\-remote(1), git\-init(1),\fIhttp://github.com\fR, \fIhttp://github.com/defunkt/hub\fR
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{vibedeck-comma}
|
8
|
+
s.version = "0.4.2"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Marcus Crafter"]
|
12
|
+
s.date = %q{2010-10-19}
|
13
|
+
s.description = %q{Ruby Comma Seperated Values generation library}
|
14
|
+
s.email = %q{crafterm@redartisan.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"README.rdoc"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
".gitignore",
|
20
|
+
"MIT-LICENSE",
|
21
|
+
"README.rdoc",
|
22
|
+
"Rakefile",
|
23
|
+
"VERSION",
|
24
|
+
"comma.gemspec",
|
25
|
+
"init.rb",
|
26
|
+
"lib/comma.rb",
|
27
|
+
"lib/comma/array.rb",
|
28
|
+
"lib/comma/association_proxy.rb",
|
29
|
+
"lib/comma/extractors.rb",
|
30
|
+
"lib/comma/generator.rb",
|
31
|
+
"lib/comma/named_scope.rb",
|
32
|
+
"lib/comma/object.rb",
|
33
|
+
"lib/comma/render_as_csv.rb",
|
34
|
+
"spec/comma/ar_spec.rb",
|
35
|
+
"spec/comma/comma_spec.rb",
|
36
|
+
"spec/comma/extractors_spec.rb",
|
37
|
+
"spec/spec.opts",
|
38
|
+
"spec/spec_helper.rb",
|
39
|
+
"sudo"
|
40
|
+
]
|
41
|
+
s.homepage = %q{http://github.com/crafterm/comma}
|
42
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
43
|
+
s.require_paths = ["lib"]
|
44
|
+
s.rubyforge_project = %q{comma}
|
45
|
+
s.rubygems_version = %q{1.3.7}
|
46
|
+
s.summary = %q{Ruby Comma Seperated Values generation library}
|
47
|
+
s.test_files = [
|
48
|
+
"spec/comma/ar_spec.rb",
|
49
|
+
"spec/comma/comma_spec.rb",
|
50
|
+
"spec/comma/extractors_spec.rb",
|
51
|
+
"spec/spec_helper.rb"
|
52
|
+
]
|
53
|
+
|
54
|
+
if s.respond_to? :specification_version then
|
55
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
56
|
+
s.specification_version = 3
|
57
|
+
|
58
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
59
|
+
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
60
|
+
s.add_runtime_dependency(%q<activesupport>, [">= 2.2.2"])
|
61
|
+
else
|
62
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
63
|
+
s.add_dependency(%q<activesupport>, [">= 2.2.2"])
|
64
|
+
end
|
65
|
+
else
|
66
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
67
|
+
s.add_dependency(%q<activesupport>, [">= 2.2.2"])
|
68
|
+
end
|
69
|
+
end
|