LoremKnight 3.3.0 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/Gemfile +2 -1
- data/Gemfile.lock +10 -6
- data/LICENSE +21 -0
- data/README.md +103 -16
- data/Rakefile +0 -0
- data/bin/{LoremKnight → lorem-knight} +2 -2
- data/lib/lorem-knight.rb +7 -0
- data/lib/lorem-knight/about.rb +3 -0
- data/lib/lorem-knight/cli.rb +68 -0
- data/lib/lorem-knight/panther.rb +97 -0
- data/lib/{words.txt → lorem-knight/raw/words.txt} +0 -0
- data/lib/lorem-knight/version.rb +3 -0
- data/lorem-knight.gemspec +29 -0
- data/pkg/LoremKnight-3.4.0.gem +0 -0
- data/spec/lorem-knight/lorem_test.rb +40 -0
- data/spec/spec_helper.rb +2 -0
- metadata +36 -29
- data/0.6.9 +0 -4
- data/Tiger.gemspec +0 -25
- data/lib/cli.rb +0 -55
- data/lib/tiger.rb +0 -112
- data/spec/lorem_test.rb +0 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d24f51e39fb08306f8ed9b31bb0ac7da4626f4e9
|
4
|
+
data.tar.gz: 9545b1a6e22e66a45b927058b4f0ca6d42ddb2b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3b5b7e5f16f152c70168159f2ec2b33c656bc9023d6042ef917eaf81284d70c2e7fbe3f0d8bddb9027c8aa4e52e13b09be500a3d3adeb8393b3735afc0e69ab
|
7
|
+
data.tar.gz: 4421766b95587ecdc11eaea882cb7fb67bff22b8d48d452189a9a25a632d420dd2bc7a3d4b6271a14ff998a1ff6fd579ff6e37029fa561ef2bafc7ec930d2958
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
LoremKnight (3.
|
4
|
+
LoremKnight (3.4.0)
|
5
5
|
clipboard
|
6
6
|
ffi
|
7
7
|
rainbow
|
8
|
-
thor
|
8
|
+
thor (~> 0.19)
|
9
9
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
@@ -13,7 +13,10 @@ GEM
|
|
13
13
|
clipboard (1.1.1)
|
14
14
|
diff-lcs (1.3)
|
15
15
|
ffi (1.9.18)
|
16
|
-
|
16
|
+
ffi (1.9.18-java)
|
17
|
+
rainbow (2.2.2)
|
18
|
+
rake
|
19
|
+
rake (12.0.0)
|
17
20
|
rspec (3.5.0)
|
18
21
|
rspec-core (~> 3.5.0)
|
19
22
|
rspec-expectations (~> 3.5.0)
|
@@ -27,15 +30,16 @@ GEM
|
|
27
30
|
diff-lcs (>= 1.2.0, < 2.0)
|
28
31
|
rspec-support (~> 3.5.0)
|
29
32
|
rspec-support (3.5.0)
|
30
|
-
thor (0.
|
33
|
+
thor (0.20.0)
|
31
34
|
|
32
35
|
PLATFORMS
|
36
|
+
java
|
33
37
|
ruby
|
34
38
|
|
35
39
|
DEPENDENCIES
|
36
40
|
LoremKnight!
|
37
41
|
bundler (~> 1.6)
|
38
|
-
rspec
|
42
|
+
rspec (~> 3)
|
39
43
|
|
40
44
|
BUNDLED WITH
|
41
|
-
1.
|
45
|
+
1.16.2
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 guga katsiashvili
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,17 +1,104 @@
|
|
1
|
+
LoremKnight
|
2
|
+
=================
|
3
|
+
|
4
|
+
Generate Lorem from georgian poem "The Knight in the Panther's Skin" quickly in Terminal! ( see wiki for more )
|
5
|
+
|
6
|
+
![LoremKnight shota](http://www.picz.ge/img/s3/1610/11/c/cec3d5d8af8c.jpg)
|
7
|
+
|
8
|
+
|
9
|
+
## Setup
|
10
|
+
|
11
|
+
1. Install `gem install LoremKnight`.
|
12
|
+
2. Linux: You will need the xclip or xsel program. On debian/ubuntu this is: `sudo apt-get install xclip` for Terminal auto copy/paste support
|
13
|
+
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
----------
|
17
|
+
|
18
|
+
_From Terminal_
|
19
|
+
|
20
|
+
|
21
|
+
**Type in terminal :**
|
22
|
+
|
23
|
+
generate Paragraphs - `LoremKnight p QUANTITY (from 1 to infinity :d )`
|
24
|
+
|
25
|
+
generate Sentences - `LoremKnight s QUANTITY`
|
26
|
+
|
27
|
+
generate Words - `LoremKnight QUANTITY`
|
28
|
+
|
29
|
+
generate Html lists - `LoremKnight l QUANTITY`
|
30
|
+
|
31
|
+
**Additionally** add `--pre` and of any command , generated lorem will start with "რომელმან შექმნა სამყარო"
|
32
|
+
|
33
|
+
|
34
|
+
----------
|
35
|
+
|
36
|
+
|
37
|
+
**_From Ruby Code_**
|
38
|
+
|
39
|
+
***Getters***
|
40
|
+
|
41
|
+
function | What it does
|
42
|
+
---------|-------------
|
43
|
+
Tiger.getSentence(n) | returns lorem sentences
|
44
|
+
Tiger.getWords(n) | returns words
|
45
|
+
Tiger.getParagraph(n) | returns paragraphs
|
46
|
+
Tiger.getList(n) | returns Lists
|
47
|
+
|
48
|
+
***Setters***
|
49
|
+
|
50
|
+
function | What it does
|
51
|
+
---------|-------------
|
52
|
+
Tiger.setSentenceSize(int n)| changes number of words in sentences , default is 7
|
53
|
+
Tiger.setParagraphSize(int n) | changes number of words in paragraph, default is 70
|
54
|
+
Tiger.setListSize(int n) | changes number of lists generated on each, default is 5
|
55
|
+
Tiger.setWordMaximumLength(int n) | changes max length of words generated , default is 25
|
56
|
+
Tiger.setContentType(String type'html' or 'raw') | sets content type html or raw
|
57
|
+
Tiger.hasPreSentence(boolean n) | indicates whether have preSentence or not ('რომელმან შექმნა სამყარო')
|
58
|
+
|
59
|
+
***Example Code***
|
60
|
+
|
61
|
+
|
62
|
+
class loremGenerator
|
63
|
+
Tiger.setSentenceSize(10) // changing default size of sentences generated
|
64
|
+
Tiger.setContentType('HTML') // setting content type to html , so it will generate lorem with html tags
|
65
|
+
Tiger.hasPreSentence(true) // indicating that every sentence or paragraph or list will start with presentence : ''რომელმან შექმნა სამყარო'
|
66
|
+
|
67
|
+
def self.generateLorem(type,howMuch)
|
68
|
+
case(type)
|
69
|
+
when 'list'
|
70
|
+
puts "#{Tiger.getList(howMuch)}"
|
71
|
+
when 'paragraph'
|
72
|
+
puts "#{Tiger.getParagraph(howMuch)}"
|
73
|
+
when 'sentence'
|
74
|
+
puts "#{Tiger.getSentence(howMuch)}"
|
75
|
+
when 'words'
|
76
|
+
puts "#{Tiger.getWords(howMuch)}"
|
77
|
+
else
|
78
|
+
puts "wrong type"
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# Than you can simply
|
84
|
+
|
85
|
+
tiger = loremGenerator.new
|
86
|
+
tiger.generateLorem('paragraph',3) // will output 3 paragraph lorems :)
|
87
|
+
|
88
|
+
----------
|
89
|
+
|
90
|
+
|
91
|
+
### _From Anywhere using Api_
|
92
|
+
Visit [LoremKnight Api doc here ](http://www.loremknight.me/api)
|
93
|
+
## Development
|
94
|
+
|
95
|
+
dependencies used :
|
96
|
+
* Thor - for terminal support
|
97
|
+
* clipboard & ffi - for automatic copy/paste from terminal
|
98
|
+
* rainbow - for cheerfulness and colorfulness
|
99
|
+
|
1
100
|
<a href="https://badge.fury.io/rb/LoremKnight"><img src="https://badge.fury.io/rb/LoremKnight.svg" alt="Gem Version" height="18"></a>
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
<br>
|
7
|
-
<img src = "http://www.picz.ge/img/s3/1610/11/c/cec3d5d8af8c.jpg" />
|
8
|
-
<hr>
|
9
|
-
<h3> Gettings started </h3>
|
10
|
-
<ul>
|
11
|
-
<li> require 'tiger' </li>
|
12
|
-
<li> or gem 'LoremKnight', '~> 0.0.0' </li>
|
13
|
-
<li> Tiger.generate(sentence,words,filename) </li>
|
14
|
-
</ul>
|
15
|
-
<footer>
|
16
|
-
<h4> <a href = "https://rubygems.org/gems/LoremKnight">you can checkout gem on RubyGems.org </a> </h4>
|
17
|
-
</footer>
|
101
|
+
|
102
|
+
[![Build Status](https://travis-ci.org/gugakatsi/LoremKnight.svg?branch=master)](https://travis-ci.org/gugakatsi/LoremKnight)
|
103
|
+
|
104
|
+
[![Dependency Status](https://gemnasium.com/badges/github.com/gugakatsi/LoremKnight.svg)](https://gemnasium.com/github.com/gugakatsi/LoremKnight)
|
data/Rakefile
CHANGED
File without changes
|
data/lib/lorem-knight.rb
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'lorem-knight'
|
3
|
+
require 'rainbow'
|
4
|
+
require 'rainbow/ext/string'
|
5
|
+
require 'clipboard'
|
6
|
+
|
7
|
+
#trap("SIGINT") { exit! }
|
8
|
+
|
9
|
+
module LoremKnight
|
10
|
+
def self.show_and_copy(lorem)
|
11
|
+
puts "#{lorem}".color("#DCE35F")
|
12
|
+
Clipboard.copy(lorem)
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.configure_lorem(options, panther)
|
16
|
+
panther.set_content_type(options[:html] ? 'html' : 'raw')
|
17
|
+
panther.has_pre_sentence = options[:pre]
|
18
|
+
end
|
19
|
+
|
20
|
+
class CLI < Thor
|
21
|
+
include Thor::Actions
|
22
|
+
|
23
|
+
@@panther = LoremKnight::Panther.new
|
24
|
+
map %w(-v --version) => :version
|
25
|
+
map %w(-i --about) => :about
|
26
|
+
|
27
|
+
desc 'version', 'lorem-knight version'
|
28
|
+
def version
|
29
|
+
puts LoremKnight::VERSION
|
30
|
+
end
|
31
|
+
|
32
|
+
desc 'about', 'about LoremKnight'
|
33
|
+
def about
|
34
|
+
puts LoremKnight::ABOUT
|
35
|
+
end
|
36
|
+
|
37
|
+
desc "s quantity", "generates LoremKnight sentences"
|
38
|
+
option :pre, :type => :boolean
|
39
|
+
option :html, :type => :boolean
|
40
|
+
def s(quantity)
|
41
|
+
LoremKnight::configure_lorem(options, @@panther)
|
42
|
+
LoremKnight::show_and_copy(@@panther.get_sentence(quantity.to_i))
|
43
|
+
end
|
44
|
+
|
45
|
+
desc "p quantity", "generates LoremKnight paragraphs"
|
46
|
+
option :pre, :type => :boolean
|
47
|
+
option :html, :type => :boolean
|
48
|
+
def p(quantity)
|
49
|
+
LoremKnight::configure_lorem(options, @@panther)
|
50
|
+
LoremKnight::show_and_copy(@@panther.get_paragraph(quantity.to_i))
|
51
|
+
end
|
52
|
+
|
53
|
+
desc "w quantity", "generates LoremKnight words"
|
54
|
+
option :pre, :type => :boolean
|
55
|
+
option :html, :type => :boolean
|
56
|
+
def w(quantity)
|
57
|
+
LoremKnight::configure_lorem(options, @@panther)
|
58
|
+
LoremKnight::show_and_copy(@@panther.get_words(quantity.to_i))
|
59
|
+
end
|
60
|
+
|
61
|
+
desc "l quantity", "generates LoremKnight html <ul> - s"
|
62
|
+
option :pre, :type => :boolean
|
63
|
+
def l(quantity)
|
64
|
+
LoremKnight::configure_lorem(options, @@panther)
|
65
|
+
LoremKnight::show_and_copy(@@panther.get_list(quantity.to_i))
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
$source_location = File.dirname(__FILE__)
|
2
|
+
|
3
|
+
module LoremKnight
|
4
|
+
class Panther
|
5
|
+
attr_accessor :paragraph_size
|
6
|
+
attr_accessor :sentence_size
|
7
|
+
attr_accessor :list_size
|
8
|
+
attr_accessor :word_length
|
9
|
+
attr_accessor :has_pre_sentence
|
10
|
+
|
11
|
+
def initialize
|
12
|
+
#
|
13
|
+
source = File.open("#{$source_location}/raw/words.txt", "r+")
|
14
|
+
@content = source.sysread(source.size).split(" ")
|
15
|
+
|
16
|
+
# initialize default lorem config vars
|
17
|
+
@paragraph_size = 70
|
18
|
+
@sentence_size = 7
|
19
|
+
@list_size = 5
|
20
|
+
@word_length = 20
|
21
|
+
@list_standart_size = 10
|
22
|
+
|
23
|
+
@content_type = "RAW"
|
24
|
+
@has_pre_sentence = false
|
25
|
+
end
|
26
|
+
|
27
|
+
def get_sentence(quantity)
|
28
|
+
generate_lorem(quantity, @sentence_size)
|
29
|
+
end
|
30
|
+
|
31
|
+
def get_paragraph(quantity)
|
32
|
+
generate_lorem(quantity, @paragraph_size)
|
33
|
+
end
|
34
|
+
|
35
|
+
def get_list(quantity)
|
36
|
+
lists = ""
|
37
|
+
quantity.to_i.times { lists += generate_list }
|
38
|
+
return lists
|
39
|
+
end
|
40
|
+
|
41
|
+
def get_words(quantity)
|
42
|
+
words = ""
|
43
|
+
word_array = words.split(" ")
|
44
|
+
|
45
|
+
while word_array.length < quantity.to_i do
|
46
|
+
pending_word = @content[rand(@content.size)]
|
47
|
+
words += pending_word.length <= @word_length ? pending_word + " " : ""
|
48
|
+
word_array = words.split(" ")
|
49
|
+
end
|
50
|
+
return words.force_encoding('UTF-8')
|
51
|
+
end
|
52
|
+
|
53
|
+
def set_content_type(type)
|
54
|
+
case(type.to_s)
|
55
|
+
when "html"
|
56
|
+
@content_type = "text/html"
|
57
|
+
when "raw"
|
58
|
+
@content_type = "RAW"
|
59
|
+
else
|
60
|
+
@content_type = "RAW"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def generate_lorem(quantity, length, prefix = '')
|
65
|
+
pre_sentence = @has_pre_sentence == true ? "რომელმან შექმნა სამყარო" : ""
|
66
|
+
lorem = @content_type == 'text/html' ? "<p> #{pre_sentence} " : "#{pre_sentence} "
|
67
|
+
|
68
|
+
quantity.times do |i|
|
69
|
+
length.times do
|
70
|
+
lorem += (@content[rand(@content.size)] + " ").force_encoding('UTF-8')
|
71
|
+
end
|
72
|
+
case(@content_type)
|
73
|
+
when "text/html"
|
74
|
+
lorem += i != quantity - 1 ? " </p> <p> #{pre_sentence} " : " </p>"
|
75
|
+
when "RAW"
|
76
|
+
lorem += i != quantity - 1 ? "\n #{pre_sentence} " : ""
|
77
|
+
end
|
78
|
+
end
|
79
|
+
return lorem.force_encoding('UTF-8')
|
80
|
+
end
|
81
|
+
|
82
|
+
def generate_list
|
83
|
+
pre_sentence = @has_pre_sentence == true ? "რომელმან შექმნა სამყარო" : ""
|
84
|
+
list = "<ul><li>"
|
85
|
+
randomSize = rand(20)
|
86
|
+
|
87
|
+
@list_standart_size.times do |x|
|
88
|
+
list += " #{pre_sentence}"
|
89
|
+
randomSize.times do |y|
|
90
|
+
list += y != randomSize-1 ? " #{@content[rand(@content.size-1)]}" : " #{@content[rand(@content.size-1)]}</li>"
|
91
|
+
end
|
92
|
+
list += x != @list_standart_size-1 ? "<li>" : "</ul>"
|
93
|
+
end
|
94
|
+
return list.force_encoding('UTF-8')
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
File without changes
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.expand_path("../lib/lorem-knight/version", __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
#Metadata
|
6
|
+
s.name = "LoremKnight"
|
7
|
+
s.version = LoremKnight::VERSION
|
8
|
+
s.authors = ["guga katsiashvili"]
|
9
|
+
s.email = ["guga.katsiashvili@gmail.com"]
|
10
|
+
s.homepage = "http://www.loremknight.me/"
|
11
|
+
s.summary = %q{Ruby gem , generating lorem ( Directly from your terminal )from georgian poem "The Knight in the Panther's Skin" http://www.loremknight.me/ Edit}
|
12
|
+
s.description = %q{Ruby gem , generating lorem ( Directly from your terminal )from georgian poem "The Knight in the Panther's Skin" http://www.loremknight.me/ Edit}
|
13
|
+
s.licenses = ['MIT']
|
14
|
+
s.post_install_message = "LoremKnight succesfully installed , feel free to use with terminal"
|
15
|
+
|
16
|
+
#Manifest
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ['lib']
|
21
|
+
|
22
|
+
s.add_runtime_dependency 'thor', '~> 0.19'
|
23
|
+
s.add_dependency 'rainbow'
|
24
|
+
s.add_dependency 'clipboard'
|
25
|
+
s.add_dependency 'ffi'
|
26
|
+
|
27
|
+
s.add_development_dependency 'rspec', '~> 3'
|
28
|
+
s.add_development_dependency "bundler", "~> 1.6"
|
29
|
+
end
|
Binary file
|
@@ -0,0 +1,40 @@
|
|
1
|
+
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), "..", "lib")))
|
2
|
+
require 'lorem-knight/panther.rb'
|
3
|
+
|
4
|
+
describe LoremKnight::Panther do
|
5
|
+
|
6
|
+
subject { LoremKnight::Panther.new }
|
7
|
+
let(:panther) { subject }
|
8
|
+
|
9
|
+
before do
|
10
|
+
panther.word_length = 20;
|
11
|
+
panther.sentence_size = 10;
|
12
|
+
panther.paragraph_size = 80;
|
13
|
+
end
|
14
|
+
|
15
|
+
describe "LoremKnight w 10 maxW 10" do
|
16
|
+
it "Test if lorem outputs 10 words with max length of 10 xD" do
|
17
|
+
expect(panther.get_words(10).chomp.length).to be <= 10*10
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "setStandartSentenceSize(size)" do
|
22
|
+
it "tests if setters works : sentence" do
|
23
|
+
expect(panther.get_sentence(1).split(" ").length).to be == 10
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "setStandartSentenceSize(size)" do
|
28
|
+
it "tests if setters works : paragraph" do
|
29
|
+
expect(panther.get_paragraph(1).split(" ").length).to be == 80
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "hasPreSentence(true)" do
|
34
|
+
it "test if every sentence starts with romelman sheqmna samyaro" do
|
35
|
+
panther.has_pre_sentence = true;
|
36
|
+
expect(panther.get_sentence(1).chomp).to start_with('რომელმან შექმნა სამყარო')
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: LoremKnight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- guga katsiashvili
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
19
|
+
version: '0.19'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
26
|
+
version: '0.19'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rainbow
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,58 +67,64 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '3'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '3'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: bundler
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '1.6'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
97
|
-
description:
|
98
|
-
|
99
|
-
email:
|
96
|
+
version: '1.6'
|
97
|
+
description: Ruby gem , generating lorem ( Directly from your terminal )from georgian
|
98
|
+
poem "The Knight in the Panther's Skin" http://www.loremknight.me/ Edit
|
99
|
+
email:
|
100
|
+
- guga.katsiashvili@gmail.com
|
100
101
|
executables:
|
101
|
-
-
|
102
|
+
- lorem-knight
|
102
103
|
extensions: []
|
103
104
|
extra_rdoc_files: []
|
104
105
|
files:
|
105
106
|
- ".travis.yml"
|
106
|
-
- 0.6.9
|
107
107
|
- Gemfile
|
108
108
|
- Gemfile.lock
|
109
|
+
- LICENSE
|
109
110
|
- README.md
|
110
111
|
- Rakefile
|
111
|
-
-
|
112
|
-
-
|
113
|
-
- lib/
|
114
|
-
- lib/
|
115
|
-
- lib/
|
116
|
-
-
|
112
|
+
- bin/lorem-knight
|
113
|
+
- lib/lorem-knight.rb
|
114
|
+
- lib/lorem-knight/about.rb
|
115
|
+
- lib/lorem-knight/cli.rb
|
116
|
+
- lib/lorem-knight/panther.rb
|
117
|
+
- lib/lorem-knight/raw/words.txt
|
118
|
+
- lib/lorem-knight/version.rb
|
119
|
+
- lorem-knight.gemspec
|
120
|
+
- pkg/LoremKnight-3.4.0.gem
|
121
|
+
- spec/lorem-knight/lorem_test.rb
|
122
|
+
- spec/spec_helper.rb
|
117
123
|
homepage: http://www.loremknight.me/
|
118
124
|
licenses:
|
119
125
|
- MIT
|
120
126
|
metadata: {}
|
121
|
-
post_install_message:
|
127
|
+
post_install_message: LoremKnight succesfully installed , feel free to use with terminal
|
122
128
|
rdoc_options: []
|
123
129
|
require_paths:
|
124
130
|
- lib
|
@@ -134,8 +140,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
140
|
version: '0'
|
135
141
|
requirements: []
|
136
142
|
rubyforge_project:
|
137
|
-
rubygems_version: 2.
|
143
|
+
rubygems_version: 2.6.14
|
138
144
|
signing_key:
|
139
145
|
specification_version: 4
|
140
|
-
summary:
|
146
|
+
summary: Ruby gem , generating lorem ( Directly from your terminal )from georgian
|
147
|
+
poem "The Knight in the Panther's Skin" http://www.loremknight.me/ Edit
|
141
148
|
test_files: []
|
data/0.6.9
DELETED
data/Tiger.gemspec
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
|
5
|
-
Gem::Specification.new do |s|
|
6
|
-
s.name = 'LoremKnight'
|
7
|
-
s.version = '3.3.0'
|
8
|
-
s.date = '2017-04-16'
|
9
|
-
s.summary = "The Knight in the Panther's Skin!"
|
10
|
-
s.description = "lorem generating words from georgian epic poem : The Knight in the Panther's Skin,now with Terminal support,offline mode <3"
|
11
|
-
s.authors = ["Guga katsiashvili"]
|
12
|
-
s.email = 'guga.katsiashvili@gmail.com'
|
13
|
-
s.files = `git ls-files -z`.split("\x0")
|
14
|
-
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
15
|
-
s.homepage =
|
16
|
-
'http://www.loremknight.me/'
|
17
|
-
s.license = 'MIT'
|
18
|
-
s.add_dependency 'thor'
|
19
|
-
s.add_dependency 'rainbow'
|
20
|
-
s.add_dependency 'clipboard'
|
21
|
-
s.add_dependency 'ffi'
|
22
|
-
s.add_development_dependency "bundler", "~> 1.6"
|
23
|
-
s.add_development_dependency "rspec"
|
24
|
-
s.require_paths = ["lib"]
|
25
|
-
end
|
data/lib/cli.rb
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
require 'thor'
|
2
|
-
require 'tiger.rb'
|
3
|
-
require 'rainbow'
|
4
|
-
require 'rainbow/ext/string'
|
5
|
-
require 'clipboard'
|
6
|
-
|
7
|
-
module Terminal
|
8
|
-
def self.showAndCopy(lorem)
|
9
|
-
puts "#{lorem}".color("#DCE35F")
|
10
|
-
Clipboard.copy(lorem)
|
11
|
-
end
|
12
|
-
|
13
|
-
class Knight < Thor
|
14
|
-
desc "s NUMBER","generates LoremKnight sentences"
|
15
|
-
option :pre,:type => :boolean
|
16
|
-
option :html,:type => :boolean
|
17
|
-
|
18
|
-
def s(number)
|
19
|
-
Tiger.setContentType(options[:html] ? 'html' : 'raw')
|
20
|
-
Tiger.hasPreSentence(options[:pre])
|
21
|
-
lorem = Tiger.getSentence(number.to_i)
|
22
|
-
Terminal::showAndCopy(lorem)
|
23
|
-
end
|
24
|
-
|
25
|
-
desc "p NUMBER","generates LoremKnight paragraphs"
|
26
|
-
option :pre,:type => :boolean
|
27
|
-
option :html,:type => :boolean
|
28
|
-
|
29
|
-
def p(number)
|
30
|
-
Tiger.setContentType(options[:html] ? 'html' : 'raw')
|
31
|
-
Tiger.hasPreSentence(options[:pre])
|
32
|
-
lorem = Tiger.getParagraph(number.to_i)
|
33
|
-
Terminal::showAndCopy(lorem)
|
34
|
-
end
|
35
|
-
|
36
|
-
desc "w NUMBER","generates LoremKnight words"
|
37
|
-
option :pre,:type => :boolean
|
38
|
-
option :html,:type => :boolean
|
39
|
-
|
40
|
-
def w(number)
|
41
|
-
Tiger.hasPreSentence(options[:pre])
|
42
|
-
lorem = Tiger.getWords(number.to_i)
|
43
|
-
Terminal::showAndCopy(lorem)
|
44
|
-
end
|
45
|
-
|
46
|
-
desc "l NUMBER","generates LoremKnight lists <html>"
|
47
|
-
option :pre,:type => :boolean
|
48
|
-
|
49
|
-
def l(number)
|
50
|
-
Tiger.hasPreSentence(options[:pre])
|
51
|
-
lorem = Tiger.getList(number.to_i)
|
52
|
-
Terminal::showAndCopy(lorem)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
data/lib/tiger.rb
DELETED
@@ -1,112 +0,0 @@
|
|
1
|
-
$source_location = File.dirname(__FILE__)
|
2
|
-
require 'open-uri'
|
3
|
-
|
4
|
-
class Tiger
|
5
|
-
|
6
|
-
@content = ""
|
7
|
-
@paragraphStandartSize = 70;
|
8
|
-
@sentenceStandartSize = 7;
|
9
|
-
@listStandartSize = 5;
|
10
|
-
@wordLength = 20;
|
11
|
-
|
12
|
-
@contentType = "RAW"
|
13
|
-
@hasPreSentence = false
|
14
|
-
|
15
|
-
source = File.open("#{$source_location}/words.txt","r+")
|
16
|
-
@content = source.sysread(source.size).split(" ")
|
17
|
-
|
18
|
-
def self.getSentence(sentenceN)
|
19
|
-
lorem(sentenceN,@sentenceStandartSize,'')
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.getParagraph(paragraphN)
|
23
|
-
lorem(paragraphN,@paragraphStandartSize,'')
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.getList(listN)
|
27
|
-
lists = ""
|
28
|
-
listN.to_i.times do
|
29
|
-
lists += generateList
|
30
|
-
end
|
31
|
-
return lists
|
32
|
-
end
|
33
|
-
|
34
|
-
def self.getWords(wordN)
|
35
|
-
@words = ""
|
36
|
-
@wordArray = @words.split(" ")
|
37
|
-
|
38
|
-
while @wordArray.length < wordN.to_i do
|
39
|
-
pendingWord = @content[rand(@content.size)]
|
40
|
-
@words += pendingWord.length <= @wordLength ? pendingWord+" " : ""
|
41
|
-
@wordArray = @words.split(" ")
|
42
|
-
end
|
43
|
-
return @words.force_encoding('UTF-8');
|
44
|
-
end
|
45
|
-
|
46
|
-
def self.setSentenceSize(size)
|
47
|
-
@sentenceStandartSize = size.to_i > 0 ? size.to_i : @sentenceStandartSize;
|
48
|
-
end
|
49
|
-
|
50
|
-
def self.setParagraphSize(size)
|
51
|
-
@paragraphStandartSize = size.to_i > 0 ? size.to_i : @paragraphStandartSize;
|
52
|
-
end
|
53
|
-
|
54
|
-
def self.setListSize(size)
|
55
|
-
@listStandartSize = size.to_i > 0 ? size.to_i : @listStandartSize;
|
56
|
-
end
|
57
|
-
|
58
|
-
def self.setWordMaximumLength(length)
|
59
|
-
@wordLength = length.to_i > 0 ? length.to_i : @wordLength;
|
60
|
-
end
|
61
|
-
|
62
|
-
def self.setContentType(type)
|
63
|
-
case(type.to_s)
|
64
|
-
when "html"
|
65
|
-
@contentType = "text/html"
|
66
|
-
when "raw"
|
67
|
-
@contentType = "RAW"
|
68
|
-
else
|
69
|
-
@contentType = "RAW"
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
def self.hasPreSentence(has)
|
74
|
-
@hasPreSentence = has
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
def lorem(header,body,startWith = '')
|
79
|
-
@preSentence = @hasPreSentence == true ? "რომელმან შექმნა სამყარო" : ""
|
80
|
-
@sentence = @contentType == 'text/html' ? "<p> #{@preSentence} " : " #{@preSentence} "
|
81
|
-
|
82
|
-
header.times do |x|
|
83
|
-
body.times do
|
84
|
-
randomWord = @content[rand(@content.size)].force_encoding('UTF-8')
|
85
|
-
@sentence += randomWord+" "
|
86
|
-
end
|
87
|
-
if @contentType == 'text/html'
|
88
|
-
@sentence += x != header - 1 ? " </p> <br> <br> <p> #{@preSentence} " : " </p> <br> "
|
89
|
-
elsif @contentType == 'RAW'
|
90
|
-
@sentence += x != header-1 ? " \n \n #{@preSentence} " : " \n "
|
91
|
-
end
|
92
|
-
end
|
93
|
-
return @sentence.force_encoding('UTF-8')
|
94
|
-
end
|
95
|
-
|
96
|
-
def generateList
|
97
|
-
@preSentence = @hasPreSentence == true ? "რომელმან შექმნა სამყარო" : ""
|
98
|
-
|
99
|
-
list = "<ul><li>"
|
100
|
-
randomSize = rand(20) #setRandBound
|
101
|
-
|
102
|
-
@listStandartSize.times do |x|
|
103
|
-
list += " #{@preSentence}"
|
104
|
-
randomSize.times do |y|
|
105
|
-
list += y != randomSize-1 ? " #{@content[rand(@content.size-1)]}" : " #{@content[rand(@content.size-1)]}</li>"
|
106
|
-
end
|
107
|
-
list += x != @listStandartSize-1 ? "<li>" : "</ul><br><br>"
|
108
|
-
end
|
109
|
-
|
110
|
-
return list.force_encoding('UTF-8')
|
111
|
-
|
112
|
-
end
|
data/spec/lorem_test.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), "..", "lib")))
|
2
|
-
require 'tiger.rb'
|
3
|
-
|
4
|
-
describe Tiger do
|
5
|
-
before do
|
6
|
-
Tiger.setWordMaximumLength(20);
|
7
|
-
Tiger.setSentenceSize(10);
|
8
|
-
Tiger.setParagraphSize(80);
|
9
|
-
end
|
10
|
-
|
11
|
-
describe "LoremKnight w 10 maxW 10" do
|
12
|
-
it "Test if lorem outputs 10 words with max length of 10 xD" do
|
13
|
-
expect(Tiger.getWords(10).chomp.length).to be <= 10*10
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
describe "setStandartSentenceSize(size)" do
|
18
|
-
it "tests if setters works : sentence" do
|
19
|
-
expect(Tiger.getSentence(1).split(" ").length).to be == 10
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
describe "setStandartSentenceSize(size)" do
|
24
|
-
it "tests if setters works : paragraph" do
|
25
|
-
expect(Tiger.getParagraph(1).split(" ").length).to be == 80
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
describe "hasPreSentence(true)" do
|
30
|
-
it "test if every sentence starts with romelman sheqmna samyaro" do
|
31
|
-
Tiger.hasPreSentence(true);
|
32
|
-
expect(Tiger.getSentence(1).chomp).to start_with(' რომელმან შექმნა სამყარო')
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|