shinq 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb1e0ce04e84f65b1a4401c166bc1daad509cb36
4
- data.tar.gz: bd849b20febda4bbfe700f868ef7e07ed89f0d75
3
+ metadata.gz: 963044a99e6d106db2b057aada7d494cad2b08e7
4
+ data.tar.gz: 0aed9ca078d588390f1f60e31848c890d67b6f47
5
5
  SHA512:
6
- metadata.gz: c8e957282f8d504a6b528b73dd8c84b8039f9138443bfd82bc7e24ddfa54d6e342dfc20ca1b3aeeb968a3396ad9220d35b7787d3f76b8cc63411293a9b348f8d
7
- data.tar.gz: a7478a1c53b357671f3ba197c3d3d57139865abb33c448f9d70dfdea093d33f36423cd7f58dc2cb6133444f9507c21a9651f855a56231959658a94d1fc6d891a
6
+ metadata.gz: 335d663a56d4583364ca9c566347396488e3caa5170141c8f3b6dec869a1f9c6a99adbfc591721e4972b4859f1aa32de5cc0b5a2a853515d7d0e89218474af6f
7
+ data.tar.gz: 36edfb7ed38029b700f71718e68549a3fcdb60e2a00a4bcf5aa90ff81ce6b0859fe5395702b94013a8b64513110cdb3fe4f24d68f0fd783d52ef2b74fdaecd3a
@@ -0,0 +1,11 @@
1
+ class <%= migration_class_name %> < ActiveRecord::Migration
2
+ def change
3
+ create_table :<%= table_name %>, {id: false, options: "ENGINE=QUEUE"} do |t|
4
+ t.string :job_id, null: false
5
+ <% attributes.each do |attribute| -%>
6
+ t.<%= attribute.type %> :<%= attribute.name %><%= attribute.inject_options %>
7
+ <% end -%>
8
+ t.datetime :enqueued_at, null: false
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,7 @@
1
+ class <%= class_name %> < ActiveJob::Base
2
+ queue_as :<%= plural_name %>
3
+
4
+ def perform(args)
5
+ #do something
6
+ end
7
+ end
@@ -0,0 +1,30 @@
1
+ require 'rails/generators/named_base'
2
+ require 'rails/generators/model_helpers'
3
+ require 'rails/generators/active_record/migration'
4
+
5
+ module Shinq
6
+ module Generators
7
+ class WorkerGenerator < ::Rails::Generators::NamedBase
8
+ include ::Rails::Generators::ModelHelpers
9
+ include ::Rails::Generators::Migration
10
+ include ::ActiveRecord::Generators::Migration
11
+
12
+ argument :attributes, :type => :array, :default => [], :banner => "field[:type][:index] field[:type][:index]"
13
+
14
+ check_class_collision
15
+
16
+ class_option :migration, :type => :boolean
17
+ class_option :parent, :type => :string, :desc => "The parent class for the generated model"
18
+
19
+ source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
20
+
21
+ def create_migration_file
22
+ migration_template 'create_table_migration.erb', "db/migrate/create_#{table_name}.rb"
23
+ end
24
+
25
+ def create_worker_file
26
+ template 'worker.erb', File.join('app/workers', class_path, "#{file_name}.rb")
27
+ end
28
+ end
29
+ end
30
+ end
data/shinq.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "shinq"
7
- spec.version = '0.0.1'
7
+ spec.version = '0.1.0'
8
8
  spec.authors = ["Ryoichi SEKIGUCHI"]
9
9
  spec.email = ["ryopeko@gmail.com"]
10
10
  spec.summary = %q{Worker and enqueuer for Q4M using the interface of ActiveJob.}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shinq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryoichi SEKIGUCHI
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-31 00:00:00.000000000 Z
11
+ date: 2014-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -180,6 +180,9 @@ files:
180
180
  - README.md
181
181
  - Rakefile
182
182
  - bin/shinq
183
+ - lib/generators/shinq/worker/templates/create_table_migration.erb
184
+ - lib/generators/shinq/worker/templates/worker.erb
185
+ - lib/generators/shinq/worker/worker_generator.rb
183
186
  - lib/shinq.rb
184
187
  - lib/shinq/active_job/queue_adapters/shinq_adapter.rb
185
188
  - lib/shinq/cli.rb