dbuddy 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/LICENSE +19 -0
  2. data/bin/dbuddy +4 -5
  3. data/lib/dbuddy.rb +14 -0
  4. data/lib/dbuddy/version.rb +1 -1
  5. metadata +6 -17
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (C) 2011 Andrew O'Brien
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/bin/dbuddy CHANGED
@@ -4,6 +4,10 @@ require 'optparse'
4
4
  require 'rubygems'
5
5
  require 'watchr'
6
6
 
7
+ # Assumes it's in a Rails environment. Eventually I could see adding some kind of config file or initializer that
8
+ # allows use with any project, but I don't need that right now.
9
+ require File.join(Dir.pwd, 'config/environment')
10
+
7
11
  $:.unshift(File.join(File.dirname(__FILE__), "/../lib"))
8
12
  require "dbuddy"
9
13
 
@@ -13,11 +17,6 @@ opts = OptionParser.new
13
17
  opts.on("-w", "--watch") { @watch = true }
14
18
  @globs = opts.parse(ARGV)
15
19
 
16
- # Assumes it's in a Rails environment. Eventually I could see adding some kind of config file or initializer that
17
- # allows use with any project, but I don't need that right now.
18
- require File.join(Dir.pwd, 'config/environment')
19
-
20
-
21
20
  if @watch
22
21
  script = Watchr::Script.new
23
22
 
@@ -1,9 +1,23 @@
1
+ begin
2
+ require 'active_record'
3
+ class ActiveRecord::ConnectionAdapters::MysqlAdapter
4
+ def allow_multi_statements!
5
+ @connection.set_server_option(Mysql::OPTION_MULTI_STATEMENTS_ON)
6
+ end
7
+ end
8
+ rescue LoadError
9
+ end
10
+
1
11
  module DBuddy
2
12
  def self.run(connection, *paths)
13
+ connection.reconnect!
14
+ ActiveRecord::Base.connection.allow_multi_statements!
15
+
3
16
  paths.each do |path|
4
17
  puts "Processing #{path}"
5
18
  begin
6
19
  connection.execute(File.read(path), "DBuddy: Reloading #{path}")
20
+ puts "Done"
7
21
  rescue => e
8
22
  puts "Caught error"
9
23
  puts e.message
@@ -1,3 +1,3 @@
1
1
  module DBuddy
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dbuddy
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
5
4
  prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 0
10
- version: 0.1.0
5
+ version: 0.2.0
11
6
  platform: ruby
12
7
  authors:
13
8
  - Andrew O'Brien
@@ -15,7 +10,8 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2011-06-16 00:00:00 Z
13
+ date: 2011-06-20 00:00:00 -04:00
14
+ default_executable:
19
15
  dependencies:
20
16
  - !ruby/object:Gem::Dependency
21
17
  name: watchr
@@ -25,9 +21,6 @@ dependencies:
25
21
  requirements:
26
22
  - - ">="
27
23
  - !ruby/object:Gem::Version
28
- hash: 3
29
- segments:
30
- - 0
31
24
  version: "0"
32
25
  type: :runtime
33
26
  version_requirements: *id001
@@ -43,12 +36,14 @@ extra_rdoc_files: []
43
36
  files:
44
37
  - .gitignore
45
38
  - Gemfile
39
+ - LICENSE
46
40
  - README.textile
47
41
  - Rakefile
48
42
  - bin/dbuddy
49
43
  - dbuddy.gemspec
50
44
  - lib/dbuddy.rb
51
45
  - lib/dbuddy/version.rb
46
+ has_rdoc: true
52
47
  homepage: http://github.com/AndrewO/dbuddy
53
48
  licenses: []
54
49
 
@@ -62,23 +57,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
62
57
  requirements:
63
58
  - - ">="
64
59
  - !ruby/object:Gem::Version
65
- hash: 3
66
- segments:
67
- - 0
68
60
  version: "0"
69
61
  required_rubygems_version: !ruby/object:Gem::Requirement
70
62
  none: false
71
63
  requirements:
72
64
  - - ">="
73
65
  - !ruby/object:Gem::Version
74
- hash: 3
75
- segments:
76
- - 0
77
66
  version: "0"
78
67
  requirements: []
79
68
 
80
69
  rubyforge_project:
81
- rubygems_version: 1.8.5
70
+ rubygems_version: 1.5.0
82
71
  signing_key:
83
72
  specification_version: 3
84
73
  summary: Got stored procedures and views in your repo? Loading them should be simple.