nomadize 0.2.0 → 0.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 281d8eece08ec4e4ff09e73656dd2c7c57f5c723
4
- data.tar.gz: e585f19613a01e82e198b57678c721d54d2fa09b
3
+ metadata.gz: 24e4a53c7ce85b9aee4219137933e62f8d4ae79c
4
+ data.tar.gz: a859e3e0db9e603db1998d7f5e8e11907e5c9274
5
5
  SHA512:
6
- metadata.gz: 0103c0e40303bb05c0b35cfc7b61e736c46fcf7b3e88ba260f77cb28c678a701483ea099bbb0bae1f7f41d9773d83ef63158e9c2d44b8cc5161a3c61b161cb6a
7
- data.tar.gz: 5b2fa8e1548e3697c0e1d332c00afa4084038f640a573630b6bca1566d46ea4ab37ab801aff444e5f91c7741165f43c8c4bd271630e6d7e31ad206a2ad4b08d5
6
+ metadata.gz: 9959f0b9257e56ac4d77cb8c7918fe5c9d9927e4a6b63d9fde13a7253e36f149a739792926ab1bcbed96b51159bfe06997206965dd125ae43ecad37d5b530247
7
+ data.tar.gz: 53fc2a4752307418c5a5a48a154cd626e44d8c60866c7b184fb6584a21464a9bb6f1cea36539d543f0d41ad0cbcc9c6eedcdec7684e2e5462c291530fe552dee
data/README.md CHANGED
@@ -47,6 +47,15 @@ After a config file is in place add `require 'nomadize/tasks'` to your rake fil
47
47
  * `rake db:rollback[count]` - rollback migrations (default count: 1)
48
48
  * `rake db:generate_template_config` - generate a config file in `config/database.yml`
49
49
 
50
+ Alternatively you can use the commandline tool `nomadize`:
51
+
52
+ * `nomadize create` - creates a database and a schema_migrations table
53
+ * `nomadize drop` - dumps your poor poor database
54
+ * `nomadize new_migration $migration_name` - creates a timestamped migration file in db/migrations/ just fill in the details.
55
+ * `nomadize migrate` - runs migrations found in db/migrations that have not been run yet
56
+ * `nomadize status` - see which migrations have or have not been run
57
+ * `nomadize rollback $count` - rollback migrations (default count: 1)
58
+
50
59
  Migrations are written in SQL in the generated YAML files:
51
60
 
52
61
  ```
@@ -80,3 +89,14 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/piisal
80
89
  ## License
81
90
 
82
91
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
92
+
93
+ ## Changelog
94
+ 0.3.0
95
+ * Include a command line interface for Nomadize commands (THANKS [@moonglum](https://github.com/moonglum))
96
+
97
+ 0.2.0
98
+ * migration_path setting now has a default instead of being a required option in config/database.yml
99
+ * Reworded some of the README.md
100
+ * Added a rake task to generate a template config file in config/database.yml
101
+
102
+ 0.1.0 - Initial Release
data/exe/nomadize ADDED
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'nomadize'
4
+ require 'nomadize/help'
5
+
6
+ def show_help
7
+ puts "Usage:"
8
+ Nomadize.help.each_pair do |command, help|
9
+ puts " nomadize #{command.to_s.ljust(15)} #{help}"
10
+ end
11
+ end
12
+
13
+ def migration_name
14
+ ARGV.fetch(1)
15
+ rescue IndexError
16
+ abort 'Error: Migration name not provided'
17
+ end
18
+
19
+ case ARGV[0]
20
+ when '-h' then show_help
21
+ when '--help' then show_help
22
+ when 'create' then Nomadize.create_database
23
+ when 'drop' then Nomadize.drop_database
24
+ when 'new_migration' then Nomadize.generate_template_migration_file(migration_name)
25
+ when 'migrate' then Nomadize.migrate
26
+ when 'status' then Nomadize.status
27
+ when 'rollback' then Nomadize.rollback(ARGV.fetch(1, 1))
28
+ when nil then abort 'Error: No Command Provided'
29
+ else abort "Error: Unknown Command '#{ARGV[0]}'"
30
+ end
@@ -0,0 +1,11 @@
1
+ module Nomadize
2
+ @help = {
3
+ create: 'Create database using name in {appdir}/config/database.yml',
4
+ drop: 'Drop database using name in {appdir}/config/database.yml',
5
+ new_migration: 'Generate a migration template file. default directory: {appdir}/db/migrations',
6
+ migrate: 'Run migrations',
7
+ status: 'View the status of known migrations',
8
+ rollback: 'Rollback migrations (default count: 1)'
9
+ }
10
+ class << self; attr_reader :help; end
11
+ end
@@ -1,33 +1,34 @@
1
1
  require 'nomadize'
2
+ require 'nomadize/help'
2
3
 
3
4
  namespace :db do
4
5
 
5
- desc 'Create database using name in {appdir}/config/database.yml'
6
+ desc Nomadize.help.fetch(:create)
6
7
  task :create do
7
8
  Nomadize.create_database
8
9
  end
9
10
 
10
- desc 'drop database using name in {appdir}/config/database.yml'
11
+ desc Nomadize.help.fetch(:drop)
11
12
  task :drop do
12
13
  Nomadize.drop_database
13
14
  end
14
15
 
15
- desc "Generate a migration template file. default directory: {appdir}/db/migrations"
16
+ desc Nomadize.help.fetch(:new_migration)
16
17
  task :new_migration, [:migration_name] do |_, args|
17
18
  Nomadize.generate_template_migration_file(args.migration_name)
18
19
  end
19
20
 
20
- desc 'Run migrations'
21
+ desc Nomadize.help.fetch(:migrate)
21
22
  task :migrate do
22
23
  Nomadize.run_migrations
23
24
  end
24
25
 
25
- desc 'view the status of known migrations'
26
+ desc Nomadize.help.fetch(:status)
26
27
  task :status do
27
28
  Nomadize.status
28
29
  end
29
30
 
30
- desc 'rollback migrations (default count: 1)'
31
+ desc Nomadize.help.fetch(:rollback)
31
32
  task :rollback, :steps do |_, args|
32
33
  count = args.steps || 1
33
34
  Nomadize.rollback(count)
@@ -1,3 +1,3 @@
1
1
  module Nomadize
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nomadize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Dawson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-11-26 00:00:00.000000000 Z
11
+ date: 2015-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -71,7 +71,8 @@ description: Nomadize is a collection of rake tasks for managing migrations usin
71
71
  simple utility.
72
72
  email:
73
73
  - paul@into.computer
74
- executables: []
74
+ executables:
75
+ - nomadize
75
76
  extensions: []
76
77
  extra_rdoc_files: []
77
78
  files:
@@ -82,9 +83,11 @@ files:
82
83
  - LICENSE.txt
83
84
  - README.md
84
85
  - Rakefile
86
+ - exe/nomadize
85
87
  - lib/nomadize.rb
86
88
  - lib/nomadize/config.rb
87
89
  - lib/nomadize/file_generator.rb
90
+ - lib/nomadize/help.rb
88
91
  - lib/nomadize/migration.rb
89
92
  - lib/nomadize/migration_loader.rb
90
93
  - lib/nomadize/migrator.rb