tasks-migration 0.0.1 → 0.0.2
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bafed3e78b6ace08a69b4159b0eacab87074972936f856a04ad258d52bad39c
|
4
|
+
data.tar.gz: 18e092b469d0078078f812e145624c91a8dc53c375d9f111171c273f483e563d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa47170f31399eb113ae212fa642e32503a9d037dd2b3e8d087c264cce6278c68b6253ff8e349bb5845bd91434a89f80cb001b349c8e69b3fe4c42b8a215f58f
|
7
|
+
data.tar.gz: e813bebfc95b56668652adff08f9fea37877c7bbd37d2b4ab9085d211aeef69d650089df5d57bd63971ada5cbb2cfe5721fe5cda996b334d4be55e65fc56b826
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## `0.0.2`
|
4
|
+
|
5
|
+
- Enhancements
|
6
|
+
* Support run task(s) when module name similar task name ([#13](https://github.com/namnv609/tasks-migration/issues/13))
|
7
|
+
* Add option `--no-suffix` to remove `Task` suffix from task name
|
8
|
+
|
3
9
|
## `0.0.1`
|
4
10
|
|
5
11
|
- Release gem
|
data/README.md
CHANGED
@@ -31,7 +31,7 @@ This command will create 2 files:
|
|
31
31
|
Create a new task by command:
|
32
32
|
|
33
33
|
```
|
34
|
-
rails generate tasks_migration:task <TaskName>
|
34
|
+
rails generate tasks_migration:task <TaskName> [--no-suffix]
|
35
35
|
```
|
36
36
|
|
37
37
|
Business Logic will be handled in method `self.excute` on file `app/migration_tasks/<task_name>.rb`. Example:
|
@@ -4,10 +4,15 @@ module TasksMigration
|
|
4
4
|
module Generators
|
5
5
|
class TaskGenerator < ::Rails::Generators::NamedBase
|
6
6
|
source_root File.expand_path("../templates", __FILE__)
|
7
|
+
class_option "no-suffix", type: :boolean, default: false,
|
8
|
+
desc: "Remove Task suffix for task class name"
|
7
9
|
|
8
10
|
desc "Add new migration task"
|
9
11
|
def add_task
|
10
|
-
|
12
|
+
task_file_suffix = "_task" unless options["no-suffix"]
|
13
|
+
task_file_name = "#{name.underscore}#{task_file_suffix}.rb"
|
14
|
+
|
15
|
+
template "task.rb", "app/migration_tasks/#{task_file_name}"
|
11
16
|
end
|
12
17
|
end
|
13
18
|
end
|
@@ -9,8 +9,11 @@ module TasksMigration
|
|
9
9
|
executed_tasks = TasksMigrationSchema.pluck :version
|
10
10
|
|
11
11
|
(all_tasks - executed_tasks).each do |task|
|
12
|
-
|
13
|
-
|
12
|
+
task_name = task.classify
|
13
|
+
|
14
|
+
puts "Running task #{task_name}..."
|
15
|
+
task_name.constantize.execute
|
16
|
+
|
14
17
|
TasksMigrationSchema.create version: task
|
15
18
|
end
|
16
19
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tasks-migration
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- NamNV609
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Running tasks for Rails as migration
|
14
14
|
email: namnv609@gmail.com
|