keystone 0.0.31 → 0.0.32

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,3 @@
1
+ *.log
2
+ .DS_Store
3
+ *.gem
@@ -0,0 +1,4 @@
1
+ - updating gem
2
+
3
+ rake build
4
+ gem push pkg/keystone*******
data/Rakefile CHANGED
@@ -11,19 +11,32 @@ $:.unshift "lib"
11
11
  # sh "gem install kanamei-keystone-#{Keystone::VERSION}.gem"
12
12
  # end
13
13
 
14
- task :build do
15
- begin
16
- require 'jeweler'
17
- Jeweler::Tasks.new do |gemspec|
14
+ #task :build do
15
+ #begin
16
+ #require 'jeweler'
17
+ #Jeweler::Tasks.new do |gemspec|
18
+ #gemspec.name = "keystone"
19
+ #gemspec.summary = "oreore library"
20
+ #gemspec.email = "paco.jp@gmail.com"
21
+ #gemspec.homepage = "http://github.com/kanamei/keystone"
22
+ #gemspec.description = "oreore library"
23
+ #gemspec.authors = ["paco"]
24
+ #end
25
+ #rescue LoadError
26
+ #puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
27
+ #end
28
+ #end
29
+
30
+ begin
31
+ require 'jeweler'
32
+ Jeweler::Tasks.new do |gemspec|
18
33
  gemspec.name = "keystone"
19
34
  gemspec.summary = "oreore library"
20
35
  gemspec.email = "paco.jp@gmail.com"
21
36
  gemspec.homepage = "http://github.com/kanamei/keystone"
22
37
  gemspec.description = "oreore library"
23
38
  gemspec.authors = ["paco"]
24
- end
25
- rescue LoadError
26
- puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
27
- end
39
+ end
40
+ rescue LoadError
41
+ puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
28
42
  end
29
-
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.31
1
+ 0.0.32
@@ -1,23 +1,25 @@
1
1
  # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{keystone}
8
- s.version = "0.0.29"
7
+ s.name = "keystone"
8
+ s.version = "0.0.32"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["paco"]
12
- s.date = %q{2010-09-02}
13
- s.description = %q{oreore library}
14
- s.email = %q{paco.jp@gmail.com}
12
+ s.date = "2011-12-07"
13
+ s.description = "oreore library"
14
+ s.email = "paco.jp@gmail.com"
15
15
  s.extra_rdoc_files = [
16
- "README"
16
+ "README",
17
+ "README.ore"
17
18
  ]
18
19
  s.files = [
19
20
  ".gitignore",
20
21
  "README",
22
+ "README.ore",
21
23
  "Rakefile",
22
24
  "VERSION",
23
25
  "doc/classes/Dir.html",
@@ -160,14 +162,15 @@ Gem::Specification.new do |s|
160
162
  "lib/keystone/core_ext/tempfile.rb",
161
163
  "lib/keystone/core_ext/uri.rb",
162
164
  "lib/keystone/mail.rb",
163
- "lib/keystone/mail/address.rb",
164
- "lib/keystone/mail/content_type.rb",
165
- "lib/keystone/mail/message.rb",
166
- "lib/keystone/mail/message_factory.rb",
167
- "lib/keystone/mail/message_iso2022jp.rb",
168
- "lib/keystone/mail/message_sjis.rb",
169
- "lib/keystone/mail/receive.rb",
170
165
  "lib/keystone/mail/send.rb",
166
+ "lib/keystone/mail__old/address.rb",
167
+ "lib/keystone/mail__old/content_type.rb",
168
+ "lib/keystone/mail__old/message.rb",
169
+ "lib/keystone/mail__old/message_factory.rb",
170
+ "lib/keystone/mail__old/message_iso2022jp.rb",
171
+ "lib/keystone/mail__old/message_sjis.rb",
172
+ "lib/keystone/mail__old/receive.rb",
173
+ "lib/keystone/mail__old/send.rb",
171
174
  "lib/keystone/os.rb",
172
175
  "lib/keystone/os/abstract_os.rb",
173
176
  "lib/keystone/os/centos.rb",
@@ -178,6 +181,7 @@ Gem::Specification.new do |s|
178
181
  "lib/keystone/string_util.rb",
179
182
  "test/test_core_ext.rb",
180
183
  "test/test_string_util.rb",
184
+ "test_local/batch.rb",
181
185
  "util/README",
182
186
  "util/bin/command_broadcast.rb",
183
187
  "util/bin/disk_size_check.rb",
@@ -186,18 +190,17 @@ Gem::Specification.new do |s|
186
190
  "vendor/flag_set_maker.rb",
187
191
  "vendor/moji.rb"
188
192
  ]
189
- s.homepage = %q{http://github.com/kanamei/keystone}
193
+ s.homepage = "http://github.com/kanamei/keystone"
190
194
  s.rdoc_options = ["--charset=UTF-8"]
191
195
  s.require_paths = ["lib"]
192
- s.rubygems_version = %q{1.3.7}
193
- s.summary = %q{oreore library}
196
+ s.rubygems_version = "1.8.11"
197
+ s.summary = "oreore library"
194
198
  s.test_files = [
195
199
  "test/test_core_ext.rb",
196
200
  "test/test_string_util.rb"
197
201
  ]
198
202
 
199
203
  if s.respond_to? :specification_version then
200
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
201
204
  s.specification_version = 3
202
205
 
203
206
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
@@ -206,4 +209,3 @@ Gem::Specification.new do |s|
206
209
  else
207
210
  end
208
211
  end
209
-
@@ -3,8 +3,10 @@
3
3
  #$KCODE = 'u'
4
4
 
5
5
 
6
- # version check
7
- raise 'this version only for 1.9.2' unless RUBY_VERSION == '1.9.2'
6
+ unless RUBY_VERSION == '1.9.2' || RUBY_VERSION == '1.9.3'
7
+ # version check
8
+ raise 'this version only for 1.9.2 or 1.9.3'
9
+ end
8
10
 
9
11
  require 'keystone/core_ext'
10
12
  require 'keystone/base'
@@ -16,7 +18,7 @@ autoload :Moji , 'vendor/moji'
16
18
 
17
19
  module Keystone
18
20
 
19
- VERSION = '0.0.31'
21
+ VERSION = '0.0.32'
20
22
 
21
23
  autoload :StringUtil , 'keystone/string_util'
22
24
  autoload :Batch , 'keystone/batch'
@@ -15,7 +15,7 @@ class Array
15
15
  end
16
16
  return ret
17
17
  end
18
-
18
+
19
19
  if RUBY_VERSION < '1.8.7'
20
20
  def sample(count=1)
21
21
  if count == 1
@@ -27,4 +27,33 @@ class Array
27
27
  end
28
28
  end
29
29
  end
30
- end
30
+
31
+ #
32
+ # 候補が実は複数あるときはエラーを出したいが、、、今のところ無しで
33
+ #
34
+ def left_join!(name,ar,index1,index2)
35
+
36
+ key_hits = []
37
+ has = {}
38
+ ar.each do |o|
39
+ if o.has_key?(index2)
40
+ val = o[index2]
41
+ if key_hits.include?(val)
42
+ raise "right side data is multiple(#{val})"
43
+ end
44
+ h = o.clone
45
+ h.delete(index2)
46
+ has[val] = h
47
+ end
48
+ end
49
+
50
+ self.each do |i|
51
+ if has.has_key?(i[index1])
52
+ has[i[index1]].each do |key,value|
53
+ i["#{name.to_s}_#{key}"] = value
54
+ end
55
+ end
56
+ end
57
+ self
58
+ end
59
+ end
@@ -1,15 +1,63 @@
1
- require 'rubygems'
2
- require 'redgreen'
3
- require 'lib/keystone/core_ext'
1
+ #require 'redgreen'
2
+
3
+ gem 'term-ansicolor'
4
+ gem 'turn'
5
+ require 'test/unit'
6
+ require './lib/keystone/core_ext'
7
+ require './lib/keystone/core_ext/array'
4
8
 
5
9
  class TestCoreExt < Test::Unit::TestCase
6
10
  def setup
7
- end
8
-
11
+ end
12
+
9
13
  def test_array_split_by
10
14
  assert_equal([1,2,3,4,5,6,7,8,9].split_by(3),[[1, 2, 3], [4, 5, 6], [7, 8, 9]])
11
15
  assert_equal([1,2,3,4,5,6,7,8,9,10].split_by(2),[[1,2],[3,4],[5,6],[7,8],[9,10]])
12
16
  assert_equal([].split_by(3),[])
13
17
  assert_equal([[1,2,3,4],[1,23],[2,33],[[4]]].split_by(3),[[[1, 2, 3, 4], [1, 23], [2, 33]], [[[4]]]])
14
18
  end
15
- end
19
+
20
+ def test_array_left_join
21
+ test1 = [{:a=>1,:b=>2}]
22
+ test2 = [{:a=>2,:c=>3}]
23
+ test3 = [{:a=>1,:c=>4},{:a=>2,:c=>6}]
24
+ test4 = [{:a=>1,:b=>2,'test3_c'=>4}]
25
+ test5 = [{:a=>1,:b=>2},{:a=>1,:b=>2}]
26
+ test6 = [{:a=>1,:b=>2,'test3_c'=>4},{:a=>1,:b=>2,'test3_c'=>4}]
27
+ test7 = [{:a=>1,:b=>2},{:a=>2,:b=>'test'}]
28
+ test8 = [{:a=>1,:b=>2,'test3_c'=>4},{:a=>2,:b=>'test','test3_c'=>6}]
29
+
30
+ ans = test1.left_join!(:test2,test2,:a,:a)
31
+ assert_equal(ans,test1)
32
+ ans = test1.left_join!(:test3,test3,:a,:a)
33
+ assert_equal(ans,test4)
34
+ ans = test7.left_join!(:test3,test3,:a,:a)
35
+ assert_equal(ans,test8)
36
+
37
+ test1 = []
38
+ (0..300000).each do |i|
39
+ has = {}
40
+ [:a,:b,:c,:d,:e,:f,:g,:h].each do |k|
41
+ has[k] = "#{k}#{i}"
42
+ end
43
+ has[:st] = '1' * 80
44
+ test1 << has
45
+ end
46
+
47
+ test2 = []
48
+ (0..300000).each do |i|
49
+ has = {}
50
+ [:a,:b,:c,:d,:e,:f,:g,:h].each do |k|
51
+ has[k] = "#{k}#{i}"
52
+ end
53
+ has[:st] = '1' * 80
54
+ test2 << has
55
+ end
56
+
57
+ puts Time.now
58
+ puts test1.left_join!(:test2,test2,:a,:a)
59
+ puts Time.now
60
+
61
+
62
+ end
63
+ end
metadata CHANGED
@@ -1,29 +1,27 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: keystone
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.32
4
5
  prerelease:
5
- version: 0.0.31
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - paco
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-02-07 00:00:00 +09:00
14
- default_executable:
12
+ date: 2011-12-07 00:00:00.000000000 Z
15
13
  dependencies: []
16
-
17
14
  description: oreore library
18
15
  email: paco.jp@gmail.com
19
16
  executables: []
20
-
21
17
  extensions: []
22
-
23
- extra_rdoc_files:
18
+ extra_rdoc_files:
24
19
  - README
25
- files:
20
+ - README.ore
21
+ files:
22
+ - .gitignore
26
23
  - README
24
+ - README.ore
27
25
  - Rakefile
28
26
  - VERSION
29
27
  - doc/classes/Dir.html
@@ -193,34 +191,31 @@ files:
193
191
  - util/bin/ve2tar.rb
194
192
  - vendor/flag_set_maker.rb
195
193
  - vendor/moji.rb
196
- has_rdoc: true
197
194
  homepage: http://github.com/kanamei/keystone
198
195
  licenses: []
199
-
200
196
  post_install_message:
201
- rdoc_options: []
202
-
203
- require_paths:
197
+ rdoc_options:
198
+ - --charset=UTF-8
199
+ require_paths:
204
200
  - lib
205
- required_ruby_version: !ruby/object:Gem::Requirement
201
+ required_ruby_version: !ruby/object:Gem::Requirement
206
202
  none: false
207
- requirements:
208
- - - ">="
209
- - !ruby/object:Gem::Version
210
- version: "0"
211
- required_rubygems_version: !ruby/object:Gem::Requirement
203
+ requirements:
204
+ - - ! '>='
205
+ - !ruby/object:Gem::Version
206
+ version: '0'
207
+ required_rubygems_version: !ruby/object:Gem::Requirement
212
208
  none: false
213
- requirements:
214
- - - ">="
215
- - !ruby/object:Gem::Version
216
- version: "0"
209
+ requirements:
210
+ - - ! '>='
211
+ - !ruby/object:Gem::Version
212
+ version: '0'
217
213
  requirements: []
218
-
219
214
  rubyforge_project:
220
- rubygems_version: 1.5.0
215
+ rubygems_version: 1.8.11
221
216
  signing_key:
222
217
  specification_version: 3
223
218
  summary: oreore library
224
- test_files:
219
+ test_files:
225
220
  - test/test_core_ext.rb
226
221
  - test/test_string_util.rb