thecore_background_jobs 1.1.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8be10ab01c0f358480e35cff1ac6d10f89aa8a08
4
+ data.tar.gz: e07d8f9deb36410e21a43722c73b01f6bfaf4e12
5
+ SHA512:
6
+ metadata.gz: 8fc280be4ac6d7fc4de11acb21a60df9c7eef849957911720233c9361c32308aae7703a60a7d277005874fc8ff8aca2681996988177e2f63ec811b6e2914623d
7
+ data.tar.gz: 2863c6f9bb101d46bcd099febfdb162307b94bc930dea2dcfc5bcd7eddd4a397a7933fd7545d34a86778830b04773fc88d3da7b4192d2a5c9f705b32d82a5bae
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2017 Gabriele Tassoni
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,28 @@
1
+ # ThecoreBackgroundJobs
2
+ Short description and motivation.
3
+
4
+ ## Usage
5
+ How to use my plugin.
6
+
7
+ ## Installation
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'thecore_background_jobs'
12
+ ```
13
+
14
+ And then execute:
15
+ ```bash
16
+ $ bundle
17
+ ```
18
+
19
+ Or install it yourself as:
20
+ ```bash
21
+ $ gem install thecore_background_jobs
22
+ ```
23
+
24
+ ## Contributing
25
+ Contribution directions go here.
26
+
27
+ ## License
28
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,36 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'ThecoreBackgroundJobs'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+
21
+ load 'rails/tasks/statistics.rake'
22
+
23
+
24
+
25
+ require 'bundler/gem_tasks'
26
+
27
+ require 'rake/testtask'
28
+
29
+ Rake::TestTask.new(:test) do |t|
30
+ t.libs << 'test'
31
+ t.pattern = 'test/**/*_test.rb'
32
+ t.verbose = false
33
+ end
34
+
35
+
36
+ task default: :test
@@ -0,0 +1,7 @@
1
+ class DemoWorker
2
+ include Sidekiq::Worker
3
+
4
+ def perform(*args)
5
+ puts "Worker is working"
6
+ end
7
+ end
@@ -0,0 +1,6 @@
1
+ # abilities_thecore_background_jobs_concern
2
+ Rails.application.configure do
3
+ config.after_initialize do
4
+ require 'abilities_thecore_background_jobs_concern'
5
+ end
6
+ end
data/config/routes.rb ADDED
@@ -0,0 +1,8 @@
1
+ Rails.application.routes.draw do
2
+ require 'sidekiq/web'
3
+ Sidekiq::Web.set :session_secret, Rails.application.secrets[:secret_key_base]
4
+ authenticate do
5
+ mount Sidekiq::Web, at: "/app/sidekiq"
6
+ end
7
+ # mount Sidekiq::Web => '/sidekiq', :constraints => AdminConstraint.new
8
+ end
@@ -0,0 +1,29 @@
1
+
2
+ require 'active_support/concern'
3
+
4
+ module ThecoreBackgroundJobAbilitiesConcern
5
+ extend ActiveSupport::Concern
6
+ included do
7
+ def thecore_background_jobs_abilities user
8
+ # Not so good, but let's try
9
+ RailsAdmin.config do |config|
10
+ config.navigation_static_links = {
11
+ "Sidekiq Dashboard" => "#{ENV['RAILS_RELATIVE_URL_ROOT']}/app/sidekiq"
12
+ }
13
+ end
14
+ if user
15
+ # if the user is logged in, it can do certain tasks regardless his role
16
+ if user.admin?
17
+ # if the user is an admin, it can do a lot of things, usually
18
+ end
19
+
20
+ if user.has_role? :role
21
+ # a specific role, brings specific powers
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+
28
+ # include the extension
29
+ TheCoreAbilities.send(:include, ThecoreBackgroundJobAbilitiesConcern)
@@ -0,0 +1,7 @@
1
+ class AdminConstraint
2
+ def matches?(request)
3
+ return false unless request.session[:user_id]
4
+ user = User.find request.session[:user_id]
5
+ user && user.admin?
6
+ end
7
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :thecore_background_jobs do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,15 @@
1
+ require 'thecore'
2
+ module ThecoreBackgroundJobs
3
+ class Engine < ::Rails::Engine
4
+
5
+ initializer 'thecore_background_jobs.add_to_migrations' do |app|
6
+ unless app.root.to_s == root.to_s
7
+ # APPEND TO MAIN APP MIGRATIONS FROM THIS GEM
8
+ config.paths['db/migrate'].expanded.each do |expanded_path|
9
+ app.config.paths['db/migrate'] << expanded_path
10
+ end
11
+ end
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,3 @@
1
+ module ThecoreBackgroundJobs
2
+ VERSION = '1.1.11'
3
+ end
@@ -0,0 +1,10 @@
1
+
2
+ require 'thecore'
3
+ require 'sidekiq'
4
+ require "sidekiq-scheduler"
5
+ require "sidekiq-failures"
6
+ require "thecore_background_jobs/engine"
7
+
8
+ module ThecoreBackgroundJobs
9
+ # Your code goes here...
10
+ end
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: thecore_background_jobs
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.11
5
+ platform: ruby
6
+ authors:
7
+ - Gabriele Tassoni
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-01-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thecore
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: sidekiq
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '5.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '5.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: sidekiq-scheduler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.1'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.1'
55
+ - !ruby/object:Gem::Dependency
56
+ name: sidekiq-failures
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.0'
69
+ description: Thecorized thecore_background_jobs full description.
70
+ email:
71
+ - gabriele.tassoni@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - MIT-LICENSE
77
+ - README.md
78
+ - Rakefile
79
+ - app/assets/config/thecore_background_jobs_manifest.js
80
+ - app/workers/demo_worker.rb
81
+ - config/initializers/thecore_background_jobs_after_initialize.rb
82
+ - config/initializers/thecore_background_jobs_rails_admin_config.rb
83
+ - config/routes.rb
84
+ - lib/abilities_thecore_background_jobs_concern.rb
85
+ - lib/admin_constraint.rb
86
+ - lib/tasks/thecore_background_jobs_tasks.rake
87
+ - lib/thecore_background_jobs.rb
88
+ - lib/thecore_background_jobs/engine.rb
89
+ - lib/thecore_background_jobs/version.rb
90
+ homepage: https://www.taris.it
91
+ licenses:
92
+ - MIT
93
+ metadata: {}
94
+ post_install_message:
95
+ rdoc_options: []
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ required_rubygems_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ requirements: []
109
+ rubyforge_project:
110
+ rubygems_version: 2.6.14
111
+ signing_key:
112
+ specification_version: 4
113
+ summary: Thecorized thecore_background_jobs
114
+ test_files: []