ardb 0.26.0 → 0.27.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.
Files changed (43) hide show
  1. data/ardb.gemspec +1 -0
  2. data/bin/ardb +1 -1
  3. data/lib/ardb.rb +1 -1
  4. data/lib/ardb/adapter/base.rb +73 -66
  5. data/lib/ardb/adapter/sqlite.rb +1 -1
  6. data/lib/ardb/adapter_spy.rb +18 -5
  7. data/lib/ardb/cli.rb +239 -76
  8. data/lib/ardb/clirb.rb +58 -0
  9. data/lib/ardb/default_order_by.rb +59 -0
  10. data/lib/ardb/has_slug.rb +7 -6
  11. data/lib/ardb/migration.rb +42 -0
  12. data/lib/ardb/migration_helpers.rb +56 -53
  13. data/lib/ardb/record_spy.rb +5 -5
  14. data/lib/ardb/relation_spy.rb +13 -2
  15. data/lib/ardb/root_path.rb +7 -4
  16. data/lib/ardb/test_helpers.rb +56 -42
  17. data/lib/ardb/use_db_default.rb +8 -7
  18. data/lib/ardb/version.rb +1 -1
  19. data/test/support/factory.rb +5 -0
  20. data/test/unit/adapter/base_tests.rb +22 -5
  21. data/test/unit/adapter/mysql_tests.rb +1 -1
  22. data/test/unit/adapter/sqlite_tests.rb +2 -2
  23. data/test/unit/adapter_spy_tests.rb +19 -6
  24. data/test/unit/cli_tests.rb +610 -0
  25. data/test/unit/default_order_by_tests.rb +122 -0
  26. data/test/unit/has_slug_tests.rb +5 -0
  27. data/test/unit/migration_tests.rb +88 -0
  28. data/test/unit/record_spy_tests.rb +6 -0
  29. data/test/unit/test_helpers_tests.rb +26 -3
  30. data/test/unit/use_db_default_tests.rb +5 -0
  31. metadata +31 -25
  32. data/lib/ardb/runner.rb +0 -50
  33. data/lib/ardb/runner/connect_command.rb +0 -20
  34. data/lib/ardb/runner/create_command.rb +0 -25
  35. data/lib/ardb/runner/drop_command.rb +0 -25
  36. data/lib/ardb/runner/generate_command.rb +0 -64
  37. data/lib/ardb/runner/migrate_command.rb +0 -28
  38. data/test/unit/runner/connect_command_tests.rb +0 -17
  39. data/test/unit/runner/create_command_tests.rb +0 -67
  40. data/test/unit/runner/drop_command_tests.rb +0 -68
  41. data/test/unit/runner/generate_command_tests.rb +0 -46
  42. data/test/unit/runner/migrate_command_tests.rb +0 -96
  43. data/test/unit/runner_tests.rb +0 -69
@@ -22,6 +22,7 @@ Gem::Specification.new do |gem|
22
22
 
23
23
  gem.add_dependency('activerecord', ["~> 3.2"])
24
24
  gem.add_dependency('activesupport', ["~> 3.2"])
25
+ gem.add_dependency('much-plugin', ["~> 0.1"])
25
26
  gem.add_dependency('ns-options', ["~> 1.1"])
26
27
  gem.add_dependency('scmd', ["~> 3.0"])
27
28
 
data/bin/ardb CHANGED
@@ -4,4 +4,4 @@
4
4
  #
5
5
 
6
6
  require 'ardb/cli'
7
- Ardb::CLI.run *ARGV
7
+ Ardb::CLI.run ARGV
@@ -22,7 +22,7 @@ module Ardb
22
22
  end
23
23
  end
24
24
 
25
- def self.init(establish_connection=true)
25
+ def self.init(establish_connection = true)
26
26
  require self.config.db_file
27
27
  validate!
28
28
  Adapter.init
@@ -1,86 +1,93 @@
1
1
  module Ardb; end
2
- class Ardb::Adapter; end
3
- class Ardb::Adapter::Base
4
-
5
- attr_reader :config_settings, :database
6
- attr_reader :schema_format, :ruby_schema_path, :sql_schema_path
7
-
8
- def initialize
9
- @config_settings = Ardb.config.db_settings
10
- @database = Ardb.config.db.database
11
- @schema_format = Ardb.config.schema_format
12
- schema_path = Ardb.config.schema_path
13
- @ruby_schema_path = "#{schema_path}.rb"
14
- @sql_schema_path = "#{schema_path}.sql"
15
- end
2
+ class Ardb::Adapter
16
3
 
17
- def foreign_key_add_sql(*args); raise NotImplementedError; end
18
- def foreign_key_drop_sql(*args); raise NotImplementedError; end
4
+ class Base
19
5
 
20
- def create_db(*args); raise NotImplementedError; end
21
- def drop_db(*args); raise NotImplementedError; end
6
+ attr_reader :config_settings, :database
7
+ attr_reader :schema_format, :ruby_schema_path, :sql_schema_path
22
8
 
23
- def migrate_db
24
- verbose = ENV["MIGRATE_QUIET"].nil?
25
- version = ENV["MIGRATE_VERSION"] ? ENV["MIGRATE_VERSION"].to_i : nil
26
- migrations_path = Ardb.config.migrations_path
9
+ def initialize
10
+ @config_settings = Ardb.config.db_settings
11
+ @database = Ardb.config.db.database
12
+ @schema_format = Ardb.config.schema_format
13
+ schema_path = Ardb.config.schema_path
14
+ @ruby_schema_path = "#{schema_path}.rb"
15
+ @sql_schema_path = "#{schema_path}.sql"
16
+ end
27
17
 
28
- if defined?(ActiveRecord::Migration::CommandRecorder)
29
- require 'ardb/migration_helpers'
30
- ActiveRecord::Migration::CommandRecorder.class_eval do
31
- include Ardb::MigrationHelpers::RecorderMixin
32
- end
18
+ def foreign_key_add_sql(*args); raise NotImplementedError; end
19
+ def foreign_key_drop_sql(*args); raise NotImplementedError; end
20
+
21
+ def create_db(*args); raise NotImplementedError; end
22
+ def drop_db(*args); raise NotImplementedError; end
23
+
24
+ def connect_db
25
+ ActiveRecord::Base.connection
33
26
  end
34
27
 
35
- ActiveRecord::Migrator.migrations_path = migrations_path
36
- ActiveRecord::Migration.verbose = verbose
37
- ActiveRecord::Migrator.migrate(migrations_path, version) do |migration|
38
- ENV["MIGRATE_SCOPE"].blank? || (ENV["MIGRATE_SCOPE"] == migration.scope)
28
+ def migrate_db
29
+ verbose = ENV["MIGRATE_QUIET"].nil?
30
+ version = ENV["MIGRATE_VERSION"] ? ENV["MIGRATE_VERSION"].to_i : nil
31
+ migrations_path = Ardb.config.migrations_path
32
+
33
+ if defined?(ActiveRecord::Migration::CommandRecorder)
34
+ require 'ardb/migration_helpers'
35
+ ActiveRecord::Migration::CommandRecorder.class_eval do
36
+ include Ardb::MigrationHelpers::RecorderMixin
37
+ end
38
+ end
39
+
40
+ ActiveRecord::Migrator.migrations_path = migrations_path
41
+ ActiveRecord::Migration.verbose = verbose
42
+ ActiveRecord::Migrator.migrate(migrations_path, version) do |migration|
43
+ ENV["MIGRATE_SCOPE"].blank? || (ENV["MIGRATE_SCOPE"] == migration.scope)
44
+ end
39
45
  end
40
- end
41
46
 
42
- def drop_tables(*args); raise NotImplementedError; end
47
+ def drop_tables(*args); raise NotImplementedError; end
43
48
 
44
- def load_schema
45
- # silence STDOUT
46
- current_stdout = $stdout.dup
47
- $stdout = File.new('/dev/null', 'w')
48
- load_ruby_schema if @schema_format == :ruby
49
- load_sql_schema if @schema_format == :sql
50
- $stdout = current_stdout
51
- end
49
+ def load_schema
50
+ # silence STDOUT
51
+ current_stdout = $stdout.dup
52
+ $stdout = File.new('/dev/null', 'w')
53
+ load_ruby_schema if @schema_format == :ruby
54
+ load_sql_schema if @schema_format == :sql
55
+ $stdout = current_stdout
56
+ end
52
57
 
53
- def load_ruby_schema
54
- load @ruby_schema_path
55
- end
58
+ def load_ruby_schema
59
+ load @ruby_schema_path
60
+ end
56
61
 
57
- def load_sql_schema
58
- raise NotImplementedError
59
- end
62
+ def load_sql_schema
63
+ raise NotImplementedError
64
+ end
60
65
 
61
- def dump_schema
62
- # silence STDOUT
63
- current_stdout = $stdout.dup
64
- $stdout = File.new('/dev/null', 'w')
65
- dump_ruby_schema
66
- dump_sql_schema if @schema_format == :sql
67
- $stdout = current_stdout
68
- end
66
+ def dump_schema
67
+ # silence STDOUT
68
+ current_stdout = $stdout.dup
69
+ $stdout = File.new('/dev/null', 'w')
70
+ dump_ruby_schema
71
+ dump_sql_schema if @schema_format == :sql
72
+ $stdout = current_stdout
73
+ end
69
74
 
70
- def dump_ruby_schema
71
- require 'active_record/schema_dumper'
72
- FileUtils.mkdir_p File.dirname(@ruby_schema_path)
73
- File.open(@ruby_schema_path, 'w:utf-8') do |file|
74
- ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, file)
75
+ def dump_ruby_schema
76
+ require 'active_record/schema_dumper'
77
+ FileUtils.mkdir_p File.dirname(@ruby_schema_path)
78
+ File.open(@ruby_schema_path, 'w:utf-8') do |file|
79
+ ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, file)
80
+ end
75
81
  end
76
- end
77
82
 
78
- def dump_sql_schema
79
- raise NotImplementedError
80
- end
83
+ def dump_sql_schema
84
+ raise NotImplementedError
85
+ end
86
+
87
+ def ==(other_adapter)
88
+ self.class == other_adapter.class
89
+ end
81
90
 
82
- def ==(other_adapter)
83
- self.class == other_adapter.class
84
91
  end
85
92
 
86
93
  end
@@ -17,7 +17,7 @@ class Ardb::Adapter
17
17
 
18
18
  def validate!
19
19
  if File.exist?(self.db_file_path)
20
- raise Ardb::Runner::CmdError, "#{self.database} already exists"
20
+ raise RuntimeError, "`#{self.database}` already exists"
21
21
  end
22
22
  end
23
23
 
@@ -1,6 +1,9 @@
1
+ require 'much-plugin'
2
+
1
3
  module Ardb
2
4
 
3
5
  module AdapterSpy
6
+ include MuchPlugin
4
7
 
5
8
  def self.new(&block)
6
9
  block ||= proc{ }
@@ -9,10 +12,8 @@ module Ardb
9
12
  record_spy
10
13
  end
11
14
 
12
- def self.included(klass)
13
- klass.class_eval do
14
- include InstanceMethods
15
- end
15
+ plugin_included do
16
+ include InstanceMethods
16
17
  end
17
18
 
18
19
  module InstanceMethods
@@ -20,7 +21,7 @@ module Ardb
20
21
  attr_accessor :drop_tables_called_count
21
22
  attr_accessor :dump_schema_called_count, :load_schema_called_count
22
23
  attr_accessor :drop_db_called_count, :create_db_called_count
23
- attr_accessor :migrate_db_called_count
24
+ attr_accessor :connect_db_called_count, :migrate_db_called_count
24
25
 
25
26
  def drop_tables_called_count
26
27
  @drop_tables_called_count ||= 0
@@ -82,6 +83,18 @@ module Ardb
82
83
  self.create_db_called_count += 1
83
84
  end
84
85
 
86
+ def connect_db_called_count
87
+ @connect_db_called_count ||= 0
88
+ end
89
+
90
+ def connect_db_called?
91
+ self.connect_db_called_count > 0
92
+ end
93
+
94
+ def connect_db(*args, &block)
95
+ self.connect_db_called_count += 1
96
+ end
97
+
85
98
  def migrate_db_called_count
86
99
  @migrate_db_called_count ||= 0
87
100
  end
@@ -1,109 +1,272 @@
1
- require 'ardb/version'
2
- require 'ardb/runner'
1
+ require 'ardb'
2
+ require 'ardb/clirb'
3
3
 
4
4
  module Ardb
5
5
 
6
6
  class CLI
7
7
 
8
- def self.run(*args)
9
- self.new.run(*args)
8
+ class InvalidCommand; end
9
+ class ConnectCommand; end
10
+ class CreateCommand; end
11
+ class DropCommand; end
12
+ class MigrateCommand; end
13
+ class GenerateMigrationCommand; end
14
+ COMMANDS = Hash.new{ |h, k| InvalidCommand.new(k) }.tap do |h|
15
+ h['connect'] = ConnectCommand
16
+ h['create'] = CreateCommand
17
+ h['drop'] = DropCommand
18
+ h['migrate'] = MigrateCommand
19
+ h['generate-migration'] = GenerateMigrationCommand
10
20
  end
11
21
 
12
- def initialize
13
- @cli = CLIRB.new
22
+ def self.run(args)
23
+ self.new.run(args)
14
24
  end
15
25
 
16
- def run(*args)
26
+ def initialize(kernel = nil, stdout = nil, stderr = nil)
27
+ @kernel = kernel || Kernel
28
+ @stdout = stdout || $stdout
29
+ @stderr = stderr || $stderr
30
+ end
31
+
32
+ def run(args)
17
33
  begin
18
- @cli.parse!(args)
19
- Ardb::Runner.new(@cli.args, @cli.opts).run
34
+ $LOAD_PATH.push(Dir.pwd) unless $LOAD_PATH.include?(Dir.pwd)
35
+ Ardb.init(false) # don't establish a connection
36
+
37
+ cmd_name = args.shift
38
+ cmd = COMMANDS[cmd_name].new(args)
39
+ cmd.run
20
40
  rescue CLIRB::HelpExit
21
- puts help
41
+ @stdout.puts cmd.help
22
42
  rescue CLIRB::VersionExit
23
- puts Ardb::VERSION
24
- rescue Ardb::Runner::UnknownCmdError => err
25
- $stderr.puts "#{err.message}\n\n"
26
- $stderr.puts help
27
- exit(1)
28
- rescue Ardb::NotConfiguredError, Ardb::Runner::CmdError => err
29
- $stderr.puts "#{err.message}"
30
- exit(1)
31
- rescue Ardb::Runner::CmdFail => err
32
- exit(1)
33
- rescue CLIRB::Error => exception
34
- $stderr.puts "#{exception.message}\n\n"
35
- $stderr.puts help
36
- exit(1)
37
- rescue Exception => exception
38
- $stderr.puts "#{exception.class}: #{exception.message}"
39
- $stderr.puts exception.backtrace.join("\n")
40
- exit(1)
41
- end
42
- exit(0)
43
+ @stdout.puts Ardb::VERSION
44
+ rescue CLIRB::Error, ArgumentError, InvalidCommandError => exception
45
+ display_debug(exception)
46
+ @stderr.puts "#{exception.message}\n\n"
47
+ @stdout.puts cmd.help
48
+ @kernel.exit 1
49
+ rescue CommandExitError
50
+ @kernel.exit 1
51
+ rescue StandardError => exception
52
+ @stderr.puts "#{exception.class}: #{exception.message}"
53
+ @stderr.puts exception.backtrace.join("\n")
54
+ @kernel.exit 1
55
+ end
56
+ @kernel.exit 0
43
57
  end
44
58
 
45
- def help
46
- "Usage: ardb [options] COMMAND\n"\
47
- "\n"\
48
- "Options:"\
49
- "#{@cli}"
59
+ private
60
+
61
+ def display_debug(exception)
62
+ if ENV['DEBUG']
63
+ @stderr.puts "#{exception.class}: #{exception.message}"
64
+ @stderr.puts exception.backtrace.join("\n")
65
+ end
50
66
  end
51
67
 
52
- end
68
+ InvalidCommandError = Class.new(ArgumentError)
69
+ CommandExitError = Class.new(RuntimeError)
70
+
71
+ class InvalidCommand
72
+
73
+ attr_reader :name, :argv, :clirb
74
+
75
+ def initialize(name)
76
+ @name = name
77
+ @argv = []
78
+ @clirb = Ardb::CLIRB.new
79
+ end
80
+
81
+ def new(args)
82
+ @argv = [@name, args].flatten.compact
83
+ self
84
+ end
85
+
86
+ def run
87
+ @clirb.parse!(@argv)
88
+ raise CLIRB::HelpExit if @clirb.args.empty? || @name.to_s.empty?
89
+ raise InvalidCommandError, "'#{self.name}' is not a command."
90
+ end
91
+
92
+ def help
93
+ "Usage: ardb [COMMAND] [options]\n\n" \
94
+ "Commands: #{COMMANDS.keys.sort.join(', ')}\n" \
95
+ "Options: #{@clirb}"
96
+ end
53
97
 
54
- class CLIRB # Version 1.0.0, https://github.com/redding/cli.rb
55
- Error = Class.new(RuntimeError);
56
- HelpExit = Class.new(RuntimeError); VersionExit = Class.new(RuntimeError)
57
- attr_reader :argv, :args, :opts, :data
58
-
59
- def initialize(&block)
60
- @options = []; instance_eval(&block) if block
61
- require 'optparse'
62
- @data, @args, @opts = [], [], {}; @parser = OptionParser.new do |p|
63
- p.banner = ''; @options.each do |o|
64
- @opts[o.name] = o.value; p.on(*o.parser_args){ |v| @opts[o.name] = v }
98
+ end
99
+
100
+ class ConnectCommand
101
+
102
+ attr_reader :clirb
103
+
104
+ def initialize(argv, stdout = nil, stderr = nil)
105
+ @argv = argv
106
+ @stdout = stdout || $stdout
107
+ @stderr = stderr || $stderr
108
+
109
+ @clirb = Ardb::CLIRB.new
110
+ @adapter = Ardb::Adapter.send(Ardb.config.db.adapter)
111
+ end
112
+
113
+ def run
114
+ @clirb.parse!(@argv)
115
+ begin
116
+ Ardb.init
117
+ @adapter.connect_db
118
+ @stdout.puts "connected to #{Ardb.config.db.adapter} db `#{Ardb.config.db.database}`"
119
+ rescue StandardError => e
120
+ @stderr.puts e
121
+ @stderr.puts e.backtrace.join("\n")
122
+ @stderr.puts "error connecting to #{Ardb.config.db.database.inspect} database " \
123
+ "with #{Ardb.config.db_settings.inspect}"
124
+ raise CommandExitError
65
125
  end
66
- p.on_tail('--version', ''){ |v| raise VersionExit, v.to_s }
67
- p.on_tail('--help', ''){ |v| raise HelpExit, v.to_s }
68
126
  end
127
+
128
+ def help
129
+ "Usage: ardb connect [options]\n\n" \
130
+ "Options: #{@clirb}"
131
+ end
132
+
69
133
  end
70
134
 
71
- def option(*args); @options << Option.new(*args); end
72
- def parse!(argv)
73
- @args = (argv || []).dup.tap do |args_list|
74
- begin; @parser.parse!(args_list)
75
- rescue OptionParser::ParseError => err; raise Error, err.message; end
76
- end; @data = @args + [@opts]
135
+ class CreateCommand
136
+
137
+ attr_reader :clirb
138
+
139
+ def initialize(argv, stdout = nil, stderr = nil)
140
+ @argv = argv
141
+ @stdout = stdout || $stdout
142
+ @stderr = stderr || $stderr
143
+
144
+ @clirb = Ardb::CLIRB.new
145
+ @adapter = Ardb::Adapter.send(Ardb.config.db.adapter)
146
+ end
147
+
148
+ def run
149
+ @clirb.parse!(@argv)
150
+ begin
151
+ @adapter.create_db
152
+ @stdout.puts "created #{Ardb.config.db.adapter} db `#{Ardb.config.db.database}`"
153
+ rescue StandardError => e
154
+ @stderr.puts e
155
+ @stderr.puts "error creating #{Ardb.config.db.database.inspect} database"
156
+ raise CommandExitError
157
+ end
158
+ end
159
+
160
+ def help
161
+ "Usage: ardb create [options]\n\n" \
162
+ "Options: #{@clirb}"
163
+ end
164
+
77
165
  end
78
- def to_s; @parser.to_s; end
79
- def inspect
80
- "#<#{self.class}:#{'0x0%x' % (object_id << 1)} @data=#{@data.inspect}>"
166
+
167
+ class DropCommand
168
+
169
+ attr_reader :clirb
170
+
171
+ def initialize(argv, stdout = nil, stderr = nil)
172
+ @argv = argv
173
+ @stdout = stdout || $stdout
174
+ @stderr = stderr || $stderr
175
+
176
+ @clirb = Ardb::CLIRB.new
177
+ @adapter = Ardb::Adapter.send(Ardb.config.db.adapter)
178
+ end
179
+
180
+ def run
181
+ @clirb.parse!(@argv)
182
+ begin
183
+ @adapter.drop_db
184
+ @stdout.puts "dropped #{Ardb.config.db.adapter} db `#{Ardb.config.db.database}`"
185
+ rescue StandardError => e
186
+ @stderr.puts e
187
+ @stderr.puts "error dropping #{Ardb.config.db.database.inspect} database"
188
+ raise CommandExitError
189
+ end
190
+ end
191
+
192
+ def help
193
+ "Usage: ardb drop [options]\n\n" \
194
+ "Options: #{@clirb}"
195
+ end
196
+
81
197
  end
82
198
 
83
- class Option
84
- attr_reader :name, :opt_name, :desc, :abbrev, :value, :klass, :parser_args
85
-
86
- def initialize(name, *args)
87
- settings, @desc = args.last.kind_of?(::Hash) ? args.pop : {}, args.pop || ''
88
- @name, @opt_name, @abbrev = parse_name_values(name, settings[:abbrev])
89
- @value, @klass = gvalinfo(settings[:value])
90
- @parser_args = if [TrueClass, FalseClass, NilClass].include?(@klass)
91
- ["-#{@abbrev}", "--[no-]#{@opt_name}", @desc]
92
- else
93
- ["-#{@abbrev}", "--#{@opt_name} #{@opt_name.upcase}", @klass, @desc]
199
+ class MigrateCommand
200
+
201
+ attr_reader :clirb
202
+
203
+ def initialize(argv, stdout = nil, stderr = nil)
204
+ @argv = argv
205
+ @stdout = stdout || $stdout
206
+ @stderr = stderr || $stderr
207
+
208
+ @clirb = Ardb::CLIRB.new
209
+ @adapter = Ardb::Adapter.send(Ardb.config.db.adapter)
210
+ end
211
+
212
+ def run
213
+ @clirb.parse!(@argv)
214
+ begin
215
+ Ardb.init
216
+ @adapter.migrate_db
217
+ @adapter.dump_schema unless ENV['ARDB_MIGRATE_NO_SCHEMA']
218
+ rescue StandardError => e
219
+ @stderr.puts e
220
+ @stderr.puts e.backtrace.join("\n")
221
+ @stderr.puts "error migrating #{Ardb.config.db.database.inspect} database"
222
+ raise CommandExitError
94
223
  end
95
224
  end
96
225
 
97
- private
226
+ def help
227
+ "Usage: ardb migrate [options]\n\n" \
228
+ "Options: #{@clirb}"
229
+ end
230
+
231
+ end
232
+
233
+ class GenerateMigrationCommand
234
+
235
+ attr_reader :clirb
236
+
237
+ def initialize(argv, stdout = nil, stderr = nil)
238
+ @argv = argv
239
+ @stdout = stdout || $stdout
240
+ @stderr = stderr || $stderr
241
+
242
+ @clirb = Ardb::CLIRB.new
243
+ end
244
+
245
+ def run
246
+ @clirb.parse!(@argv)
247
+ begin
248
+ require "ardb/migration"
249
+ path = Ardb::Migration.new(@clirb.args.first).save!.file_path
250
+ @stdout.puts "generated #{path}"
251
+ rescue Ardb::Migration::NoIdentifierError => exception
252
+ error = ArgumentError.new("MIGRATION-NAME must be provided")
253
+ error.set_backtrace(exception.backtrace)
254
+ raise error
255
+ rescue StandardError => e
256
+ @stderr.puts e
257
+ @stderr.puts e.backtrace.join("\n")
258
+ @stderr.puts "error generating migration"
259
+ raise CommandExitError
260
+ end
261
+ end
98
262
 
99
- def parse_name_values(name, custom_abbrev)
100
- [ (processed_name = name.to_s.strip.downcase), processed_name.gsub('_', '-'),
101
- custom_abbrev || processed_name.gsub(/[^a-z]/, '').chars.first || 'a'
102
- ]
263
+ def help
264
+ "Usage: ardb generate-migration [options] MIGRATION-NAME\n\n" \
265
+ "Options: #{@clirb}"
103
266
  end
104
- def gvalinfo(v); v.kind_of?(Class) ? [nil,gklass(v)] : [v,gklass(v.class)]; end
105
- def gklass(k); k == Fixnum ? Integer : k; end
267
+
106
268
  end
269
+
107
270
  end
108
271
 
109
272
  end