fattr 2.3.0 → 2.4.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.
- checksums.yaml +7 -0
- data/Rakefile +57 -38
- data/fattr.gemspec +6 -4
- data/lib/fattr.rb +10 -12
- data/lib/fattr/_lib.rb +9 -0
- data/lib/fattr/version.rb +9 -0
- data/test/fattr_test.rb +2 -2
- metadata +10 -10
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 57f2c500d8d74df7c52da2ccaafc869e1d45117f
|
4
|
+
data.tar.gz: cbdef0846e66ae8024f51be65a8d7eea06a02eab
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3378a0d8d5d8219dae4f6943d69cfcf00d14fc5039b42d1236f0178ef79bf9a9c0afb084e02ca57212c43bfbee146663a95d90a11ab0e85e0dc2872c997db021
|
7
|
+
data.tar.gz: a0e6fbc36f5339bb2c2b3cd8c33e70a333f25ad36766fe18bdaece9abe2898ffee26fbd18a062804ddb97c3f6267da0b48416523cfa87166f774e06854b67e49
|
data/Rakefile
CHANGED
@@ -4,7 +4,7 @@ This.email = "ara.t.howard@gmail.com"
|
|
4
4
|
This.homepage = "https://github.com/ahoward/#{ This.lib }"
|
5
5
|
|
6
6
|
task :license do
|
7
|
-
open('LICENSE', 'w'){|fd| fd.puts "
|
7
|
+
open('LICENSE', 'w'){|fd| fd.puts "Ruby"}
|
8
8
|
end
|
9
9
|
|
10
10
|
task :default do
|
@@ -93,7 +93,7 @@ task :gemspec do
|
|
93
93
|
test_files = "test/#{ lib }.rb" if File.file?("test/#{ lib }.rb")
|
94
94
|
summary = object.respond_to?(:summary) ? object.summary : "summary: #{ lib } kicks the ass"
|
95
95
|
description = object.respond_to?(:description) ? object.description : "description: #{ lib } kicks the ass"
|
96
|
-
license = object.respond_to?(:license) ? object.license : "
|
96
|
+
license = object.respond_to?(:license) ? object.license : "Ruby"
|
97
97
|
|
98
98
|
if This.extensions.nil?
|
99
99
|
This.extensions = []
|
@@ -104,39 +104,51 @@ task :gemspec do
|
|
104
104
|
end
|
105
105
|
extensions = [extensions].flatten.compact
|
106
106
|
|
107
|
+
if This.dependencies.nil?
|
108
|
+
dependencies = []
|
109
|
+
else
|
110
|
+
case This.dependencies
|
111
|
+
when Hash
|
112
|
+
dependencies = This.dependencies.values
|
113
|
+
when Array
|
114
|
+
dependencies = This.dependencies
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
107
118
|
template =
|
108
119
|
if test(?e, 'gemspec.erb')
|
109
120
|
Template{ IO.read('gemspec.erb') }
|
110
121
|
else
|
111
122
|
Template {
|
112
123
|
<<-__
|
113
|
-
##
|
124
|
+
## <%= lib %>.gemspec
|
114
125
|
#
|
115
126
|
|
116
127
|
Gem::Specification::new do |spec|
|
117
|
-
spec.name =
|
118
|
-
spec.version =
|
128
|
+
spec.name = <%= lib.inspect %>
|
129
|
+
spec.version = <%= version.inspect %>
|
119
130
|
spec.platform = Gem::Platform::RUBY
|
120
|
-
spec.summary =
|
121
|
-
spec.description =
|
122
|
-
spec.license =
|
131
|
+
spec.summary = <%= lib.inspect %>
|
132
|
+
spec.description = <%= description.inspect %>
|
133
|
+
spec.license = <%= license.inspect %>
|
123
134
|
|
124
|
-
spec.files =\n
|
125
|
-
spec.executables =
|
135
|
+
spec.files =\n<%= files.sort.pretty_inspect %>
|
136
|
+
spec.executables = <%= executables.inspect %>
|
126
137
|
|
127
138
|
spec.require_path = "lib"
|
128
139
|
|
129
|
-
spec.test_files =
|
140
|
+
spec.test_files = <%= test_files.inspect %>
|
130
141
|
|
131
|
-
|
132
|
-
|
142
|
+
<% dependencies.each do |lib_version| %>
|
143
|
+
spec.add_dependency(*<%= Array(lib_version).flatten.inspect %>)
|
144
|
+
<% end %>
|
133
145
|
|
134
|
-
spec.extensions.push(
|
146
|
+
spec.extensions.push(*<%= extensions.inspect %>)
|
135
147
|
|
136
|
-
spec.rubyforge_project =
|
137
|
-
spec.author =
|
138
|
-
spec.email =
|
139
|
-
spec.homepage =
|
148
|
+
spec.rubyforge_project = <%= This.rubyforge_project.inspect %>
|
149
|
+
spec.author = <%= This.author.inspect %>
|
150
|
+
spec.email = <%= This.email.inspect %>
|
151
|
+
spec.homepage = <%= This.homepage.inspect %>
|
140
152
|
end
|
141
153
|
__
|
142
154
|
}
|
@@ -249,28 +261,35 @@ BEGIN {
|
|
249
261
|
#
|
250
262
|
This = OpenStruct.new
|
251
263
|
|
252
|
-
This.file
|
253
|
-
This.dir
|
264
|
+
This.file = File.expand_path(__FILE__)
|
265
|
+
This.dir = File.dirname(This.file)
|
254
266
|
This.pkgdir = File.join(This.dir, 'pkg')
|
255
267
|
|
256
|
-
|
268
|
+
This.lib = File.basename(Dir.pwd)
|
269
|
+
This._lib = "#{ This.dir }/lib/#{ This.lib }/_lib.rb"
|
270
|
+
|
271
|
+
# load meta lib info
|
257
272
|
#
|
258
|
-
|
259
|
-
|
260
|
-
|
273
|
+
a = Object.constants.dup
|
274
|
+
require This._lib
|
275
|
+
b = Object.constants.dup
|
276
|
+
added = b - a
|
277
|
+
const = added.first
|
278
|
+
|
279
|
+
if added.size > 1
|
280
|
+
STDERR.puts "WARNING: defined multiple constants #{ added.inspect } in #{ _lib }, using #{ const } !!!"
|
261
281
|
end
|
262
|
-
This.lib = lib
|
263
282
|
|
264
|
-
|
283
|
+
This.const = const
|
284
|
+
This.object = Object.const_get(This.const)
|
285
|
+
This.name = This.object.name
|
286
|
+
This.version = This.object.send(:version)
|
287
|
+
|
288
|
+
# see if dependencies are export by the module
|
265
289
|
#
|
266
|
-
|
267
|
-
|
268
|
-
require "./lib/#{ This.lib }"
|
269
|
-
This.name = lib.capitalize
|
270
|
-
This.object = eval(This.name)
|
271
|
-
version = This.object.send(:version)
|
290
|
+
if This.object.respond_to?(:dependencies)
|
291
|
+
This.dependencies = This.object.dependencies
|
272
292
|
end
|
273
|
-
This.version = version
|
274
293
|
|
275
294
|
# we need to know the name of the lib an it's version
|
276
295
|
#
|
@@ -279,12 +298,12 @@ BEGIN {
|
|
279
298
|
|
280
299
|
# discover full path to this ruby executable
|
281
300
|
#
|
282
|
-
c
|
283
|
-
bindir
|
301
|
+
c = RbConfig::CONFIG
|
302
|
+
bindir = c["bindir"] || c['BINDIR']
|
284
303
|
ruby_install_name = c['ruby_install_name'] || c['RUBY_INSTALL_NAME'] || 'ruby'
|
285
|
-
ruby_ext
|
286
|
-
ruby
|
287
|
-
This.ruby
|
304
|
+
ruby_ext = c['EXEEXT'] || ''
|
305
|
+
ruby = File.join(bindir, (ruby_install_name + ruby_ext))
|
306
|
+
This.ruby = ruby
|
288
307
|
|
289
308
|
# some utils
|
290
309
|
#
|
data/fattr.gemspec
CHANGED
@@ -3,11 +3,11 @@
|
|
3
3
|
|
4
4
|
Gem::Specification::new do |spec|
|
5
5
|
spec.name = "fattr"
|
6
|
-
spec.version = "2.
|
6
|
+
spec.version = "2.4.0"
|
7
7
|
spec.platform = Gem::Platform::RUBY
|
8
8
|
spec.summary = "fattr"
|
9
9
|
spec.description = "a \"fatter attr\" for ruby"
|
10
|
-
spec.license = "
|
10
|
+
spec.license = "Ruby"
|
11
11
|
|
12
12
|
spec.files =
|
13
13
|
["LICENSE",
|
@@ -16,7 +16,10 @@ Gem::Specification::new do |spec|
|
|
16
16
|
"Rakefile",
|
17
17
|
"fattr.gemspec",
|
18
18
|
"lib",
|
19
|
+
"lib/fattr",
|
19
20
|
"lib/fattr.rb",
|
21
|
+
"lib/fattr/_lib.rb",
|
22
|
+
"lib/fattr/version.rb",
|
20
23
|
"samples",
|
21
24
|
"samples/a.rb",
|
22
25
|
"samples/b.rb",
|
@@ -36,8 +39,7 @@ Gem::Specification::new do |spec|
|
|
36
39
|
|
37
40
|
spec.test_files = nil
|
38
41
|
|
39
|
-
|
40
|
-
#### spec.add_dependency 'map'
|
42
|
+
|
41
43
|
|
42
44
|
spec.extensions.push(*[])
|
43
45
|
|
data/lib/fattr.rb
CHANGED
@@ -1,10 +1,7 @@
|
|
1
1
|
module Fattr
|
2
|
-
|
3
|
-
def Fattr.version() Fattr::Version end
|
2
|
+
require_relative 'fattr/_lib.rb'
|
4
3
|
|
5
|
-
|
6
|
-
'a "fatter attr" for ruby'
|
7
|
-
end
|
4
|
+
SEMAPHORE = Mutex.new
|
8
5
|
|
9
6
|
class List < ::Array
|
10
7
|
attr_accessor :object
|
@@ -88,21 +85,21 @@ module Fattr
|
|
88
85
|
end
|
89
86
|
end
|
90
87
|
|
91
|
-
initializers = __fattrs__.initializers
|
88
|
+
#initializers = __fattrs__.initializers
|
92
89
|
|
93
|
-
names_and_configs.each do |name,
|
90
|
+
names_and_configs.each do |name, _config|
|
94
91
|
raise(NameError, "bad instance variable name '@#{ name }'") if("@#{ name }" =~ %r/[!?=]$/o)
|
95
92
|
|
96
93
|
name = name.to_s
|
97
94
|
|
98
95
|
default = nil
|
99
|
-
default =
|
100
|
-
default =
|
96
|
+
default = _config[:default] if _config.has_key?(:default)
|
97
|
+
default = _config['default'] if _config.has_key?('default')
|
101
98
|
|
102
99
|
inheritable = false
|
103
100
|
if Module===self
|
104
|
-
inheritable =
|
105
|
-
inheritable =
|
101
|
+
inheritable = _config[:inheritable] if _config.has_key?(:inheritable)
|
102
|
+
inheritable = _config['inheritable'] if _config.has_key?('inheritable')
|
106
103
|
end
|
107
104
|
|
108
105
|
initialize = (
|
@@ -125,7 +122,7 @@ module Fattr
|
|
125
122
|
Object.instance_method('instance_eval').bind(this).call(&initialize)
|
126
123
|
end
|
127
124
|
|
128
|
-
initializer_id = initializer.object_id
|
125
|
+
#initializer_id = initializer.object_id
|
129
126
|
|
130
127
|
__fattrs__.initializers[name] = initializer
|
131
128
|
|
@@ -151,6 +148,7 @@ module Fattr
|
|
151
148
|
def #{ name }(*value, &block)
|
152
149
|
value.unshift block if block
|
153
150
|
return self.send('#{ name }=', value.first) unless value.empty?
|
151
|
+
#SEMAPHORE.synchronize{ #{ name }! unless defined? @#{ name } }
|
154
152
|
#{ name }! unless defined? @#{ name }
|
155
153
|
@#{ name }
|
156
154
|
end
|
data/lib/fattr/_lib.rb
ADDED
data/test/fattr_test.rb
CHANGED
@@ -157,7 +157,7 @@ BEGIN {
|
|
157
157
|
|
158
158
|
def self.testing(*args, &block)
|
159
159
|
method = ["test", testno, slug_for(*args)].delete_if{|part| part.empty?}.join('_')
|
160
|
-
define_method(
|
160
|
+
define_method(method, &block)
|
161
161
|
end
|
162
162
|
|
163
163
|
alias_method '__assert__', 'assert'
|
@@ -177,7 +177,7 @@ BEGIN {
|
|
177
177
|
end
|
178
178
|
end
|
179
179
|
|
180
|
-
module_eval
|
180
|
+
module_eval(&block)
|
181
181
|
self
|
182
182
|
end
|
183
183
|
end
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fattr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
5
|
-
prerelease:
|
4
|
+
version: 2.4.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Ara T. Howard
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2018-03-02 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
13
|
description: a "fatter attr" for ruby
|
15
14
|
email: ara.t.howard@gmail.com
|
@@ -23,6 +22,8 @@ files:
|
|
23
22
|
- Rakefile
|
24
23
|
- fattr.gemspec
|
25
24
|
- lib/fattr.rb
|
25
|
+
- lib/fattr/_lib.rb
|
26
|
+
- lib/fattr/version.rb
|
26
27
|
- samples/a.rb
|
27
28
|
- samples/b.rb
|
28
29
|
- samples/c.rb
|
@@ -35,28 +36,27 @@ files:
|
|
35
36
|
- test/fattr_test.rb
|
36
37
|
homepage: https://github.com/ahoward/fattr
|
37
38
|
licenses:
|
38
|
-
-
|
39
|
+
- Ruby
|
40
|
+
metadata: {}
|
39
41
|
post_install_message:
|
40
42
|
rdoc_options: []
|
41
43
|
require_paths:
|
42
44
|
- lib
|
43
45
|
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
-
none: false
|
45
46
|
requirements:
|
46
|
-
- -
|
47
|
+
- - ">="
|
47
48
|
- !ruby/object:Gem::Version
|
48
49
|
version: '0'
|
49
50
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
requirements: []
|
56
56
|
rubyforge_project: codeforpeople
|
57
|
-
rubygems_version:
|
57
|
+
rubygems_version: 2.6.8
|
58
58
|
signing_key:
|
59
|
-
specification_version:
|
59
|
+
specification_version: 4
|
60
60
|
summary: fattr
|
61
61
|
test_files: []
|
62
62
|
has_rdoc:
|