kjess 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/{HISTORY.rdoc → HISTORY.md} +9 -3
- data/Manifest.txt +5 -2
- data/{README.rdoc → README.md} +9 -9
- data/Rakefile +5 -334
- data/lib/kjess.rb +1 -1
- data/lib/kjess/client.rb +4 -4
- data/lib/kjess/connection.rb +38 -7
- data/lib/kjess/error.rb +5 -2
- data/lib/kjess/response/error.rb +1 -1
- data/lib/kjess/response/stats.rb +1 -1
- data/lib/kjess/socket.rb +19 -10
- data/spec/client_spec.rb +3 -3
- data/spec/connection_spec.rb +15 -0
- data/tasks/default.rake +271 -0
- data/tasks/this.rb +209 -0
- metadata +17 -24
data/tasks/this.rb
ADDED
@@ -0,0 +1,209 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
|
3
|
+
# Public: A Class containing all the metadata and utilities needed to manage a
|
4
|
+
# ruby project.
|
5
|
+
class ThisProject
|
6
|
+
# The name of this project
|
7
|
+
attr_accessor :name
|
8
|
+
|
9
|
+
# The author's name
|
10
|
+
attr_accessor :author
|
11
|
+
|
12
|
+
# The email address of the author(s)
|
13
|
+
attr_accessor :email
|
14
|
+
|
15
|
+
# The homepage of this project
|
16
|
+
attr_accessor :homepage
|
17
|
+
|
18
|
+
# The regex of files to exclude from the manifest
|
19
|
+
attr_accessor :exclude_from_manifest
|
20
|
+
|
21
|
+
# The hash of Gem::Specifications keyed' by platform
|
22
|
+
attr_accessor :gemspecs
|
23
|
+
|
24
|
+
# Public: Initialize ThisProject
|
25
|
+
#
|
26
|
+
# Yields self
|
27
|
+
def initialize(&block)
|
28
|
+
@exclude_from_manifest = %r/\.(git|DS_Store)|^(doc|coverage|pkg|tmp)|Gemfile*|\.(gemspec|swp|jar|bundle|so|rvmrc)$|~$/
|
29
|
+
@gemspecs = Hash.new
|
30
|
+
yield self if block_given?
|
31
|
+
end
|
32
|
+
|
33
|
+
# Public: return the version of ThisProject
|
34
|
+
#
|
35
|
+
# Search the ruby files in the project looking for the one that has the
|
36
|
+
# version string in it. This does not eval any code in the project, it parses
|
37
|
+
# the source code looking for the string.
|
38
|
+
#
|
39
|
+
# Returns a String version
|
40
|
+
def version
|
41
|
+
[ "lib/#{ name }.rb", "lib/#{ name }/version.rb" ].each do |v|
|
42
|
+
path = project_path( v )
|
43
|
+
line = path.read[/^\s*VERSION\s*=\s*.*/]
|
44
|
+
if line then
|
45
|
+
return line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# Internal: Return a section of an RDoc file with the given section name
|
51
|
+
#
|
52
|
+
# path - the relative path in the project of the file to parse
|
53
|
+
# section_name - the section out of the file from which to parse data
|
54
|
+
#
|
55
|
+
# Retuns the text of the section as an array of paragrphs.
|
56
|
+
def section_of( file, section_name )
|
57
|
+
re = /^[=#]+ (.*)$/
|
58
|
+
sectional = project_path( file )
|
59
|
+
parts = sectional.read.split( re )[1..-1]
|
60
|
+
parts.map! { |p| p.strip }
|
61
|
+
|
62
|
+
sections = Hash.new
|
63
|
+
Hash[*parts].each do |k,v|
|
64
|
+
sections[k] = v.split("\n\n")
|
65
|
+
end
|
66
|
+
return sections[section_name]
|
67
|
+
end
|
68
|
+
|
69
|
+
# Internal: print out a warning about the give task
|
70
|
+
def task_warning( task )
|
71
|
+
warn "WARNING: '#{task}' tasks are not defined. Please run 'rake develop'"
|
72
|
+
end
|
73
|
+
|
74
|
+
# Internal: Return the full path to the file that is relative to the project
|
75
|
+
# root.
|
76
|
+
#
|
77
|
+
# path - the relative path of the file from the project root
|
78
|
+
#
|
79
|
+
# Returns the Pathname of the file
|
80
|
+
def project_path( *relative_path )
|
81
|
+
project_root.join( *relative_path )
|
82
|
+
end
|
83
|
+
|
84
|
+
# Internal: The absolute path of this file
|
85
|
+
#
|
86
|
+
# Returns the Pathname of this file.
|
87
|
+
def this_file_path
|
88
|
+
Pathname.new( __FILE__ ).expand_path
|
89
|
+
end
|
90
|
+
|
91
|
+
# Internal: The root directory of this project
|
92
|
+
#
|
93
|
+
# This is defined as being the directory that is in the path of this project
|
94
|
+
# that has the first Rakefile
|
95
|
+
#
|
96
|
+
# Returns the Pathname of the directory
|
97
|
+
def project_root
|
98
|
+
this_file_path.ascend do |p|
|
99
|
+
rakefile = p.join( 'Rakefile' )
|
100
|
+
return p if rakefile.exist?
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
# Internal: Returns the contents of the Manifest.txt file as an array
|
105
|
+
#
|
106
|
+
# Returns an Array of strings
|
107
|
+
def manifest
|
108
|
+
manifest_file = project_path( "Manifest.txt" )
|
109
|
+
abort "You need a Manifest.txt" unless manifest_file.readable?
|
110
|
+
manifest_file.readlines.map { |l| l.strip }
|
111
|
+
end
|
112
|
+
|
113
|
+
# Internal: Return the files that define the extensions
|
114
|
+
#
|
115
|
+
# Returns an Array
|
116
|
+
def extension_conf_files
|
117
|
+
manifest.grep( /extconf.rb\Z/ )
|
118
|
+
end
|
119
|
+
|
120
|
+
# Internal: Returns the gemspace associated with the current ruby platform
|
121
|
+
def platform_gemspec
|
122
|
+
gemspecs[platform]
|
123
|
+
end
|
124
|
+
|
125
|
+
def core_gemspec
|
126
|
+
Gem::Specification.new do |spec|
|
127
|
+
spec.name = name
|
128
|
+
spec.version = version
|
129
|
+
spec.author = author
|
130
|
+
spec.email = email
|
131
|
+
spec.homepage = homepage
|
132
|
+
|
133
|
+
spec.summary = summary
|
134
|
+
spec.description = description
|
135
|
+
|
136
|
+
spec.files = manifest
|
137
|
+
spec.executables = spec.files.grep(/^bin/) { |f| File.basename(f) }
|
138
|
+
spec.test_files = spec.files.grep(/^spec/)
|
139
|
+
|
140
|
+
spec.extra_rdoc_files += spec.files.grep(/(txt|rdoc|md)$/)
|
141
|
+
spec.rdoc_options = [ "--main" , 'README.md',
|
142
|
+
"--markup", "tomdoc" ]
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
# Internal: Return the gemspec for the ruby platform
|
147
|
+
def ruby_gemspec( core = core_gemspec, &block )
|
148
|
+
yielding_gemspec( 'ruby', core, &block )
|
149
|
+
end
|
150
|
+
|
151
|
+
# Internal: Return the gemspec for the jruby platform
|
152
|
+
def java_gemspec( core = core_gemspec, &block )
|
153
|
+
yielding_gemspec( 'java', core, &block )
|
154
|
+
end
|
155
|
+
|
156
|
+
# Internal: give an initial spec and a key, create a new gemspec based off of
|
157
|
+
# it.
|
158
|
+
#
|
159
|
+
# This will force the new gemspecs 'platform' to be that of the key, since the
|
160
|
+
# only reason you would have multiple gemspecs at this point is to deal with
|
161
|
+
# different platforms.
|
162
|
+
def yielding_gemspec( key, core )
|
163
|
+
spec = gemspecs[key] ||= core.dup
|
164
|
+
spec.platform = key
|
165
|
+
yield spec if block_given?
|
166
|
+
return spec
|
167
|
+
end
|
168
|
+
|
169
|
+
# Internal: Set the recovery gem development dependency
|
170
|
+
#
|
171
|
+
# These are dynamically set since they cannot be hard coded as there is
|
172
|
+
# no way to ship them correctly in the gemspec
|
173
|
+
#
|
174
|
+
# Returns nothing.
|
175
|
+
def set_coverage_gem
|
176
|
+
if RUBY_VERSION < "1.9.0"
|
177
|
+
platform_gemspec.add_development_dependency( 'rcov', '~> 1.0.0' )
|
178
|
+
else
|
179
|
+
platform_gemspec.add_development_dependency( 'simplecov', '~> 0.7.1' )
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
# Internal: Return the platform of ThisProject at the current moment in time.
|
184
|
+
def platform
|
185
|
+
(RUBY_PLATFORM == "java") ? 'java' : Gem::Platform::RUBY
|
186
|
+
end
|
187
|
+
|
188
|
+
# Internal: Return the DESCRIPTION section of the README.rdoc file
|
189
|
+
def description_section
|
190
|
+
section_of( 'README.md', 'DESCRIPTION')
|
191
|
+
end
|
192
|
+
|
193
|
+
# Internal: Return the summary text from the README
|
194
|
+
def summary
|
195
|
+
description_section.first
|
196
|
+
end
|
197
|
+
|
198
|
+
# Internal: Return the full description text from the READEM
|
199
|
+
def description
|
200
|
+
description_section.join(" ").tr("\n", ' ').gsub(/[{}]/,'').gsub(/\[[^\]]+\]/,'') # strip rdoc
|
201
|
+
end
|
202
|
+
|
203
|
+
# Internal: The path to the gemspec file
|
204
|
+
def gemspec_file
|
205
|
+
project_path( "#{ name }.gemspec" )
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
This = ThisProject.new
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kjess
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.2.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Jeremy Hinegardner
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-07-10 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rake
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,23 +27,20 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: minitest
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ~>
|
36
32
|
- !ruby/object:Gem::Version
|
37
|
-
version: 4.
|
33
|
+
version: 4.5.0
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ~>
|
44
39
|
- !ruby/object:Gem::Version
|
45
|
-
version: 4.
|
40
|
+
version: 4.5.0
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rdoc
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - ~>
|
52
46
|
- !ruby/object:Gem::Version
|
@@ -54,7 +48,6 @@ dependencies:
|
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - ~>
|
60
53
|
- !ruby/object:Gem::Version
|
@@ -62,7 +55,6 @@ dependencies:
|
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: zip
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
59
|
- - ~>
|
68
60
|
- !ruby/object:Gem::Version
|
@@ -70,7 +62,6 @@ dependencies:
|
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
66
|
- - ~>
|
76
67
|
- !ruby/object:Gem::Version
|
@@ -78,7 +69,6 @@ dependencies:
|
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: json
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
73
|
- - ~>
|
84
74
|
- !ruby/object:Gem::Version
|
@@ -86,7 +76,6 @@ dependencies:
|
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
80
|
- - ~>
|
92
81
|
- !ruby/object:Gem::Version
|
@@ -97,15 +86,16 @@ email: jeremy@copiousfreetime.org
|
|
97
86
|
executables: []
|
98
87
|
extensions: []
|
99
88
|
extra_rdoc_files:
|
100
|
-
-
|
89
|
+
- CONTRIBUTING.md
|
90
|
+
- HISTORY.md
|
101
91
|
- Manifest.txt
|
102
|
-
- README.
|
92
|
+
- README.md
|
103
93
|
files:
|
104
94
|
- CONTRIBUTING.md
|
105
|
-
- HISTORY.
|
95
|
+
- HISTORY.md
|
106
96
|
- LICENSE
|
107
97
|
- Manifest.txt
|
108
|
-
- README.
|
98
|
+
- README.md
|
109
99
|
- Rakefile
|
110
100
|
- example/client_test.rb
|
111
101
|
- lib/kjess.rb
|
@@ -147,6 +137,7 @@ files:
|
|
147
137
|
- lib/kjess/socket.rb
|
148
138
|
- lib/kjess/stats_cache.rb
|
149
139
|
- spec/client_spec.rb
|
140
|
+
- spec/connection_spec.rb
|
150
141
|
- spec/kestrel_server.rb
|
151
142
|
- spec/request/set_spec.rb
|
152
143
|
- spec/request/version_spec.rb
|
@@ -155,38 +146,40 @@ files:
|
|
155
146
|
- spec/spec_helper.rb
|
156
147
|
- spec/utils.rb
|
157
148
|
- spec/version_spec.rb
|
149
|
+
- tasks/default.rake
|
158
150
|
- tasks/kestrel.rake
|
151
|
+
- tasks/this.rb
|
159
152
|
homepage: http://github.com/copiousfreetime/kjess
|
160
153
|
licenses: []
|
154
|
+
metadata: {}
|
161
155
|
post_install_message:
|
162
156
|
rdoc_options:
|
163
157
|
- --main
|
164
|
-
- README.
|
158
|
+
- README.md
|
165
159
|
- --markup
|
166
160
|
- tomdoc
|
167
161
|
require_paths:
|
168
162
|
- lib
|
169
163
|
required_ruby_version: !ruby/object:Gem::Requirement
|
170
|
-
none: false
|
171
164
|
requirements:
|
172
165
|
- - ! '>='
|
173
166
|
- !ruby/object:Gem::Version
|
174
167
|
version: '0'
|
175
168
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
176
|
-
none: false
|
177
169
|
requirements:
|
178
170
|
- - ! '>='
|
179
171
|
- !ruby/object:Gem::Version
|
180
172
|
version: '0'
|
181
173
|
requirements: []
|
182
174
|
rubyforge_project:
|
183
|
-
rubygems_version:
|
175
|
+
rubygems_version: 2.0.3
|
184
176
|
signing_key:
|
185
|
-
specification_version:
|
177
|
+
specification_version: 4
|
186
178
|
summary: KJess is a pure ruby Kestrel client that supports Kestrel's Memcache style
|
187
179
|
protocol.
|
188
180
|
test_files:
|
189
181
|
- spec/client_spec.rb
|
182
|
+
- spec/connection_spec.rb
|
190
183
|
- spec/kestrel_server.rb
|
191
184
|
- spec/request/set_spec.rb
|
192
185
|
- spec/request/version_spec.rb
|