jiazi 1.0.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fc3331fcc5b462e1e43e3ac065e53d46890555c3
4
+ data.tar.gz: a0a9b1d56984b34e4448e64e6aeb39d139d763cd
5
+ SHA512:
6
+ metadata.gz: e42a4f791e5da214976f86799586e2299da4494ed265c7eebe2a2ef50b23a280f80a17c1733b70947112360941315f0302db7baf71867b2713778c0ffd0c93f1
7
+ data.tar.gz: 92dc79bbe917af7be4512d9abe1803bdb0bb2c6a1080d35bf195ffb2fe1ddd3517dfd6e3b642d257fdae87901f1b6eec913ac96e3b25f1a4e513b16783c3c210
@@ -0,0 +1,2 @@
1
+ service_name: travis-pro
2
+ repo_token: atMp73aD09JED1dvzH4mRdGFYSihxqPYo
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ *.bundle
10
+ *.so
11
+ *.o
12
+ *.a
13
+ mkmf.log
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format Fuubar
2
+ --color
@@ -0,0 +1,18 @@
1
+ language: ruby
2
+ cache: bundler
3
+
4
+ rvm:
5
+ - 1.9.3
6
+ - 2.0.0
7
+ - 2.1.0
8
+
9
+ before_install:
10
+ - gem update --system
11
+ - gem --version
12
+
13
+ notifications:
14
+ email:
15
+ recipients:
16
+ - garylai1990@gmail.com
17
+ on_failure: change
18
+ on_success: never
data/Gemfile ADDED
@@ -0,0 +1,22 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in jiazi.gemspec
4
+ gemspec
5
+
6
+ gem 'rake'
7
+ gem 'json'
8
+
9
+ group :development do
10
+ gem 'guard'
11
+ gem 'guard-rspec'
12
+ gem 'pry'
13
+ gem 'pry-remote'
14
+ gem 'pry-nav'
15
+ gem 'fuubar'
16
+ end
17
+
18
+ group :test do
19
+ gem 'rspec'
20
+ gem 'rspec-nc'
21
+ gem 'coveralls'
22
+ end
@@ -0,0 +1,105 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ jiazi (1.0.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ celluloid (0.16.0)
10
+ timers (~> 4.0.0)
11
+ coderay (1.1.0)
12
+ coveralls (0.7.2)
13
+ multi_json (~> 1.3)
14
+ rest-client (= 1.6.7)
15
+ simplecov (>= 0.7)
16
+ term-ansicolor (= 1.2.2)
17
+ thor (= 0.18.1)
18
+ diff-lcs (1.2.5)
19
+ docile (1.1.5)
20
+ ffi (1.9.6)
21
+ formatador (0.2.5)
22
+ fuubar (2.0.0)
23
+ rspec (~> 3.0)
24
+ ruby-progressbar (~> 1.4)
25
+ guard (2.9.0)
26
+ formatador (>= 0.2.4)
27
+ listen (~> 2.7)
28
+ lumberjack (~> 1.0)
29
+ pry (>= 0.9.12)
30
+ thor (>= 0.18.1)
31
+ guard-rspec (4.3.1)
32
+ guard (~> 2.1)
33
+ rspec (>= 2.14, < 4.0)
34
+ hitimes (1.2.2)
35
+ json (1.8.1)
36
+ listen (2.8.3)
37
+ celluloid (>= 0.15.2)
38
+ rb-fsevent (>= 0.9.3)
39
+ rb-inotify (>= 0.9)
40
+ lumberjack (1.0.9)
41
+ method_source (0.8.2)
42
+ mime-types (2.4.3)
43
+ multi_json (1.10.1)
44
+ pry (0.10.1)
45
+ coderay (~> 1.1.0)
46
+ method_source (~> 0.8.1)
47
+ slop (~> 3.4)
48
+ pry-nav (0.2.4)
49
+ pry (>= 0.9.10, < 0.11.0)
50
+ pry-remote (0.1.8)
51
+ pry (~> 0.9)
52
+ slop (~> 3.0)
53
+ rake (10.4.0)
54
+ rb-fsevent (0.9.4)
55
+ rb-inotify (0.9.5)
56
+ ffi (>= 0.5.0)
57
+ rest-client (1.6.7)
58
+ mime-types (>= 1.16)
59
+ rspec (3.1.0)
60
+ rspec-core (~> 3.1.0)
61
+ rspec-expectations (~> 3.1.0)
62
+ rspec-mocks (~> 3.1.0)
63
+ rspec-core (3.1.7)
64
+ rspec-support (~> 3.1.0)
65
+ rspec-expectations (3.1.2)
66
+ diff-lcs (>= 1.2.0, < 2.0)
67
+ rspec-support (~> 3.1.0)
68
+ rspec-mocks (3.1.3)
69
+ rspec-support (~> 3.1.0)
70
+ rspec-nc (0.2.0)
71
+ rspec (>= 2.9)
72
+ terminal-notifier (>= 1.4)
73
+ rspec-support (3.1.2)
74
+ ruby-progressbar (1.7.0)
75
+ simplecov (0.9.1)
76
+ docile (~> 1.1.0)
77
+ multi_json (~> 1.0)
78
+ simplecov-html (~> 0.8.0)
79
+ simplecov-html (0.8.0)
80
+ slop (3.6.0)
81
+ term-ansicolor (1.2.2)
82
+ tins (~> 0.8)
83
+ terminal-notifier (1.6.2)
84
+ thor (0.18.1)
85
+ timers (4.0.1)
86
+ hitimes
87
+ tins (0.13.2)
88
+
89
+ PLATFORMS
90
+ ruby
91
+
92
+ DEPENDENCIES
93
+ bundler (~> 1.7)
94
+ coveralls
95
+ fuubar
96
+ guard
97
+ guard-rspec
98
+ jiazi!
99
+ json
100
+ pry
101
+ pry-nav
102
+ pry-remote
103
+ rake
104
+ rspec
105
+ rspec-nc
@@ -0,0 +1,5 @@
1
+ guard :rspec, cmd: 'rspec --format Fuubar --color spec' do
2
+ watch(%r{^spec/.+_spec\.rb$})
3
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
4
+ watch('spec/spec_helper.rb') { "spec" }
5
+ end
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 zxlai
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.
@@ -0,0 +1,41 @@
1
+ [![Build Status](https://travis-ci.org/Jungllle/jiazi.svg?branch=master)](https://travis-ci.org/Jungllle/jiazi)
2
+ [![Coverage Status](https://coveralls.io/repos/Jungllle/jiazi/badge.png)](https://coveralls.io/r/Jungllle/jiazi)
3
+
4
+ # Jiazi
5
+
6
+ Generate Chinese fake data.
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ ```ruby
13
+ gem 'jiazi'
14
+ ```
15
+
16
+ And then execute:
17
+
18
+ $ bundle
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install jiazi
23
+
24
+ ## Usage
25
+
26
+ ```
27
+ Jiazi.title
28
+ # You will get a Chinese sentence which include 10 to 20 characters in an array.
29
+ Jiazi.paragraph
30
+ # You will get a Chinese sentence which include 400 to 500 characters in an array.
31
+ Jiazi.custom 10, 30, 50 # Jiazi.custom sentences, mix, max
32
+ # You will get 10 Chinese sentences which include 30 to 50 characters in an array. The default parameters are 1, 10 ,20.
33
+ ```
34
+
35
+ ## Contributing
36
+
37
+ 1. Fork it ( https://github.com/Jungllle/jiazi/fork )
38
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
39
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
40
+ 4. Push to the branch (`git push origin my-new-feature`)
41
+ 5. Create a new Pull Request
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
7
+
8
+ require 'coveralls/rake/task'
9
+ Coveralls::RakeTask.new
10
+ task :test_with_coveralls => [:spec, :features, 'coveralls:push']
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'jiazi/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "jiazi"
8
+ spec.version = Jiazi::VERSION
9
+ spec.authors = ["zxlai"]
10
+ spec.email = ["garylai1990@gmail.com"]
11
+ spec.summary = %q{Generate Chinese fake data.}
12
+ spec.description = %q{Generate Chinese fake data.}
13
+ spec.homepage = "https://github.com/Jungllle/jiazi"
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_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ end
@@ -0,0 +1,34 @@
1
+ require "jiazi/version"
2
+
3
+ require 'open-uri'
4
+ require 'json'
5
+
6
+ module Jiazi
7
+
8
+ module_function
9
+
10
+ def custom(number = 1, min = 10, max = 20)
11
+ if max < min
12
+ "max should be greater or equal to min."
13
+ else
14
+ fetch(number, min, max)
15
+ end
16
+ end
17
+
18
+ def title
19
+ custom(1)
20
+ end
21
+
22
+ def paragraph
23
+ custom(1, 400, 500)
24
+ end
25
+
26
+ def fetch(number, min, max)
27
+ result JSON.load(open("http://more.handlino.com/sentences.json?n=#{number}&limit=#{min},#{max}"))
28
+ end
29
+
30
+ def result json
31
+ json["sentences"]
32
+ end
33
+
34
+ end
@@ -0,0 +1,3 @@
1
+ module Jiazi
2
+ VERSION = "1.0.0"
3
+ end
@@ -0,0 +1,20 @@
1
+ require "spec_helper"
2
+
3
+ describe Jiazi do
4
+
5
+ it "#custom" do
6
+ expect(Jiazi.custom(1, 2, 1))
7
+ .to eq "max should be greater or equal to min."
8
+ end
9
+
10
+ it "#title" do
11
+ expect(Jiazi.title.length)
12
+ .to eq (Jiazi.custom(1).length)
13
+ end
14
+
15
+ it "#paragraph" do
16
+ expect(Jiazi.paragraph.length)
17
+ .to eq (Jiazi.custom(1, 400, 500).length)
18
+ end
19
+
20
+ end
@@ -0,0 +1,5 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
3
+
4
+ require 'pry'
5
+ require 'jiazi'
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jiazi
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - zxlai
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: Generate Chinese fake data.
42
+ email:
43
+ - garylai1990@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".coveralls.yml"
49
+ - ".gitignore"
50
+ - ".rspec"
51
+ - ".travis.yml"
52
+ - Gemfile
53
+ - Gemfile.lock
54
+ - Guardfile
55
+ - LICENSE.txt
56
+ - README.md
57
+ - Rakefile
58
+ - jiazi.gemspec
59
+ - lib/jiazi.rb
60
+ - lib/jiazi/version.rb
61
+ - spec/jiazi_spec.rb
62
+ - spec/spec_helper.rb
63
+ homepage: https://github.com/Jungllle/jiazi
64
+ licenses:
65
+ - MIT
66
+ metadata: {}
67
+ post_install_message:
68
+ rdoc_options: []
69
+ require_paths:
70
+ - lib
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ requirements: []
82
+ rubyforge_project:
83
+ rubygems_version: 2.2.2
84
+ signing_key:
85
+ specification_version: 4
86
+ summary: Generate Chinese fake data.
87
+ test_files:
88
+ - spec/jiazi_spec.rb
89
+ - spec/spec_helper.rb