database-cloner-rails 1.0

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,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 48e4157dc6cd626d83c49a27e466374687a84bb4
4
+ data.tar.gz: cc620f2d4f47c2b63dc5f0aa4cbce8cdac5ba241
5
+ SHA512:
6
+ metadata.gz: e6d70d18a11d291db4d2620657878b335b62b206b69748320e6c321ec3005f5bca6d7fab7a916455f60e8caedd79378178968614acde8acbe8c46e191edd7acc
7
+ data.tar.gz: f02744591659bcacb361af1e9c3ac6ba06e4154f99c03c226f007d4231135ba18e2022417409cf43832101ae87297dcec1c77eb0f3562df60ec4fbac2fe2b78f
@@ -0,0 +1,9 @@
1
+ require 'database-cloner-rails'
2
+ require 'rails'
3
+ module DatabaseClonerRails
4
+ class Railtie < Rails::Railtie
5
+ rake_tasks do
6
+ require 'lib/tasks/database.rake'
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,13 @@
1
+ namespace :database do
2
+ desc "TODO"
3
+ task upload: :environment do
4
+ system("echo 'upload'")
5
+ require "tasks/database_cloner/upload.rb"
6
+ end
7
+
8
+ desc "TODO"
9
+ task download: :environment do
10
+ require "tasks/database_cloner/download.rb"
11
+ end
12
+
13
+ end
@@ -0,0 +1,27 @@
1
+ #ActiveRecord::Base.connection.tables.map{|x|x.classify.safe_constantize}.compact
2
+ ActiveRecord::Base.connection.tables.map do |i|
3
+ if i.classify.safe_constantize.present?
4
+ model_obj = i.classify.safe_constantize
5
+ all_records = model_obj.all.order(:id)
6
+ file_path = "#{Rails.root}/lib/tasks/database_cloner/db_dump/#{i}.rb"
7
+ data = []
8
+ all_records.each do |task|
9
+ puts task
10
+ hash = JSON.parse(task.to_json).to_hash
11
+ hash.delete("created_at")
12
+ hash.delete("updated_at")
13
+ hash.delete("id")
14
+ temp = "#{model_obj.to_s}.create(#{hash})"
15
+ puts temp
16
+ data.push(temp)
17
+ data.push('puts "uploading ...."')
18
+ data.push("puts ' ***===========>#{i}=====*** '")
19
+ end
20
+ File.new(file_path,'w+')
21
+ File.open(file_path, 'w') do |f2|
22
+ f2.puts data
23
+ end
24
+ end
25
+ end
26
+
27
+
@@ -0,0 +1,10 @@
1
+ ActiveRecord::Base.connection.tables.map do |i|
2
+ begin
3
+ if i.classify.safe_constantize.present?
4
+ require "tasks/database_cloner/db_dump/#{i}.rb"
5
+ end
6
+
7
+ rescue
8
+ puts "Oops!! #{i} could not be uploaded."
9
+ end
10
+ end
metadata ADDED
@@ -0,0 +1,48 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: database-cloner-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: '1.0'
5
+ platform: ruby
6
+ authors:
7
+ - Abhishek Sharma
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-24 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: To create the database backup and restore.
14
+ email: abhishek.sharma@medma.in
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/railtie.rb
20
+ - lib/tasks/database.rake
21
+ - lib/tasks/database_cloner/download.rb
22
+ - lib/tasks/database_cloner/upload.rb
23
+ homepage: https://rubygems.org/gems/google-map-weather-intregration
24
+ licenses:
25
+ - NONE
26
+ metadata: {}
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - '>='
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubyforge_project:
43
+ rubygems_version: 2.3.0
44
+ signing_key:
45
+ specification_version: 4
46
+ summary: Hello! This is library to create backup of database as rails requires.
47
+ test_files: []
48
+ has_rdoc: