crazy_db 0.0.2 → 0.0.3

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NjE4NDJjNThiYTkxOGZjOWY3ZDNiYjY5MDc3NzA5YWFhZTMyYzVhYQ==
4
+ MDY5NjE4OGEyYzQxNDVlOWZkYjRkNDNlZGQzZWI5MjhkNDQ5YjIwNw==
5
5
  data.tar.gz: !binary |-
6
- MDA1YjM3MjY4NGEzNTMxYjI2NmJkYzZkYWY4NjUzMzRkY2M4YzJlMg==
6
+ ZjRiMzA0ZjA5ZjQ0ZTJhZGNhYzJlZGFkN2Q2OTQzMjQ4NDhkYTM4OQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MTczZjQzYTJlYjAzYmM0Yjc0YzJiYTRiZGY0M2VjYTZiNTkyZmJkNDUzYjMw
10
- MDdmOWE1ZDlmOTM1MWM5M2M1MTJkNTI3NzkzZjMzNDVjZTYyYTVmM2QzYjhm
11
- MDU0Y2I0MWI5NGEzYTAxYjAzMjMyNjg5ZjdmYjA0OTQ4Nzk1NDk=
9
+ YmY4Y2M1NDk5NjQzZjkzMTRmOTljZmU0YmIyMDkyY2EzMGI4YTYxM2YzZmNi
10
+ MDI4ZDkxNWRiYjFmNGMzYWFkOGNiYTY2ZWFhYmFhOWExODM2YzhmOWFmY2Q4
11
+ ZjBhMGFhMGRkOGJmNDc2MDViZDgxOWU4NWQyOTE3NmU4YTg5N2Q=
12
12
  data.tar.gz: !binary |-
13
- NTBmN2MxYWRiNjZkMTgwZWRhNmNmZGFhYzRjZTI0MTA4N2Q2NWQ5ZjM0OTkw
14
- MzY1MjQ3YmIwMjBkYjYzNzIxYWYxMTZkZTI0N2ZhMGQ3ZDI4Yjg4NGVhZmQ2
15
- NzZjNjZkMzY1YWI3MTFiZGQ1MTIxMjZmMTMzOTI2NzdjMmMyNDc=
13
+ ZGI0YTA4NmZlN2UwYzkxZWUwYTMwMjRmY2VkMjVjMWYzM2MxODQ2OTQwOWYw
14
+ YTM5OTBhZjRmZTVmY2UyZDg3YjhhYWIyMTA5ZGYzNTA4OTJlNzM0MWI4N2U2
15
+ NTFhZDdiNWU5YmNkZmY5MzgxZmI4ZGQwZjFiZWU2YzhlYjQ4ZTE=
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # CrazyDb
2
2
 
3
- TODO: Write a gem description
3
+ Crazy db provides rails application Database Information like database name, total number of tables, table names with records count in html format.
4
4
 
5
5
  ## Installation
6
6
 
@@ -18,7 +18,7 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- TODO: Write usage instructions here
21
+ In your view file write: <%= CrazyDb::db_statistics %>
22
22
 
23
23
  ## Contributing
24
24
 
data/crazy_db.gemspec CHANGED
@@ -6,11 +6,11 @@ require 'crazy_db/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "crazy_db"
8
8
  spec.version = CrazyDb::VERSION
9
- spec.authors = ["Naveen"]
9
+ spec.authors = ["Naveen Kumar"]
10
10
  spec.email = ["hcnaveenkumar@gmail.com"]
11
11
  spec.description = "Rails database information"
12
12
  spec.summary = "Crazy DB"
13
- spec.homepage = "http://rubygems.org/gems/crazy_db/0.0.2"
13
+ spec.homepage = "http://rubygems.org/gems/crazy_db"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files`.split("\n")
@@ -18,6 +18,6 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- #spec.add_development_dependency "bundler", "~> 1.3"
22
- #spec.add_development_dependency "rake"
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
23
  end
data/lib/crazy_db.rb CHANGED
@@ -1,18 +1,20 @@
1
1
  require "crazy_db/version"
2
2
  module CrazyDb
3
- class CrazyDbOne
4
3
  # Your code goes here...
5
- def database_information
6
- puts "DATABASE NAME - #{Rails.configuration.database_configuration["development"]["database"]}"
7
- puts "TOTAL NUMBER OF TABLES - #{ActiveRecord::Base.connection.tables.count}"
8
- puts "DATABASE TABLE NAMES"
9
- ActiveRecord::Base.connection.tables.each do |table|
10
- begin
11
- puts "#{table} - #{table.classify.constantize.count} Records"
12
- rescue
13
-
14
- end
4
+ def self.db_statistics
5
+ db_instance = ActiveRecord::Base.connection.tables
6
+ html = ""
7
+ html = html + "DATABASE NAME - #{Rails.configuration.database_configuration[Rails.env]["database"]}<br /><br />"
8
+ html = html + "TOTAL NUMBER OF TABLES - #{db_instance.count}<br /><br />"
9
+ html = html + "TABLE NAMES WITH TOTAL RECORDS COUNT<br />"
10
+ count = 1
11
+ db_instance.each do |table|
12
+ begin
13
+ html = html + "#{count}. <b>#{table}:</b>&nbsp;<i>#{table.classify.constantize.count} Records</i><br />"
14
+ count+=1
15
+ rescue
15
16
  end
16
- end
17
- end
17
+ end
18
+ return html.html_safe
19
+ end
18
20
  end
@@ -1,3 +1,3 @@
1
1
  module CrazyDb
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,15 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crazy_db
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
- - Naveen
7
+ - Naveen Kumar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-15 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2013-03-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
13
41
  description: Rails database information
14
42
  email:
15
43
  - hcnaveenkumar@gmail.com
@@ -25,7 +53,7 @@ files:
25
53
  - crazy_db.gemspec
26
54
  - lib/crazy_db.rb
27
55
  - lib/crazy_db/version.rb
28
- homepage: http://rubygems.org/gems/crazy_db/0.0.2
56
+ homepage: http://rubygems.org/gems/crazy_db
29
57
  licenses:
30
58
  - MIT
31
59
  metadata: {}