random_text 1.0.2.2 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,12 @@
1
+ /pkg/
2
+ /*.gem
3
+
4
+ /doc/
5
+ /rdoc/
6
+ /.yardoc/
7
+ /coverage/
8
+
9
+ Makefile
10
+ *.o
11
+ *.bundle
12
+ /tmp/
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010 Ivan Kuchin
1
+ Copyright (c) 2010-2011 Ivan Kuchin
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -44,4 +44,4 @@ ruby :)
44
44
 
45
45
  ## Copyright
46
46
 
47
- Copyright (c) 2010 Ivan Kuchin. See LICENSE.txt for details.
47
+ Copyright (c) 2010-2011 Ivan Kuchin. See LICENSE.txt for details.
data/bin/lorem CHANGED
@@ -2,4 +2,4 @@
2
2
 
3
3
  require 'random_text'
4
4
 
5
- RandomText.run(ARGV)
5
+ RandomText.run(File.basename($0), ARGV)
data/bin/vesna CHANGED
@@ -2,4 +2,4 @@
2
2
 
3
3
  require 'random_text'
4
4
 
5
- RandomText.run(ARGV)
5
+ RandomText.run(File.basename($0), ARGV)
@@ -18,10 +18,9 @@ module RandomText
18
18
  dictionaries[const_name] = dictionary
19
19
  end
20
20
 
21
- def run(args)
21
+ def run(binary, args)
22
22
  arg = args.join(' ').strip.downcase
23
23
  arg = 'p' if arg.empty?
24
- binary = File.basename($0)
25
24
  if m = arg.match(/^(\d+)?\s*(p|w|s|u)/)
26
25
  number = m[1] && m[1].to_i
27
26
  dictionary = dictionaries[classify(binary)]
@@ -1,69 +1,19 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
1
+ # encoding: UTF-8
5
2
 
6
3
  Gem::Specification.new do |s|
7
- s.name = %q{random_text}
8
- s.version = "1.0.2.2"
4
+ s.name = 'random_text'
5
+ s.version = '1.1.0'
6
+ s.summary = %q{Library to generate random strings}
7
+ s.homepage = "http://github.com/toy/#{s.name}"
8
+ s.authors = ['Ivan Kuchin']
9
+ s.license = 'MIT'
9
10
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Ivan Kuchin"]
12
- s.date = %q{2010-12-15}
13
- s.executables = ["vesna", "lorem"]
14
- s.extra_rdoc_files = [
15
- "LICENSE.txt",
16
- "README.markdown"
17
- ]
18
- s.files = [
19
- ".tmignore",
20
- "LICENSE.txt",
21
- "README.markdown",
22
- "Rakefile",
23
- "VERSION",
24
- "bin/lorem",
25
- "bin/vesna",
26
- "lib/random_text.rb",
27
- "lib/random_text/dictionary.rb",
28
- "lib/random_text/random_strings.rb",
29
- "random_text.gemspec",
30
- "resources/lorem.txt",
31
- "resources/vesna.txt",
32
- "spec/random_text/dictionary_spec.rb",
33
- "spec/random_text/random_string_spec.rb",
34
- "spec/random_text_spec.rb",
35
- "spec/spec.opts",
36
- "spec/spec_helper.rb"
37
- ]
38
- s.homepage = %q{http://github.com/toy/random_text}
39
- s.licenses = ["MIT"]
40
- s.require_paths = ["lib"]
41
- s.rubygems_version = %q{1.3.7}
42
- s.summary = %q{Library to generate random strings}
43
- s.test_files = [
44
- "spec/random_text/dictionary_spec.rb",
45
- "spec/random_text/random_string_spec.rb",
46
- "spec/random_text_spec.rb",
47
- "spec/spec_helper.rb"
48
- ]
11
+ s.rubyforge_project = s.name
49
12
 
50
- if s.respond_to? :specification_version then
51
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
52
- s.specification_version = 3
13
+ s.files = `git ls-files`.split("\n")
14
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
16
+ s.require_paths = %w[lib]
53
17
 
54
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
55
- s.add_development_dependency(%q<jeweler>, ["~> 1.5.1"])
56
- s.add_development_dependency(%q<rake-gem-ghost>, [">= 0"])
57
- s.add_development_dependency(%q<rspec>, [">= 0"])
58
- else
59
- s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
60
- s.add_dependency(%q<rake-gem-ghost>, [">= 0"])
61
- s.add_dependency(%q<rspec>, [">= 0"])
62
- end
63
- else
64
- s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
65
- s.add_dependency(%q<rake-gem-ghost>, [">= 0"])
66
- s.add_dependency(%q<rspec>, [">= 0"])
67
- end
18
+ s.add_development_dependency 'rspec'
68
19
  end
69
-
@@ -1,4 +1,5 @@
1
1
  require File.dirname(__FILE__) + '/../spec_helper.rb'
2
+ require 'stringio'
2
3
 
3
4
  WORD_R = /^\w+$/
4
5
  SENTENCE_RS = '\w+([,;]?\W\w+)+[.!?]'
@@ -80,8 +81,16 @@ describe Dictionary do
80
81
  end
81
82
 
82
83
  describe "binaries" do
84
+ def lorem(*args)
85
+ previous_stdout, $stdout = $stdout, StringIO.new
86
+ RandomText.run('lorem', args)
87
+ $stdout.string
88
+ ensure
89
+ $stdout = previous_stdout
90
+ end
91
+
83
92
  it "should return 1 paragraph by default" do
84
- IO.popen('bin/lorem', &:read).strip.should =~ PARAGRAPH_R
93
+ lorem(&:read).strip.should =~ PARAGRAPH_R
85
94
  end
86
95
 
87
96
  {
@@ -93,11 +102,11 @@ describe "binaries" do
93
102
  specifiers.each do |specifier|
94
103
  describe "with specifier #{specifier}" do
95
104
  it "should return #{specifiers[0]}" do
96
- IO.popen("bin/lorem #{specifier}", &:read).strip.should =~ reg
105
+ lorem(specifier).strip.should =~ reg
97
106
  end
98
107
 
99
108
  it "should return 5 #{specifiers[1]}" do
100
- lines = IO.popen("bin/lorem 5 #{specifier}", &:readlines).map(&:strip)
109
+ lines = lorem(5, specifier).split(/[\n\r]+/)
101
110
  lines.length.should == 5
102
111
  lines.each{ |line| line.should =~ reg }
103
112
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: random_text
3
3
  version: !ruby/object:Gem::Version
4
- hash: 83
5
- prerelease: false
4
+ hash: 19
5
+ prerelease:
6
6
  segments:
7
7
  - 1
8
+ - 1
8
9
  - 0
9
- - 2
10
- - 2
11
- version: 1.0.2.2
10
+ version: 1.1.0
12
11
  platform: ruby
13
12
  authors:
14
13
  - Ivan Kuchin
@@ -16,43 +15,12 @@ autorequire:
16
15
  bindir: bin
17
16
  cert_chain: []
18
17
 
19
- date: 2010-12-15 00:00:00 +03:00
20
- default_executable:
18
+ date: 2011-12-16 00:00:00 Z
21
19
  dependencies:
22
- - !ruby/object:Gem::Dependency
23
- name: jeweler
24
- prerelease: false
25
- requirement: &id001 !ruby/object:Gem::Requirement
26
- none: false
27
- requirements:
28
- - - ~>
29
- - !ruby/object:Gem::Version
30
- hash: 1
31
- segments:
32
- - 1
33
- - 5
34
- - 1
35
- version: 1.5.1
36
- type: :development
37
- version_requirements: *id001
38
- - !ruby/object:Gem::Dependency
39
- name: rake-gem-ghost
40
- prerelease: false
41
- requirement: &id002 !ruby/object:Gem::Requirement
42
- none: false
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- hash: 3
47
- segments:
48
- - 0
49
- version: "0"
50
- type: :development
51
- version_requirements: *id002
52
20
  - !ruby/object:Gem::Dependency
53
21
  name: rspec
54
22
  prerelease: false
55
- requirement: &id003 !ruby/object:Gem::Requirement
23
+ requirement: &id001 !ruby/object:Gem::Requirement
56
24
  none: false
57
25
  requirements:
58
26
  - - ">="
@@ -62,23 +30,20 @@ dependencies:
62
30
  - 0
63
31
  version: "0"
64
32
  type: :development
65
- version_requirements: *id003
33
+ version_requirements: *id001
66
34
  description:
67
35
  email:
68
36
  executables:
69
- - vesna
70
37
  - lorem
38
+ - vesna
71
39
  extensions: []
72
40
 
73
- extra_rdoc_files:
74
- - LICENSE.txt
75
- - README.markdown
41
+ extra_rdoc_files: []
42
+
76
43
  files:
77
- - .tmignore
44
+ - .gitignore
78
45
  - LICENSE.txt
79
46
  - README.markdown
80
- - Rakefile
81
- - VERSION
82
47
  - bin/lorem
83
48
  - bin/vesna
84
49
  - lib/random_text.rb
@@ -92,7 +57,6 @@ files:
92
57
  - spec/random_text_spec.rb
93
58
  - spec/spec.opts
94
59
  - spec/spec_helper.rb
95
- has_rdoc: true
96
60
  homepage: http://github.com/toy/random_text
97
61
  licenses:
98
62
  - MIT
@@ -121,8 +85,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
85
  version: "0"
122
86
  requirements: []
123
87
 
124
- rubyforge_project:
125
- rubygems_version: 1.3.7
88
+ rubyforge_project: random_text
89
+ rubygems_version: 1.8.12
126
90
  signing_key:
127
91
  specification_version: 3
128
92
  summary: Library to generate random strings
@@ -130,4 +94,6 @@ test_files:
130
94
  - spec/random_text/dictionary_spec.rb
131
95
  - spec/random_text/random_string_spec.rb
132
96
  - spec/random_text_spec.rb
97
+ - spec/spec.opts
133
98
  - spec/spec_helper.rb
99
+ has_rdoc:
data/.tmignore DELETED
@@ -1 +0,0 @@
1
- /*.gemspec
data/Rakefile DELETED
@@ -1,25 +0,0 @@
1
- require 'rake'
2
- require 'jeweler'
3
- require 'rake/gem_ghost_task'
4
- require 'rspec/core/rake_task'
5
-
6
- name = 'random_text'
7
-
8
- Jeweler::Tasks.new do |gem|
9
- gem.name = name
10
- gem.summary = %Q{Library to generate random strings}
11
- gem.homepage = "http://github.com/toy/#{name}"
12
- gem.license = 'MIT'
13
- gem.authors = ['Ivan Kuchin']
14
- gem.add_development_dependency 'jeweler', '~> 1.5.1'
15
- gem.add_development_dependency 'rake-gem-ghost'
16
- gem.add_development_dependency 'rspec'
17
- end
18
- Jeweler::RubygemsDotOrgTasks.new
19
- Rake::GemGhostTask.new
20
-
21
- RSpec::Core::RakeTask.new(:spec) do |spec|
22
- spec.rspec_opts = ['--colour --format progress']
23
- spec.pattern = 'spec/**/*_spec.rb'
24
- end
25
- task :default => :spec
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 1.0.2.2