swift 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 18c278ce050ba2e983c44f446ec275b3cb9fb867
4
+ data.tar.gz: 55ad66f690b578a47bf9446611cb044c10a1f4f2
5
+ SHA512:
6
+ metadata.gz: 6514b0f039f53ceb35dfc1db5b91eb4b14a5e48d820302aba581262bd8fecccaf7da3eb97c3abf261f1698b919da5b4271f8d2e95fc10afccb6005aba7e6a529
7
+ data.tar.gz: c849a24b4b450f6cdf6c37031271115d06626180e07b4b9ae6e897a2e7821f01c163fcb1a73cb5dbad3feb1d40f9f64a3138e2a8fa5eb02d2b15dd9c9ed8cace
data/Rakefile CHANGED
@@ -1,22 +1,5 @@
1
1
  require 'rake'
2
-
3
- begin
4
- require 'jeweler'
5
- Jeweler::Tasks.new do |gem|
6
- gem.name = 'swift'
7
- gem.summary = %q{A rational rudimentary database abstraction.}
8
- gem.description = %q{A rational rudimentary database abstraction.}
9
- gem.email = %w{shane.hanna@gmail.com deepfryed@gmail.com}
10
- gem.homepage = 'http://github.com/shanna/swift'
11
- gem.authors = ["Shane Hanna", "Bharanee 'Barney' Rathna"]
12
- gem.files.reject!{|f| f =~ %r{\.gitignore|examples|benchmarks|memory|gems/.*|Gemfile}}
13
-
14
- gem.add_development_dependency 'minitest', '>= 1.7.0'
15
- end
16
- Jeweler::GemcutterTasks.new
17
- rescue LoadError
18
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
19
- end
2
+ require 'date'
20
3
 
21
4
  require 'rake/testtask'
22
5
  Rake::TestTask.new(:test) do |test|
@@ -29,5 +12,45 @@ task :default => :test
29
12
 
30
13
  require 'yard'
31
14
  YARD::Rake::YardocTask.new do |yard|
32
- yard.files = Dir["lib/**/*.rb"].reject {|file| %r{eventmachine|synchrony}.match(file)}
15
+ yard.files = Dir["lib/**/*.rb"].reject{|file| %r{eventmachine|synchrony}.match(file)}
16
+ end
17
+
18
+ require_relative 'lib/swift/version'
19
+ $gemspec = Gem::Specification.new do |s|
20
+ s.name = 'swift'
21
+ s.version = Swift::VERSION
22
+ s.authors = ['Shane Hanna', %q{Bharanee 'Barney' Rathna}]
23
+ s.date = Date.today
24
+ s.description = 'A rational rudimentary database abstraction.'
25
+ s.summary = 'A rational rudimentary database abstraction.'
26
+ s.email = ['shane.hanna@gmail.com', 'deepfryed@gmail.com']
27
+ s.licenses = %w{MIT}
28
+ s.homepage = 'http://github.com/shanna/swift'
29
+ s.require_paths = %w{lib}
30
+ s.required_ruby_version = '>= 1.9.2'
31
+
32
+ s.files = `git ls-files`.split("\n").reject{|f| f =~ %r{\.gitignore|examples|benchmarks|memory|gems/.*|Gemfile}}
33
+ s.test_files = `git ls-files -- test/*`.split("\n")
34
+ s.extra_rdoc_files = %w{LICENSE README.md}
35
+
36
+ # testing
37
+ s.add_development_dependency 'minitest', '>= 1.7.0'
38
+
39
+ # swift drivers
40
+ s.add_development_dependency 'swift-db-sqlite3'
41
+ s.add_development_dependency 'swift-db-postgres'
42
+ s.add_development_dependency 'swift-db-mysql'
43
+
44
+ # async
45
+ s.add_development_dependency 'eventmachine'
46
+ s.add_development_dependency 'em-synchrony'
47
+
48
+ # rake
49
+ s.add_development_dependency 'rake'
50
+ s.add_development_dependency 'yard'
51
+ end
52
+
53
+ desc 'Generate gemspec'
54
+ task :gemspec do
55
+ File.open('%s.gemspec' % $gemspec.name, 'w') {|fh| fh.write($gemspec.to_ruby)}
33
56
  end
@@ -5,6 +5,7 @@ require_relative 'swift/attribute'
5
5
  require_relative 'swift/header'
6
6
  require_relative 'swift/record'
7
7
  require_relative 'swift/type'
8
+ require_relative 'swift/version'
8
9
 
9
10
  # A rational rudimentary object relational mapper.
10
11
  #
@@ -23,7 +23,7 @@ module Swift
23
23
  def initialize record, name, options = {}
24
24
  @name = name
25
25
  @default = options.fetch(:default, nil)
26
- @field = options.fetch(:field, name)
26
+ @field = options.fetch(:field, name).to_sym
27
27
  @key = options.fetch(:key, false)
28
28
  @serial = options.fetch(:serial, false)
29
29
  define_record_methods(record)
@@ -1,83 +1,55 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
1
  # -*- encoding: utf-8 -*-
2
+ # stub: swift 1.2.1 ruby lib
5
3
 
6
4
  Gem::Specification.new do |s|
7
5
  s.name = "swift"
8
- s.version = "1.2.0"
6
+ s.version = "1.2.1"
9
7
 
10
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9
+ s.require_paths = ["lib"]
11
10
  s.authors = ["Shane Hanna", "Bharanee 'Barney' Rathna"]
12
- s.date = "2013-03-10"
11
+ s.date = "2014-09-12"
13
12
  s.description = "A rational rudimentary database abstraction."
14
13
  s.email = ["shane.hanna@gmail.com", "deepfryed@gmail.com"]
15
- s.extra_rdoc_files = [
16
- "LICENSE",
17
- "README.md"
18
- ]
19
- s.files = [
20
- "API.rdoc",
21
- "LICENSE",
22
- "README.md",
23
- "Rakefile",
24
- "VERSION",
25
- "lib/swift.rb",
26
- "lib/swift/adapter.rb",
27
- "lib/swift/adapter/em/mysql.rb",
28
- "lib/swift/adapter/em/postgres.rb",
29
- "lib/swift/adapter/eventmachine.rb",
30
- "lib/swift/adapter/mysql.rb",
31
- "lib/swift/adapter/postgres.rb",
32
- "lib/swift/adapter/sql.rb",
33
- "lib/swift/adapter/sqlite3.rb",
34
- "lib/swift/adapter/synchrony.rb",
35
- "lib/swift/adapter/synchrony/mysql.rb",
36
- "lib/swift/adapter/synchrony/postgres.rb",
37
- "lib/swift/attribute.rb",
38
- "lib/swift/fiber_connection_pool.rb",
39
- "lib/swift/header.rb",
40
- "lib/swift/identity_map.rb",
41
- "lib/swift/migrations.rb",
42
- "lib/swift/record.rb",
43
- "lib/swift/result.rb",
44
- "lib/swift/statement.rb",
45
- "lib/swift/type.rb",
46
- "lib/swift/validations.rb",
47
- "swift.gemspec",
48
- "test/helper.rb",
49
- "test/house-explode.jpg",
50
- "test/minitest_teardown_hack.rb",
51
- "test/test_adapter.rb",
52
- "test/test_async.rb",
53
- "test/test_datetime_parser.rb",
54
- "test/test_encoding.rb",
55
- "test/test_error.rb",
56
- "test/test_identity_map.rb",
57
- "test/test_io.rb",
58
- "test/test_record.rb",
59
- "test/test_swift.rb",
60
- "test/test_synchrony.rb",
61
- "test/test_timestamps.rb",
62
- "test/test_transactions.rb",
63
- "test/test_types.rb",
64
- "test/test_validations.rb"
65
- ]
14
+ s.extra_rdoc_files = ["LICENSE", "README.md"]
15
+ s.files = ["API.rdoc", "LICENSE", "README.md", "Rakefile", "lib/swift.rb", "lib/swift/adapter.rb", "lib/swift/adapter/em/mysql.rb", "lib/swift/adapter/em/postgres.rb", "lib/swift/adapter/eventmachine.rb", "lib/swift/adapter/mysql.rb", "lib/swift/adapter/postgres.rb", "lib/swift/adapter/sql.rb", "lib/swift/adapter/sqlite3.rb", "lib/swift/adapter/synchrony.rb", "lib/swift/adapter/synchrony/mysql.rb", "lib/swift/adapter/synchrony/postgres.rb", "lib/swift/attribute.rb", "lib/swift/fiber_connection_pool.rb", "lib/swift/header.rb", "lib/swift/identity_map.rb", "lib/swift/migrations.rb", "lib/swift/record.rb", "lib/swift/result.rb", "lib/swift/statement.rb", "lib/swift/type.rb", "lib/swift/validations.rb", "swift.gemspec", "test/helper.rb", "test/house-explode.jpg", "test/test_adapter.rb", "test/test_async.rb", "test/test_datetime_parser.rb", "test/test_encoding.rb", "test/test_error.rb", "test/test_identity_map.rb", "test/test_io.rb", "test/test_record.rb", "test/test_swift.rb", "test/test_synchrony.rb", "test/test_timestamps.rb", "test/test_transactions.rb", "test/test_types.rb", "test/test_validations.rb"]
66
16
  s.homepage = "http://github.com/shanna/swift"
67
- s.require_paths = ["lib"]
68
- s.rubygems_version = "1.8.24"
17
+ s.licenses = ["MIT"]
18
+ s.required_ruby_version = Gem::Requirement.new(">= 1.9.2")
19
+ s.rubygems_version = "2.2.0"
69
20
  s.summary = "A rational rudimentary database abstraction."
21
+ s.test_files = ["test/helper.rb", "test/house-explode.jpg", "test/test_adapter.rb", "test/test_async.rb", "test/test_datetime_parser.rb", "test/test_encoding.rb", "test/test_error.rb", "test/test_identity_map.rb", "test/test_io.rb", "test/test_record.rb", "test/test_swift.rb", "test/test_synchrony.rb", "test/test_timestamps.rb", "test/test_transactions.rb", "test/test_types.rb", "test/test_validations.rb"]
70
22
 
71
23
  if s.respond_to? :specification_version then
72
- s.specification_version = 3
24
+ s.specification_version = 4
73
25
 
74
26
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
75
27
  s.add_development_dependency(%q<minitest>, [">= 1.7.0"])
28
+ s.add_development_dependency(%q<swift-db-sqlite3>, [">= 0"])
29
+ s.add_development_dependency(%q<swift-db-postgres>, [">= 0"])
30
+ s.add_development_dependency(%q<swift-db-mysql>, [">= 0"])
31
+ s.add_development_dependency(%q<eventmachine>, [">= 0"])
32
+ s.add_development_dependency(%q<em-synchrony>, [">= 0"])
33
+ s.add_development_dependency(%q<rake>, [">= 0"])
34
+ s.add_development_dependency(%q<yard>, [">= 0"])
76
35
  else
77
36
  s.add_dependency(%q<minitest>, [">= 1.7.0"])
37
+ s.add_dependency(%q<swift-db-sqlite3>, [">= 0"])
38
+ s.add_dependency(%q<swift-db-postgres>, [">= 0"])
39
+ s.add_dependency(%q<swift-db-mysql>, [">= 0"])
40
+ s.add_dependency(%q<eventmachine>, [">= 0"])
41
+ s.add_dependency(%q<em-synchrony>, [">= 0"])
42
+ s.add_dependency(%q<rake>, [">= 0"])
43
+ s.add_dependency(%q<yard>, [">= 0"])
78
44
  end
79
45
  else
80
46
  s.add_dependency(%q<minitest>, [">= 1.7.0"])
47
+ s.add_dependency(%q<swift-db-sqlite3>, [">= 0"])
48
+ s.add_dependency(%q<swift-db-postgres>, [">= 0"])
49
+ s.add_dependency(%q<swift-db-mysql>, [">= 0"])
50
+ s.add_dependency(%q<eventmachine>, [">= 0"])
51
+ s.add_dependency(%q<em-synchrony>, [">= 0"])
52
+ s.add_dependency(%q<rake>, [">= 0"])
53
+ s.add_dependency(%q<yard>, [">= 0"])
81
54
  end
82
55
  end
83
-
@@ -2,10 +2,9 @@ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
2
  $:.unshift(File.join(File.dirname(__FILE__), '..', 'test'))
3
3
 
4
4
  require 'bundler/setup'
5
-
6
5
  require 'etc'
7
6
  require 'minitest/autorun'
8
- require 'minitest_teardown_hack'
7
+
9
8
  require 'swift'
10
9
  require 'swift/adapter/mysql'
11
10
  require 'swift/adapter/postgres'
@@ -58,6 +58,25 @@ describe 'record' do
58
58
  end
59
59
 
60
60
  supported_by Swift::Adapter::Postgres, Swift::Adapter::Mysql, Swift::Adapter::Sqlite3 do
61
+ describe 'field name customization' do
62
+ before do
63
+ @user = Class.new(Swift::Record) do
64
+ store :users
65
+ attribute :id, Swift::Type::Integer, serial: true, key: true, field: 'field_id'
66
+ attribute :name, Swift::Type::String, field: 'field_name'
67
+ end
68
+
69
+ Swift.db.migrate! @user
70
+ end
71
+
72
+ it 'should fetch and create by fields correctly' do
73
+ @user.create(name: 'dave')
74
+ user = @user.execute("select * from #{@user} limit 1").first
75
+ assert_equal 'dave', user.name
76
+ assert_equal 1, user.id
77
+ end
78
+ end
79
+
61
80
  describe 'adapter operations' do
62
81
  before do
63
82
  Swift.db.migrate! @user
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swift
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
5
- prerelease:
4
+ version: 1.2.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Shane Hanna
@@ -10,24 +9,120 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2013-03-10 00:00:00.000000000 Z
12
+ date: 2014-09-12 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
15
+ name: minitest
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ! '>='
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: 1.7.0
21
- none: false
21
+ type: :development
22
+ prerelease: false
22
23
  version_requirements: !ruby/object:Gem::Requirement
23
24
  requirements:
24
- - - ! '>='
25
+ - - ">="
25
26
  - !ruby/object:Gem::Version
26
27
  version: 1.7.0
27
- none: false
28
- name: minitest
28
+ - !ruby/object:Gem::Dependency
29
+ name: swift-db-sqlite3
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: swift-db-postgres
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: swift-db-mysql
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: eventmachine
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: em-synchrony
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ type: :development
29
92
  prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ - !ruby/object:Gem::Dependency
99
+ name: rake
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
30
105
  type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ - !ruby/object:Gem::Dependency
113
+ name: yard
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
31
126
  description: A rational rudimentary database abstraction.
32
127
  email:
33
128
  - shane.hanna@gmail.com
@@ -42,7 +137,6 @@ files:
42
137
  - LICENSE
43
138
  - README.md
44
139
  - Rakefile
45
- - VERSION
46
140
  - lib/swift.rb
47
141
  - lib/swift/adapter.rb
48
142
  - lib/swift/adapter/em/mysql.rb
@@ -68,7 +162,6 @@ files:
68
162
  - swift.gemspec
69
163
  - test/helper.rb
70
164
  - test/house-explode.jpg
71
- - test/minitest_teardown_hack.rb
72
165
  - test/test_adapter.rb
73
166
  - test/test_async.rb
74
167
  - test/test_datetime_parser.rb
@@ -84,30 +177,44 @@ files:
84
177
  - test/test_types.rb
85
178
  - test/test_validations.rb
86
179
  homepage: http://github.com/shanna/swift
87
- licenses: []
180
+ licenses:
181
+ - MIT
182
+ metadata: {}
88
183
  post_install_message:
89
184
  rdoc_options: []
90
185
  require_paths:
91
186
  - lib
92
187
  required_ruby_version: !ruby/object:Gem::Requirement
93
188
  requirements:
94
- - - ! '>='
189
+ - - ">="
95
190
  - !ruby/object:Gem::Version
96
- hash: -4534175981099401006
97
- version: '0'
98
- segments:
99
- - 0
100
- none: false
191
+ version: 1.9.2
101
192
  required_rubygems_version: !ruby/object:Gem::Requirement
102
193
  requirements:
103
- - - ! '>='
194
+ - - ">="
104
195
  - !ruby/object:Gem::Version
105
196
  version: '0'
106
- none: false
107
197
  requirements: []
108
198
  rubyforge_project:
109
- rubygems_version: 1.8.24
199
+ rubygems_version: 2.2.0
110
200
  signing_key:
111
- specification_version: 3
201
+ specification_version: 4
112
202
  summary: A rational rudimentary database abstraction.
113
- test_files: []
203
+ test_files:
204
+ - test/helper.rb
205
+ - test/house-explode.jpg
206
+ - test/test_adapter.rb
207
+ - test/test_async.rb
208
+ - test/test_datetime_parser.rb
209
+ - test/test_encoding.rb
210
+ - test/test_error.rb
211
+ - test/test_identity_map.rb
212
+ - test/test_io.rb
213
+ - test/test_record.rb
214
+ - test/test_swift.rb
215
+ - test/test_synchrony.rb
216
+ - test/test_timestamps.rb
217
+ - test/test_transactions.rb
218
+ - test/test_types.rb
219
+ - test/test_validations.rb
220
+ has_rdoc:
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 1.2.0
@@ -1,20 +0,0 @@
1
- # TODO remove this once the patch gets applied to stock ruby 1.9
2
- class MiniTest::Spec < MiniTest::Unit::TestCase
3
-
4
- def self.define_inheritable_method name, &block # :nodoc:
5
- super_method = self.superclass.instance_method name
6
-
7
- case name
8
- when :teardown
9
- define_method(name) do
10
- instance_eval(&block)
11
- super_method.bind(self).call if super_method
12
- end
13
- else
14
- define_method(name) do
15
- super_method.bind(self).call if super_method
16
- instance_eval(&block)
17
- end
18
- end
19
- end
20
- end