gindex 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1e5e3c7f927af0b2abe38d61bdf3abe5c7526ff2
4
+ data.tar.gz: 1e0b6db1bc60dbda792afa9e1d7a516739ce7877
5
+ SHA512:
6
+ metadata.gz: 5535a7424fec50d7ff8681cc3ad42142e9f0c617855db74b8c17be0e5c157a5b30dc9444da358fbe1b80ac634fc7e38268f771a5e268899e1f1bbd9d71dc59ea
7
+ data.tar.gz: a8e14458ec54b365a9e203fb0e89e9c4813761f93cc257a46309fac849da8baab33e7af4e6865c76e1edbfe4162ee00e99de17d93b95a5706ae352d3f9a4f9a5
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in gindex.gemspec
4
+ gemspec
@@ -0,0 +1,40 @@
1
+ # Gindex
2
+
3
+ :dash: Instant **concurrent indexes** for Rails
4
+
5
+ ```ruby
6
+ rails g index users email
7
+ ```
8
+
9
+ Also works with multi-column indexes
10
+
11
+ ```ruby
12
+ rails g index deliveries store_id delivered_at
13
+ ```
14
+
15
+ ## Installation
16
+
17
+ Add this line to your application’s Gemfile:
18
+
19
+ ```ruby
20
+ gem 'gindex'
21
+ ```
22
+
23
+ And then execute:
24
+
25
+ ```sh
26
+ bundle
27
+ ```
28
+
29
+ ## TODO
30
+
31
+ - add `:name` option to long index names
32
+
33
+ ## Contributing
34
+
35
+ Everyone is encouraged to help improve this project. Here are a few ways you can help:
36
+
37
+ - [Report bugs](https://github.com/ankane/gindex/issues)
38
+ - Fix bugs and [submit pull requests](https://github.com/ankane/gindex/pulls)
39
+ - Write, clarify, or fix documentation
40
+ - Suggest or add new features
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "gindex/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "gindex"
8
+ spec.version = Gindex::VERSION
9
+ spec.authors = ["Andrew Kane"]
10
+ spec.email = ["andrew@chartkick.com"]
11
+
12
+ spec.summary = "Instant concurrent indexes for Rails"
13
+ spec.homepage = "https://github.com/ankane/gindex"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
16
+ spec.bindir = "exe"
17
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_dependency "rails"
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.9"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ end
@@ -0,0 +1,26 @@
1
+ # taken from https://github.com/collectiveidea/audited/blob/master/lib/generators/audited/install_generator.rb
2
+ require "rails/generators"
3
+ require "rails/generators/migration"
4
+ require "active_record"
5
+ require "rails/generators/active_record"
6
+
7
+ class IndexGenerator < Rails::Generators::Base
8
+ include Rails::Generators::Migration
9
+ source_root File.expand_path("../templates", __FILE__)
10
+ argument :table, type: :string
11
+ argument :columns, type: :array
12
+
13
+ # Implement the required interface for Rails::Generators::Migration.
14
+ def self.next_migration_number(dirname) #:nodoc:
15
+ next_migration_number = current_migration_number(dirname) + 1
16
+ if ::ActiveRecord::Base.timestamped_migrations
17
+ [Time.now.utc.strftime("%Y%m%d%H%M%S"), "%.14d" % next_migration_number].max
18
+ else
19
+ "%.3d" % next_migration_number
20
+ end
21
+ end
22
+
23
+ def copy_migration
24
+ migration_template "index_migration.rb", "db/migrate/add_index_on_#{columns.join('_and_')}_to_#{table}.rb"
25
+ end
26
+ end
@@ -0,0 +1,7 @@
1
+ class <%= migration_class_name %> < ActiveRecord::Migration
2
+ disable_ddl_transaction!
3
+
4
+ def change
5
+ add_index <%= table.to_sym.inspect %>, <%= columns.map(&:to_sym).inspect %>, algorithm: :concurrently
6
+ end
7
+ end
@@ -0,0 +1 @@
1
+ require "gindex/version"
@@ -0,0 +1,3 @@
1
+ module Gindex
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gindex
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Andrew Kane
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-07-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.9'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.9'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ description:
56
+ email:
57
+ - andrew@chartkick.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - README.md
65
+ - Rakefile
66
+ - gindex.gemspec
67
+ - lib/generators/index_generator.rb
68
+ - lib/generators/templates/index_migration.rb
69
+ - lib/gindex.rb
70
+ - lib/gindex/version.rb
71
+ homepage: https://github.com/ankane/gindex
72
+ licenses: []
73
+ metadata: {}
74
+ post_install_message:
75
+ rdoc_options: []
76
+ require_paths:
77
+ - lib
78
+ required_ruby_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ requirements: []
89
+ rubyforge_project:
90
+ rubygems_version: 2.4.5
91
+ signing_key:
92
+ specification_version: 4
93
+ summary: Instant concurrent indexes for Rails
94
+ test_files: []
95
+ has_rdoc: