buildgem 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 +15 -0
- data/.gitignore +7 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile +2 -0
- data/LICENCE +19 -0
- data/README.md +18 -0
- data/Rakefile +15 -0
- data/VERSION +1 -0
- data/bin/buildgem +5 -0
- data/buildgem.gemspec +16 -0
- data/lib/buildgem.rb +255 -0
- data/spec/buildgem_spec.rb +7 -0
- data/spec/helper.rb +6 -0
- metadata +57 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZDRmMWE2MWM4ZTYyZTdlMTNkZGM1ZDU5ODIyNDZjNDcxN2VjOTRmNA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
M2Q2ZGZhYmI2OTIzZjdkYjRlYTJkYTk1MDNkMGQ5YzYxNWFlYzkyMw==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
Nzk3MjZhODc2ZDBjYjY1MWQyZDI4MDRkZWRlYzJhODI0NzE5NWU2NWU3NDNl
|
10
|
+
MTkwNjM4ZGE4Y2IxMGY4NGNmMTE2YmI3ZTJmYTZiOGVjNDc3MzBjNGNiMWQy
|
11
|
+
ODlkZGU3NjRjYzY2ZDg3NDkwMTgxM2ZmYjIzMDI2ZmVlNmU2OTE=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NzZjZmM1ZmFiNjAxY2Y0OTA4OWU4YmYxZjAzMjU1MjcwMTg1NjE1Y2Q1MGVk
|
14
|
+
NThkODg2N2IxMTMxMTUzZThkYmI1ZWY1MTBkZGM3MDZlNGM2ZjJjNDM5ZGUx
|
15
|
+
ZWRlYzVmODRjYWVlNTc0M2RhNTg4NmE0YWQxOGJmNjQ0YjI3ZjU=
|
data/.gitignore
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/LICENCE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (C) 2013 Kyrylo Silin
|
2
|
+
|
3
|
+
This software is provided 'as-is', without any express or implied
|
4
|
+
warranty. In no event will the authors be held liable for any damages
|
5
|
+
arising from the use of this software.
|
6
|
+
|
7
|
+
Permission is granted to anyone to use this software for any purpose,
|
8
|
+
including commercial applications, and to alter it and redistribute it
|
9
|
+
freely, subject to the following restrictions:
|
10
|
+
|
11
|
+
1. The origin of this software must not be misrepresented; you must not
|
12
|
+
claim that you wrote the original software. If you use this software
|
13
|
+
in a product, an acknowledgment in the product documentation would be
|
14
|
+
appreciated but is not required.
|
15
|
+
|
16
|
+
2. Altered source versions must be plainly marked as such, and must not be
|
17
|
+
misrepresented as being the original software.
|
18
|
+
|
19
|
+
3. This notice may not be removed or altered from any source distribution.
|
data/README.md
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
Buildgem
|
2
|
+
========
|
3
|
+
|
4
|
+
* Repository: [https://github.com/kyrylo/buildgem][repo]
|
5
|
+
|
6
|
+
Description
|
7
|
+
-----------
|
8
|
+
|
9
|
+
My personal template for a typical gem.
|
10
|
+
|
11
|
+
Installation
|
12
|
+
------------
|
13
|
+
|
14
|
+
gem install buildgem
|
15
|
+
|
16
|
+
The project uses Zlib licence. See LICENCE file for more information.
|
17
|
+
|
18
|
+
[repo]: https://github.com/kyrylo/buildgem/ "Home page"
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
def quiet
|
2
|
+
ENV['VERBOSE'] ? '' : '-q'
|
3
|
+
end
|
4
|
+
|
5
|
+
def test_files
|
6
|
+
paths = FileList['spec/**/*_spec.rb']
|
7
|
+
paths.shuffle!.join(' ')
|
8
|
+
end
|
9
|
+
|
10
|
+
desc "Run tests"
|
11
|
+
task :test do
|
12
|
+
exec "bacon -Ispec #{ quiet } #{ test_files }"
|
13
|
+
end
|
14
|
+
|
15
|
+
task :default => :test
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
data/bin/buildgem
ADDED
data/buildgem.gemspec
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'buildgem'
|
3
|
+
s.version = File.read('VERSION')
|
4
|
+
s.date = Time.now.strftime('%Y-%m-%d')
|
5
|
+
s.summary = "Kyrylo's personal template for a gem"
|
6
|
+
s.description = 'It is not a general purpose library'
|
7
|
+
s.author = 'Kyrylo Silin'
|
8
|
+
s.email = 'kyrylosilin@gmail.com'
|
9
|
+
s.homepage = 'https://github.com/kyrylo/buildgem'
|
10
|
+
s.licenses = 'zlib'
|
11
|
+
|
12
|
+
s.files = `git ls-files`.split("\n")
|
13
|
+
s.bindir = 'bin'
|
14
|
+
s.require_path = 'lib'
|
15
|
+
s.executable = 'buildgem'
|
16
|
+
end
|
data/lib/buildgem.rb
ADDED
@@ -0,0 +1,255 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'date'
|
3
|
+
|
4
|
+
module Buildgem
|
5
|
+
|
6
|
+
# The VERSION file must be in the root directory of the library.
|
7
|
+
VERSION_FILE = File.expand_path('../../VERSION', __FILE__)
|
8
|
+
|
9
|
+
VERSION = File.exist?(VERSION_FILE) ?
|
10
|
+
File.read(VERSION_FILE).chomp : '(could not find VERSION file)'
|
11
|
+
|
12
|
+
def self.build_gem(name)
|
13
|
+
if name
|
14
|
+
Gem.new(name)
|
15
|
+
else
|
16
|
+
puts 'Provide an argument, the gem name. Example: buildgem my_gem'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class Gem
|
21
|
+
|
22
|
+
def initialize(name)
|
23
|
+
@name = name
|
24
|
+
|
25
|
+
FileUtils.mkdir(name)
|
26
|
+
Dir.chdir(name)
|
27
|
+
FileUtils.mkdir('lib')
|
28
|
+
FileUtils.mkdir('spec')
|
29
|
+
|
30
|
+
File.open("lib/#{ name }.rb", 'w') do |f|
|
31
|
+
f.write(gem_body)
|
32
|
+
end
|
33
|
+
|
34
|
+
File.open('CHANGELOG.md', 'w') do |f|
|
35
|
+
f.write(changelog)
|
36
|
+
end
|
37
|
+
|
38
|
+
File.open('VERSION', 'w') do |f|
|
39
|
+
f.write(version)
|
40
|
+
end
|
41
|
+
|
42
|
+
File.open('.gitignore', 'w') do |f|
|
43
|
+
f.write(gitignore)
|
44
|
+
end
|
45
|
+
|
46
|
+
File.open('Gemfile', 'w') do |f|
|
47
|
+
f.write(gemfile)
|
48
|
+
end
|
49
|
+
|
50
|
+
File.open('LICENCE', 'w') do |f|
|
51
|
+
f.write(licence)
|
52
|
+
end
|
53
|
+
|
54
|
+
File.open('Rakefile', 'w') do |f|
|
55
|
+
f.write(rakefile)
|
56
|
+
end
|
57
|
+
|
58
|
+
File.open('spec/helper.rb', 'w') do |f|
|
59
|
+
f.write(spec_helper)
|
60
|
+
end
|
61
|
+
|
62
|
+
File.open("spec/#{ name }_spec.rb", 'w') do |f|
|
63
|
+
f.write(first_spec)
|
64
|
+
end
|
65
|
+
|
66
|
+
File.open("#{ name }.gemspec", 'w') do |f|
|
67
|
+
f.write(gemspec)
|
68
|
+
end
|
69
|
+
|
70
|
+
File.open("README.md", 'w') do |f|
|
71
|
+
f.write(readme)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
private
|
76
|
+
|
77
|
+
def gem_body
|
78
|
+
<<-BODY
|
79
|
+
module #{ capitalize(@name) }
|
80
|
+
|
81
|
+
# The VERSION file must be in the root directory of the library.
|
82
|
+
VERSION_FILE = File.expand_path('../../VERSION', __FILE__)
|
83
|
+
|
84
|
+
VERSION = File.exist?(VERSION_FILE) ?
|
85
|
+
File.read(VERSION_FILE).chomp : '(could not find VERSION file)'
|
86
|
+
|
87
|
+
end
|
88
|
+
BODY
|
89
|
+
end
|
90
|
+
|
91
|
+
def changelog
|
92
|
+
<<-BODY
|
93
|
+
#{ n = capitalize(@name) } changelog
|
94
|
+
#{ '=' * n.size }
|
95
|
+
|
96
|
+
### v0.0.0 (#{ Date::MONTHNAMES[Date.today.month] } 01, #{ Date.today.year })
|
97
|
+
|
98
|
+
* Initial release
|
99
|
+
BODY
|
100
|
+
end
|
101
|
+
|
102
|
+
def version
|
103
|
+
'0.0.0'
|
104
|
+
end
|
105
|
+
|
106
|
+
def gitignore
|
107
|
+
<<-BODY
|
108
|
+
*~
|
109
|
+
*.gem
|
110
|
+
Gemfile.lock
|
111
|
+
.rbx
|
112
|
+
doc/
|
113
|
+
pkg/
|
114
|
+
.yardoc/
|
115
|
+
BODY
|
116
|
+
end
|
117
|
+
|
118
|
+
def gemfile
|
119
|
+
<<-BODY
|
120
|
+
source 'http://rubygems.org'
|
121
|
+
gemspec
|
122
|
+
BODY
|
123
|
+
end
|
124
|
+
|
125
|
+
def licence
|
126
|
+
<<-BODY
|
127
|
+
Copyright (C) #{ Date.today.year } Kyrylo Silin
|
128
|
+
|
129
|
+
This software is provided 'as-is', without any express or implied
|
130
|
+
warranty. In no event will the authors be held liable for any damages
|
131
|
+
arising from the use of this software.
|
132
|
+
|
133
|
+
Permission is granted to anyone to use this software for any purpose,
|
134
|
+
including commercial applications, and to alter it and redistribute it
|
135
|
+
freely, subject to the following restrictions:
|
136
|
+
|
137
|
+
1. The origin of this software must not be misrepresented; you must not
|
138
|
+
claim that you wrote the original software. If you use this software
|
139
|
+
in a product, an acknowledgment in the product documentation would be
|
140
|
+
appreciated but is not required.
|
141
|
+
|
142
|
+
2. Altered source versions must be plainly marked as such, and must not be
|
143
|
+
misrepresented as being the original software.
|
144
|
+
|
145
|
+
3. This notice may not be removed or altered from any source distribution.
|
146
|
+
BODY
|
147
|
+
end
|
148
|
+
|
149
|
+
def rakefile
|
150
|
+
<<-'BODY'
|
151
|
+
def quiet
|
152
|
+
ENV['VERBOSE'] ? '' : '-q'
|
153
|
+
end
|
154
|
+
|
155
|
+
def test_files
|
156
|
+
paths = FileList['spec/**/*_spec.rb']
|
157
|
+
paths.shuffle!.join(' ')
|
158
|
+
end
|
159
|
+
|
160
|
+
desc "Run tests"
|
161
|
+
task :test do
|
162
|
+
exec "bacon -Ispec #{ quiet } #{ test_files }"
|
163
|
+
end
|
164
|
+
|
165
|
+
task :default => :test
|
166
|
+
BODY
|
167
|
+
end
|
168
|
+
|
169
|
+
def spec_helper
|
170
|
+
<<-BODY
|
171
|
+
require 'bacon'
|
172
|
+
require 'pry'
|
173
|
+
|
174
|
+
require_relative '../lib/#{ @name }'
|
175
|
+
|
176
|
+
puts "Ruby: #{ RUBY_VERSION }; #{ capitalize(@name) } version: #{ version }"
|
177
|
+
BODY
|
178
|
+
end
|
179
|
+
|
180
|
+
def first_spec
|
181
|
+
<<-BODY
|
182
|
+
require_relative 'helper'
|
183
|
+
|
184
|
+
describe #{ capitalize(@name) } do
|
185
|
+
it "works" do
|
186
|
+
true.should == true
|
187
|
+
end
|
188
|
+
end
|
189
|
+
BODY
|
190
|
+
end
|
191
|
+
|
192
|
+
def gemspec
|
193
|
+
<<-BODY
|
194
|
+
Gem::Specification.new do |s|
|
195
|
+
s.name = '#{ @name }'
|
196
|
+
s.version = File.read('VERSION')
|
197
|
+
s.date = Time.now.strftime('%Y-%m-%d')
|
198
|
+
s.summary = ''
|
199
|
+
s.description = ''
|
200
|
+
s.author = 'Kyrylo Silin'
|
201
|
+
s.email = 'kyrylosilin@gmail.com'
|
202
|
+
s.homepage = 'https://github.com/kyrylo/#{ @name }'
|
203
|
+
s.licenses = 'zlib'
|
204
|
+
|
205
|
+
s.require_path = 'lib'
|
206
|
+
s.files = `git ls-files`.split("\\n")
|
207
|
+
|
208
|
+
s.add_development_dependency 'bacon'
|
209
|
+
s.add_development_dependency 'rake'
|
210
|
+
s.add_development_dependency 'pry'
|
211
|
+
end
|
212
|
+
BODY
|
213
|
+
end
|
214
|
+
|
215
|
+
def readme
|
216
|
+
<<-BODY
|
217
|
+
#{ n = capitalize(@name) }
|
218
|
+
#{ '=' * n.size }
|
219
|
+
|
220
|
+
* Repository: [https://github.com/kyrylo/#{ @name }][repo]
|
221
|
+
|
222
|
+
Description
|
223
|
+
-----------
|
224
|
+
|
225
|
+
Installation
|
226
|
+
------------
|
227
|
+
|
228
|
+
gem install #{ @name }
|
229
|
+
|
230
|
+
Synopsis
|
231
|
+
--------
|
232
|
+
|
233
|
+
Limitations
|
234
|
+
-----------
|
235
|
+
|
236
|
+
Credits
|
237
|
+
-------
|
238
|
+
|
239
|
+
Licence
|
240
|
+
-------
|
241
|
+
|
242
|
+
The project uses Zlib licence. See LICENCE file for more information.
|
243
|
+
|
244
|
+
[repo]: https://github.com/kyrylo/#{ @name }/ "Home page"
|
245
|
+
BODY
|
246
|
+
end
|
247
|
+
|
248
|
+
def capitalize(name)
|
249
|
+
name[0].capitalize +
|
250
|
+
name.gsub(/[_-]./) { |s| s[1].capitalize }.slice(1..-1)
|
251
|
+
end
|
252
|
+
|
253
|
+
end
|
254
|
+
|
255
|
+
end
|
data/spec/helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: buildgem
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kyrylo Silin
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-04-18 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: It is not a general purpose library
|
14
|
+
email: kyrylosilin@gmail.com
|
15
|
+
executables:
|
16
|
+
- buildgem
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- .gitignore
|
21
|
+
- CHANGELOG.md
|
22
|
+
- Gemfile
|
23
|
+
- LICENCE
|
24
|
+
- README.md
|
25
|
+
- Rakefile
|
26
|
+
- VERSION
|
27
|
+
- bin/buildgem
|
28
|
+
- buildgem.gemspec
|
29
|
+
- lib/buildgem.rb
|
30
|
+
- spec/buildgem_spec.rb
|
31
|
+
- spec/helper.rb
|
32
|
+
homepage: https://github.com/kyrylo/buildgem
|
33
|
+
licenses:
|
34
|
+
- zlib
|
35
|
+
metadata: {}
|
36
|
+
post_install_message:
|
37
|
+
rdoc_options: []
|
38
|
+
require_paths:
|
39
|
+
- lib
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ! '>='
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
requirements: []
|
51
|
+
rubyforge_project:
|
52
|
+
rubygems_version: 2.0.3
|
53
|
+
signing_key:
|
54
|
+
specification_version: 4
|
55
|
+
summary: Kyrylo's personal template for a gem
|
56
|
+
test_files: []
|
57
|
+
has_rdoc:
|