active_record_mutex 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ pkg
2
+ Gemfile.lock
3
+ .*.sw[pon]
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ # vim: set filetype=ruby et sw=2 ts=2:
2
+
3
+ source :rubygems
4
+
5
+ gemspec
@@ -1,3 +1,5 @@
1
+ = ActiveRecord::Mutex
2
+
1
3
  == Description
2
4
 
3
5
  This gem provides a Mutex that is based on ctiveRecord's database connection.
data/Rakefile CHANGED
@@ -1,86 +1,20 @@
1
- begin
2
- require 'rake/gempackagetask'
3
- rescue LoadError
1
+ # vim: set filetype=ruby et sw=2 ts=2:
2
+
3
+ require 'gem_hadar'
4
+
5
+ GemHadar do
6
+ name 'active_record_mutex'
7
+ path_name 'active_record/mutex'
8
+ author 'Florian Frank'
9
+ email 'flori@ping.de'
10
+ homepage "http://github.com/flori/#{name}"
11
+ summary 'Implementation of a Mutex for Active Record'
12
+ description 'Mutex that can be used to synchronise ruby processes via an ActiveRecord'\
13
+ ' datababase connection. (Only Mysql is supported at the moment.)'
14
+ test_dir 'test'
15
+ ignore '.*.sw[pon]', 'pkg', 'Gemfile.lock'
16
+ readme 'README.rdoc'
17
+
18
+ dependency 'mysql2', '~>0.2.11'
19
+ dependency 'activerecord'
4
20
  end
5
- require 'rake/clean'
6
- require 'rbconfig'
7
- include Config
8
-
9
- PKG_NAME = 'active_record_mutex'
10
- PKG_VERSION = File.read('VERSION').chomp
11
- PKG_FILES = FileList['**/*'].exclude(/^(doc|CVS|pkg|coverage)/)
12
- PKG_SUMMARY = 'Implementation of a Mutex for Active Record'
13
- PKG_RDOC_OPTIONS = [ '--main', 'README', '--title', PKG_SUMMARY ]
14
- CLEAN.include 'coverage', 'doc'
15
-
16
- desc "Testing library"
17
- task :test do
18
- ruby %{-Ilib test/mutex_test.rb}
19
- end
20
-
21
- desc "Testing library (with coverage)"
22
- task :coverage do
23
- sh %{rcov -Ilib test/mutex_test.rb}
24
- end
25
-
26
- desc "Installing library"
27
- task :install do
28
- ruby 'install.rb'
29
- end
30
-
31
- desc "Creating documentation"
32
- task :doc do
33
- sh 'rdoc', *(PKG_RDOC_OPTIONS + Dir['lib/**/*.rb'] + [ 'README' ])
34
- end
35
-
36
- if defined? Gem
37
- spec = Gem::Specification.new do |s|
38
- s.name = PKG_NAME
39
- s.version = PKG_VERSION
40
- s.summary = PKG_SUMMARY
41
- s.description = "Mutex that can be used to synchronise ruby processes via an ActiveRecord"\
42
- " datababase connection. (Only Mysql is supported at the moment.)"
43
-
44
- s.files = PKG_FILES.to_a.sort
45
-
46
- s.require_path = 'lib'
47
-
48
- s.has_rdoc = true
49
- s.rdoc_options = PKG_RDOC_OPTIONS
50
- s.extra_rdoc_files << 'README'
51
- #s.test_files << 'test/mutex_test.rb'
52
-
53
- s.author = "Florian Frank"
54
- s.email = "flori@ping.de"
55
- s.homepage = "http://flori.github.com/#{PKG_NAME}"
56
- s.rubyforge_project = "#{PKG_NAME}"
57
- end
58
-
59
- Rake::GemPackageTask.new(spec) do |pkg|
60
- pkg.need_tar = true
61
- pkg.package_files += PKG_FILES
62
- end
63
- end
64
-
65
- desc m = "Writing version information for #{PKG_VERSION}"
66
- task :version do
67
- puts m
68
- File.open(File.join('lib', 'active_record', 'mutex', 'version.rb'), 'w') do |v|
69
- v.puts <<EOT
70
- module ActiveRecord
71
- module Mutex
72
- # ActiveRecord::Mutex version
73
- VERSION = '#{PKG_VERSION}'
74
- VERSION_ARRAY = VERSION.split(/\\./).map { |x| x.to_i } # :nodoc:
75
- VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
76
- VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
77
- VERSION_BUILD = VERSION_ARRAY[2] # :nodoc:
78
- end
79
- end
80
- EOT
81
- end
82
- end
83
-
84
- task :default => [ :version, :test ]
85
-
86
- task :release => [ :clean, :version, :package ]
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.0
1
+ 0.0.1
@@ -0,0 +1,38 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{active_record_mutex}
5
+ s.version = "0.0.1"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Florian Frank"]
9
+ s.date = %q{2011-07-18}
10
+ s.description = %q{Mutex that can be used to synchronise ruby processes via an ActiveRecord datababase connection. (Only Mysql is supported at the moment.)}
11
+ s.email = %q{flori@ping.de}
12
+ s.extra_rdoc_files = ["README.rdoc", "lib/active_record/mutex/version.rb", "lib/active_record/mutex.rb", "lib/active_record_mutex.rb"]
13
+ s.files = [".gitignore", "CHANGES", "Gemfile", "README.rdoc", "Rakefile", "VERSION", "active_record_mutex.gemspec", "lib/active_record/mutex.rb", "lib/active_record/mutex/version.rb", "lib/active_record_mutex.rb", "test/mutex_test.rb"]
14
+ s.homepage = %q{http://github.com/flori/active_record_mutex}
15
+ s.rdoc_options = ["--title", "ActiveRecordMutex - Implementation of a Mutex for Active Record", "--main", "README.rdoc"]
16
+ s.require_paths = ["lib"]
17
+ s.rubygems_version = %q{1.7.2}
18
+ s.summary = %q{Implementation of a Mutex for Active Record}
19
+ s.test_files = ["test/mutex_test.rb"]
20
+
21
+ if s.respond_to? :specification_version then
22
+ s.specification_version = 3
23
+
24
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
25
+ s.add_development_dependency(%q<gem_hadar>, ["~> 0.0.6"])
26
+ s.add_runtime_dependency(%q<mysql2>, ["~> 0.2.11"])
27
+ s.add_runtime_dependency(%q<activerecord>, [">= 0"])
28
+ else
29
+ s.add_dependency(%q<gem_hadar>, ["~> 0.0.6"])
30
+ s.add_dependency(%q<mysql2>, ["~> 0.2.11"])
31
+ s.add_dependency(%q<activerecord>, [">= 0"])
32
+ end
33
+ else
34
+ s.add_dependency(%q<gem_hadar>, ["~> 0.0.6"])
35
+ s.add_dependency(%q<mysql2>, ["~> 0.2.11"])
36
+ s.add_dependency(%q<activerecord>, [">= 0"])
37
+ end
38
+ end
@@ -1,10 +1,8 @@
1
- module ActiveRecord
2
- module Mutex
3
- # ActiveRecord::Mutex version
4
- VERSION = '0.0.0'
5
- VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc:
6
- VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
7
- VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
8
- VERSION_BUILD = VERSION_ARRAY[2] # :nodoc:
9
- end
1
+ module ActiveRecord::Mutex
2
+ # ActiveRecord::Mutex version
3
+ VERSION = '0.0.1'
4
+ VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc:
5
+ VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
+ VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
7
+ VERSION_BUILD = VERSION_ARRAY[2] # :nodoc:
10
8
  end
@@ -132,7 +132,7 @@ module ActiveRecord
132
132
 
133
133
  def query(sql)
134
134
  if result = ActiveRecord::Base.connection.execute(sql)
135
- result = result.fetch_row.first.to_i
135
+ result = result.first.first.to_i
136
136
  $DEBUG and warn %{query("#{sql}") = #{result}}
137
137
  end
138
138
  result
data/test/mutex_test.rb CHANGED
@@ -6,7 +6,7 @@ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
6
6
  require 'active_record/mutex'
7
7
 
8
8
  ActiveRecord::Base.establish_connection(
9
- :adapter => "mysql",
9
+ :adapter => "mysql2",
10
10
  :database => ENV['DATABASE'] || "test",
11
11
  :username => ENV['USER'],
12
12
  :password => ENV['PASSWORD']
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record_mutex
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 0
10
- version: 0.0.0
9
+ - 1
10
+ version: 0.0.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Florian Frank
@@ -15,10 +15,54 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-01 00:00:00 +02:00
19
- default_executable:
20
- dependencies: []
21
-
18
+ date: 2011-07-18 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: gem_hadar
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ hash: 19
29
+ segments:
30
+ - 0
31
+ - 0
32
+ - 6
33
+ version: 0.0.6
34
+ type: :development
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: mysql2
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ hash: 1
45
+ segments:
46
+ - 0
47
+ - 2
48
+ - 11
49
+ version: 0.2.11
50
+ type: :runtime
51
+ version_requirements: *id002
52
+ - !ruby/object:Gem::Dependency
53
+ name: activerecord
54
+ prerelease: false
55
+ requirement: &id003 !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ hash: 3
61
+ segments:
62
+ - 0
63
+ version: "0"
64
+ type: :runtime
65
+ version_requirements: *id003
22
66
  description: Mutex that can be used to synchronise ruby processes via an ActiveRecord datababase connection. (Only Mysql is supported at the moment.)
23
67
  email: flori@ping.de
24
68
  executables: []
@@ -26,26 +70,31 @@ executables: []
26
70
  extensions: []
27
71
 
28
72
  extra_rdoc_files:
29
- - README
73
+ - README.rdoc
74
+ - lib/active_record/mutex/version.rb
75
+ - lib/active_record/mutex.rb
76
+ - lib/active_record_mutex.rb
30
77
  files:
78
+ - .gitignore
31
79
  - CHANGES
32
- - README
80
+ - Gemfile
81
+ - README.rdoc
33
82
  - Rakefile
34
83
  - VERSION
84
+ - active_record_mutex.gemspec
35
85
  - lib/active_record/mutex.rb
36
86
  - lib/active_record/mutex/version.rb
37
87
  - lib/active_record_mutex.rb
38
88
  - test/mutex_test.rb
39
- has_rdoc: true
40
- homepage: http://flori.github.com/active_record_mutex
89
+ homepage: http://github.com/flori/active_record_mutex
41
90
  licenses: []
42
91
 
43
92
  post_install_message:
44
93
  rdoc_options:
45
- - --main
46
- - README
47
94
  - --title
48
- - Implementation of a Mutex for Active Record
95
+ - ActiveRecordMutex - Implementation of a Mutex for Active Record
96
+ - --main
97
+ - README.rdoc
49
98
  require_paths:
50
99
  - lib
51
100
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -68,10 +117,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
68
117
  version: "0"
69
118
  requirements: []
70
119
 
71
- rubyforge_project: active_record_mutex
72
- rubygems_version: 1.6.2
120
+ rubyforge_project:
121
+ rubygems_version: 1.7.2
73
122
  signing_key:
74
123
  specification_version: 3
75
124
  summary: Implementation of a Mutex for Active Record
76
- test_files: []
77
-
125
+ test_files:
126
+ - test/mutex_test.rb