lipsum-api 0.3 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/lipsum +34 -0
- data/test/lipsum_test.rb +0 -1
- metadata +8 -7
data/bin/lipsum
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Usage: $ lipsum words 5
|
4
|
+
# $ lipsum paragraphs 5
|
5
|
+
# $ lipsum lists 10
|
6
|
+
# $ lipsum bytes 120
|
7
|
+
# $ lipsum w|p|l|b number
|
8
|
+
#
|
9
|
+
require 'rubygems'
|
10
|
+
require 'lipsum'
|
11
|
+
|
12
|
+
def print_usage
|
13
|
+
STDERR.puts "Usage: "
|
14
|
+
STDERR.puts "lipsum what amount"
|
15
|
+
STDERR.puts " Where 'what' can be 'words', 'paragraphs', 'lists', or 'bytes'"
|
16
|
+
STDOUT.puts " 'amount' is the number of words, paragraphs, lists or bytes to retrieve"
|
17
|
+
puts ARGV.inspect
|
18
|
+
exit(1)
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
print_usage if ARGV.size < 2
|
23
|
+
|
24
|
+
|
25
|
+
command = ARGV[0]
|
26
|
+
amount = ARGV[1].to_i
|
27
|
+
start_with_lorem = ARGV.include?('--start-with-lorem') || ARGV.include?('-s')
|
28
|
+
|
29
|
+
if !['words', 'paragraphs', 'lists', 'bytes'].include?(command)
|
30
|
+
print_usage
|
31
|
+
end
|
32
|
+
|
33
|
+
opts = start_with_lorem ? {:start_with_lorem => true} : {}
|
34
|
+
STDOUT.puts amount.send("lipsum_#{command}", opts)
|
data/test/lipsum_test.rb
CHANGED
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lipsum-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 3
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: "0.
|
8
|
+
- 4
|
9
|
+
version: "0.4"
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- "Vicente Reig Rinc\xC3\xB3n de Arellano"
|
@@ -14,8 +14,8 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-10-
|
18
|
-
default_executable:
|
17
|
+
date: 2010-10-19 00:00:00 +02:00
|
18
|
+
default_executable: lipsum
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: nokogiri
|
@@ -75,13 +75,14 @@ dependencies:
|
|
75
75
|
version_requirements: *id004
|
76
76
|
description:
|
77
77
|
email: vicente.reig@gmail.com
|
78
|
-
executables:
|
79
|
-
|
78
|
+
executables:
|
79
|
+
- lipsum
|
80
80
|
extensions: []
|
81
81
|
|
82
82
|
extra_rdoc_files: []
|
83
83
|
|
84
84
|
files:
|
85
|
+
- bin/lipsum
|
85
86
|
- lib/lipsum.rb
|
86
87
|
- test/fixtures/lipsum_bytes.html
|
87
88
|
- test/fixtures/lipsum_words.html
|