breizhipsum 0.0.1

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6bda4ba2388cf1ffed72384c4d0dd09c24ec65cb
4
+ data.tar.gz: b0c1c6841fde3ebbbf2c78924a93eeb0c11ae8bc
5
+ SHA512:
6
+ metadata.gz: 7e7c2e4aee7fa815b11b7b2c41f8e53b0edf3317a227d5d200d72c463cbaa165eda39c3f9f7ab37f95d5eb1bbafbed59774b4ff1b8dba2362356b0ff3c5de093
7
+ data.tar.gz: 1c2b0199213174153d9b8dd761073425c4f5baa6f60e555ddda0fac7752aff341fcae2543392d30c52632625c911fac064f7b94232289abff4fdce5541a5400d
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
15
+ *~
16
+ *.swp
17
+ *.swo
18
+ *.gem
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in breizhipsum.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Angelo Delefortrie
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # Breizhipsum
2
+
3
+ Génération de faux texte avec des expressions bretonnes.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'breizhipsum'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install breizhipsum
20
+
21
+ ## Usage
22
+
23
+ ### From ruby
24
+
25
+ Require gem with `require('breizhipsum')`.
26
+
27
+ ```ruby
28
+ text = Breizhipsum::Work.new({
29
+ :paragraphs => 2, # default to 5
30
+ :format => :long, # default to :medium
31
+ :html => true # default to false
32
+ }).generate
33
+ ```
34
+
35
+ ### From CLI
36
+
37
+ Lauch `breizhipsum` in your terminal.
38
+
39
+ Use `breizhipsum help generate` for help.
40
+
41
+ ## Contributing
42
+
43
+ 1. Fork it ( https://github.com/angelodlfrtr/breizhipsum/fork )
44
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
45
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
46
+ 4. Push to the branch (`git push origin my-new-feature`)
47
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/bin/breizhipsum ADDED
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'commander/import'
4
+ require 'breizhipsum'
5
+
6
+ program :name, 'Breizh Ipsum'
7
+ program :description, 'Generate fake text in breton'
8
+ program :version, '0.0.1'
9
+
10
+ command :generate do |c|
11
+
12
+ c.syntax = 'breizhipsum generate [options]'
13
+ c.summary = 'Genarete fake text'
14
+
15
+ c.option '-p INTEGER', Integer, 'Number of paragraphs'
16
+ c.option '-f STRING', String, 'Format of paragraphs, can be [small, medium, long]'
17
+ c.option '--html', 'Generate in html'
18
+
19
+ c.action do |args, options|
20
+
21
+ options.default \
22
+ :p => 2,
23
+ :f => :medium,
24
+ :html => false
25
+
26
+ say Breizhipsum::Work.new({
27
+ :paragraphs => options.p,
28
+ :format => options.f.to_sym,
29
+ :html => options.html
30
+ }).generate
31
+
32
+ end
33
+ end
34
+
35
+ alias_command :g, :generate
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'breizhipsum/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "breizhipsum"
8
+ spec.version = Breizhipsum::VERSION
9
+ spec.authors = ["Angelo Delefortrie"]
10
+ spec.email = ["angelo.delefortrie@gmail.com"]
11
+ spec.summary = %q{Génération de faux texte avec des expressions bretonnes.}
12
+ spec.description = spec.summary
13
+ spec.homepage = "https://github.com/angelodlfrtr/breizhipsum"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "commander", '~> 4.0'
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.7"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ end
@@ -0,0 +1,3 @@
1
+ module Breizhipsum
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,66 @@
1
+ module Breizhipsum
2
+ class Work
3
+
4
+ def initialize options={}
5
+ set_options options
6
+ end
7
+
8
+ def generate
9
+ r = []
10
+ (0..@options[:paragraphs]).each do
11
+ r << generate_paragraph
12
+ end
13
+ r.join("\n")
14
+ end
15
+
16
+ def set_options options
17
+ @options = {
18
+ format: :medium,
19
+ paragraphs: 5,
20
+ html: false
21
+ }.merge(options)
22
+ end
23
+
24
+ def generate_paragraph
25
+ response = ''
26
+ r = []
27
+
28
+ i = 0
29
+ loop do
30
+ word = self.word_list[rand(self.word_list.size)]
31
+ word.capitalize! if i == 0
32
+ r << word
33
+ i += 1
34
+ break if r.join('').length > paragraph_size
35
+ end
36
+
37
+ (0..r.length).step(10) do |n|
38
+ if r[n] && r[n + 1]
39
+ r[n].concat('.')
40
+ r[n + 1].capitalize!
41
+ end
42
+ end
43
+
44
+ response = r.join(' ').concat('.')
45
+
46
+ if @options[:html]
47
+ response.insert(0, '<p>').concat('</p>')
48
+ else
49
+ response
50
+ end
51
+ end
52
+
53
+ def word_list
54
+ ["memestra", "oh ma doue", "rouler", "aller à dreuze", "c'est une pikes", "poquà¨s", "pokesden", "dans le lagen", "me zo skuizh", "à la jaille", "poquer", "des gwennec", "faire l'essence", "liche", "bilig", "distribil", "en riboule", "chouille", "un ben", "un palto", "a la dreuz", "ou tu es rendu", "une poch", "une binouz", "le bourg", "korrigan", "mange comme une gouelle", "comment que c'est", "kig ha farz", "mam couz", "mam kohz", "mam gouz", "du lambig", "une marmule", "le pochon", "ribines", "louzous", "complà¨tement beurrer", "là¢ché une galette", "on va guincher", "gast", "skuizh", "koc'h", "les routes à 3g", "un toul car", "on est pas venus là déguisés en feuille de chou pour se faire bouffer le cul par des lapins", "pas tout seul", "il est bien accompagné", "souffler dans le biniou", "tiens, v'là l'bagad glazick", "cuici il tiendra pas la marée", "t'es colboà«t ou quoi", "il fait frisket", "je suis allé que j'peux plus", "ya corchich", "pikouses", "frilouz", "ta un frilou", "drapeau gwen ha du", "madoué béniguette", "penn karn", "fait a la dreuz", "cui-ci est propre", "laket un all", "an vec'h all", "méméstra", "startijenn", "qu'est c'qu'on graille ce soir", "bouge ton rec'h ou der'ch ca dépend des régions", "cabaner", "chom peo", "choms trankil", "je rentre au loch", "qu'est-ce qu'il baraguouine", "je vais donner un coup d lave pont", "il est debwet", "lichouseries", "un lichou", "mettre a la jaille", "an bec toul", "un manche-à -couille", "il a mis dans son col", "on n est pas rendu", "un fruit blette", "un ti zef", "un yannick", "l'arsouille", "arsouiller", "aller a la baille", "da gousket", "cuici il a viré drà´le", "pas possib' que c'est", "cui-ci fait pokez", "c'est pich", "la valoche", "je suis raouet", "chez les boums", "aller en riboul", "toul bouet", "un rade, un troquet", "ca tarz", "route pà¨che", "un bec braz", "tailler la route", "yerc'hed mat", "ca douille", "il a du gout", "une goulée", "tu prend un jus", "oh la wouelle", "un pekno", "faire du reuz", "droche", "c'est marée basse", "piz cras", "a la revoillure", "glep", "gloche", "tor pen", "barrique à pattes", "il est coco", "crotik", "un coup d'anti rouille", "baragouiner"]
55
+ end
56
+
57
+ def paragraph_size
58
+ {
59
+ :short => 500,
60
+ :medium => 1000,
61
+ :long => 3000
62
+ }[@options[:format]]
63
+ end
64
+
65
+ end
66
+ end
@@ -0,0 +1,5 @@
1
+ require "breizhipsum/version"
2
+
3
+ module Breizhipsum
4
+ autoload :Work, 'breizhipsum/work'
5
+ end
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: breizhipsum
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Angelo Delefortrie
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-03-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: commander
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '4.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '4.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.7'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.7'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ description: Génération de faux texte avec des expressions bretonnes.
56
+ email:
57
+ - angelo.delefortrie@gmail.com
58
+ executables:
59
+ - breizhipsum
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - bin/breizhipsum
69
+ - breizhipsum.gemspec
70
+ - lib/breizhipsum.rb
71
+ - lib/breizhipsum/version.rb
72
+ - lib/breizhipsum/work.rb
73
+ homepage: https://github.com/angelodlfrtr/breizhipsum
74
+ licenses:
75
+ - MIT
76
+ metadata: {}
77
+ post_install_message:
78
+ rdoc_options: []
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ requirements: []
92
+ rubyforge_project:
93
+ rubygems_version: 2.4.3
94
+ signing_key:
95
+ specification_version: 4
96
+ summary: Génération de faux texte avec des expressions bretonnes.
97
+ test_files: []
98
+ has_rdoc: