example_gem_ruby 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 +7 -0
- data/.gitignore +22 -0
- data/.rspec +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +70 -0
- data/Rakefile +2 -0
- data/example_gem.gemspec +24 -0
- data/lib/example_gem.rb +7 -0
- data/lib/example_gem/hello.rb +9 -0
- data/lib/example_gem/price.rb +15 -0
- data/lib/example_gem/version.rb +3 -0
- data/spec/lib/hello_spec.rb +10 -0
- data/spec/lib/price_spec.rb +13 -0
- data/spec/spec_helper.rb +8 -0
- metadata +105 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 006528dc56298d8df60d18995405bd20b52e4b88
|
4
|
+
data.tar.gz: f812b95baeb314d39b2e955c371ac4524ae5a938
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a9aed5c9048dc7d2401a2295212ef35d28bc69572e6e4e7fbf6756e015637a8b6fe373eb563a67e962215a6e7eeb0831d60997419a9ca1cc80a56b31828b607d
|
7
|
+
data.tar.gz: bb5e14557deb724f189f5a3bd6a0357faf5144f1953ddf47d45bba0d5e2b41dfea831ea7eca76641c0718061e88989d0ee17b3e59dd7d5399520faf2d696f19f
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2016 liukun
|
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,70 @@
|
|
1
|
+
# example_gem
|
2
|
+
|
3
|
+
This gem is to show how to create a gem from start and to provide an example for creating a gem.
|
4
|
+
|
5
|
+
### How to create a gem
|
6
|
+
|
7
|
+
You can create a gem by this command:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
bundle gem example_gem
|
11
|
+
```
|
12
|
+
|
13
|
+
Traditionally the summary is like the description but shorter. The
|
14
|
+
summary is normally about one line, while the description can go
|
15
|
+
on for four or five lines.
|
16
|
+
|
17
|
+
Make sure to replace “FIXME” and “TODO” in the descriptions -
|
18
|
+
“ gem build” doesnʼt like them and they look bad to users.
|
19
|
+
|
20
|
+
Youʼll need to add dependencies at the bottom. They can look
|
21
|
+
like this:
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
gem.add_development_dependency "rspec"
|
25
|
+
gem.add_runtime_dependency "rest-client"
|
26
|
+
gem.add_runtime_dependency "some_gem", "1.3.0"
|
27
|
+
gem.add_runtime_dependency "other_gem", ">0.8.2"
|
28
|
+
```
|
29
|
+
|
30
|
+
Each of these adds a runtime dependency (needed to run the
|
31
|
+
gem at all) or a development dependency (needed to develop or
|
32
|
+
test the gem).
|
33
|
+
|
34
|
+
Letʼs build your gem and install it:
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
gem build example_gem.gemspec
|
38
|
+
gem install example_gem-0.0.1.gem
|
39
|
+
```
|
40
|
+
|
41
|
+
the final step is to require the gem and use it:
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
% irb
|
45
|
+
2.1.1 :001 > require 'example_gem'
|
46
|
+
true
|
47
|
+
2.1.1 :002 > ExampleGem::Hello.say_hi
|
48
|
+
Hello, world!
|
49
|
+
nil
|
50
|
+
2.1.1 :003 > ExampleGem::Hello.say_hi("liukgg")
|
51
|
+
Hello, liukgg!
|
52
|
+
nil
|
53
|
+
2.1.1 :004 >
|
54
|
+
```
|
55
|
+
|
56
|
+
### How to rebuild and reinstall when you change the code of the gem
|
57
|
+
Build the gem again and install it:
|
58
|
+
|
59
|
+
``` ruby
|
60
|
+
gem build example_gem.gemspec
|
61
|
+
gem install example_gem-0.0.1.gem
|
62
|
+
```
|
63
|
+
|
64
|
+
### To know how to publish your gem to rubygems.org, you can see this:
|
65
|
+
http://guides.rubygems.org/make-your-own-gem/
|
66
|
+
|
67
|
+
### Materails
|
68
|
+
《RebuildingRailsCurrent》
|
69
|
+
|
70
|
+
http://guides.rubygems.org/make-your-own-gem/
|
data/Rakefile
ADDED
data/example_gem.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'example_gem/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "example_gem_ruby"
|
8
|
+
spec.version = ExampleGem::VERSION
|
9
|
+
spec.authors = ["liukun"]
|
10
|
+
spec.email = ["liukun@rd.tuan800.com"]
|
11
|
+
spec.summary = %q{An example for creating a gem.}
|
12
|
+
spec.description = %q{An example for creating a gem.To show how to create a gem from start and how to share it.}
|
13
|
+
spec.homepage = "https://github.com/liukgg/example_gem"
|
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.6"
|
22
|
+
spec.add_development_dependency "rake", '~> 0'
|
23
|
+
spec.add_development_dependency "rspec"
|
24
|
+
end
|
data/lib/example_gem.rb
ADDED
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: example_gem_ruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- liukun
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-09-01 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.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: An example for creating a gem.To show how to create a gem from start
|
56
|
+
and how to share it.
|
57
|
+
email:
|
58
|
+
- liukun@rd.tuan800.com
|
59
|
+
executables: []
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- ".rspec"
|
65
|
+
- Gemfile
|
66
|
+
- LICENSE.txt
|
67
|
+
- README.md
|
68
|
+
- Rakefile
|
69
|
+
- example_gem.gemspec
|
70
|
+
- lib/example_gem.rb
|
71
|
+
- lib/example_gem/hello.rb
|
72
|
+
- lib/example_gem/price.rb
|
73
|
+
- lib/example_gem/version.rb
|
74
|
+
- spec/lib/hello_spec.rb
|
75
|
+
- spec/lib/price_spec.rb
|
76
|
+
- spec/spec_helper.rb
|
77
|
+
homepage: https://github.com/liukgg/example_gem
|
78
|
+
licenses:
|
79
|
+
- MIT
|
80
|
+
metadata: {}
|
81
|
+
post_install_message:
|
82
|
+
rdoc_options: []
|
83
|
+
require_paths:
|
84
|
+
- lib
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
requirements: []
|
96
|
+
rubyforge_project:
|
97
|
+
rubygems_version: 2.6.6
|
98
|
+
signing_key:
|
99
|
+
specification_version: 4
|
100
|
+
summary: An example for creating a gem.
|
101
|
+
test_files:
|
102
|
+
- spec/lib/hello_spec.rb
|
103
|
+
- spec/lib/price_spec.rb
|
104
|
+
- spec/spec_helper.rb
|
105
|
+
has_rdoc:
|