rails_db_sql 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 @@
1
+ .idea
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rails_db_sql.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,14 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rails_db_sql (0.0.1)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+
10
+ PLATFORMS
11
+ ruby
12
+
13
+ DEPENDENCIES
14
+ rails_db_sql!
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Tomasz Bak
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,17 @@
1
+ # RailsDbSql
2
+
3
+ Rake hooks that execute db/sql/*.sql after db:migrate / db:rollback / db:schema:load
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'rails_db_sql'
10
+
11
+ ## Contributing
12
+
13
+ 1. Fork it
14
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
15
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
16
+ 4. Push to the branch (`git push origin my-new-feature`)
17
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,12 @@
1
+ require "rails_db_sql"
2
+ require "rails"
3
+
4
+ module RailsDbSql
5
+ class Railtie < Rails::Railtie
6
+ railtie_name :rails_db_sql
7
+
8
+ rake_tasks do
9
+ load "tasks/rails_hooks.rake"
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,3 @@
1
+ module RailsDbSql
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,21 @@
1
+ require "rails_db_sql/version"
2
+
3
+ module RailsDbSql
4
+
5
+ require "rails_db_sql/railtie" if defined?(Rails::Railtie)
6
+
7
+ def self.reload(pattern="db/sql/**/*.sql")
8
+ Dir.glob(pattern).sort.each do |path|
9
+ File.open path, "r" do |file|
10
+ execute_sql file.read
11
+ end
12
+ end
13
+ end
14
+
15
+ private
16
+
17
+ def self.execute_sql(sql)
18
+ ActiveRecord::Base.connection.execute sql
19
+ end
20
+
21
+ end
@@ -0,0 +1,5 @@
1
+ %w[db:migrate db:rollback db:schema:load].each do |task_name|
2
+ task task_name => %w[environment db:load_config] do
3
+ RailsDbSql.reload
4
+ end
5
+ end
@@ -0,0 +1,17 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/rails_db_sql/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Tomasz Bak"]
6
+ gem.email = ["t.bak@selleo.com"]
7
+ gem.description = %q{Rake hooks that execute db/sql/*.sql after db:migrate / db:rollback / db:schema:load}
8
+ gem.summary = %q{Rake hooks that execute db/sql/*.sql after db:migrate / db:rollback / db:schema:load}
9
+ gem.homepage = "https://github.com/tb/rails_db_sql"
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "rails_db_sql"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = RailsDbSql::VERSION
17
+ end
metadata ADDED
@@ -0,0 +1,78 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rails_db_sql
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Tomasz Bak
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2013-12-05 00:00:00 +01:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: Rake hooks that execute db/sql/*.sql after db:migrate / db:rollback / db:schema:load
23
+ email:
24
+ - t.bak@selleo.com
25
+ executables: []
26
+
27
+ extensions: []
28
+
29
+ extra_rdoc_files: []
30
+
31
+ files:
32
+ - .gitignore
33
+ - Gemfile
34
+ - Gemfile.lock
35
+ - LICENSE
36
+ - README.md
37
+ - Rakefile
38
+ - lib/rails_db_sql.rb
39
+ - lib/rails_db_sql/railtie.rb
40
+ - lib/rails_db_sql/version.rb
41
+ - lib/tasks/rails_hooks.rake
42
+ - rails_db_sql.gemspec
43
+ has_rdoc: true
44
+ homepage: https://github.com/tb/rails_db_sql
45
+ licenses: []
46
+
47
+ post_install_message:
48
+ rdoc_options: []
49
+
50
+ require_paths:
51
+ - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ hash: 3
58
+ segments:
59
+ - 0
60
+ version: "0"
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ hash: 3
67
+ segments:
68
+ - 0
69
+ version: "0"
70
+ requirements: []
71
+
72
+ rubyforge_project:
73
+ rubygems_version: 1.4.2
74
+ signing_key:
75
+ specification_version: 3
76
+ summary: Rake hooks that execute db/sql/*.sql after db:migrate / db:rollback / db:schema:load
77
+ test_files: []
78
+