jobshop 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/COPYRIGHT +15 -0
- data/LICENSE +661 -0
- data/README.md +41 -0
- data/Rakefile +24 -0
- data/app/assets/config/jobshop_manifest.js +2 -0
- data/app/assets/javascripts/jobshop/application.js +13 -0
- data/app/assets/stylesheets/jobshop/application.css +15 -0
- data/app/controllers/jobshop/application_controller.rb +4 -0
- data/app/helpers/jobshop/application_helper.rb +4 -0
- data/app/jobs/jobshop/application_job.rb +4 -0
- data/app/models/application_record.rb +5 -0
- data/app/views/layouts/jobshop/application.html.erb +14 -0
- data/config/routes.rb +2 -0
- data/lib/generators/active_record/jobshop_generator.rb +46 -0
- data/lib/generators/active_record/templates/migration.rb.tt +8 -0
- data/lib/generators/active_record/templates/migration_existing.rb.tt +10 -0
- data/lib/generators/jobshop/config/config_generator.rb +22 -0
- data/lib/generators/jobshop/config/templates/jobshop.rb.tt +3 -0
- data/lib/generators/jobshop/orm_helpers.rb +23 -0
- data/lib/generators/jobshop_generator.rb +20 -0
- data/lib/jobshop/engine.rb +12 -0
- data/lib/jobshop/version.rb +14 -0
- data/lib/jobshop.rb +35 -0
- data/lib/tasks/jobshop_tasks.rake +4 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/config/manifest.js +5 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/javascripts/cable.coffee +11 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/channels/application_cable/channel.rb +5 -0
- data/spec/dummy/app/channels/application_cable/connection.rb +5 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/jobs/application_job.rb +2 -0
- data/spec/dummy/app/mailers/application_mailer.rb +4 -0
- data/spec/dummy/app/models/application_record.rb +3 -0
- data/spec/dummy/app/views/layouts/application.html.erb +15 -0
- data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +34 -0
- data/spec/dummy/bin/update +29 -0
- data/spec/dummy/config/application.rb +21 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +85 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +56 -0
- data/spec/dummy/config/environments/production.rb +82 -0
- data/spec/dummy/config/environments/test.rb +44 -0
- data/spec/dummy/config/initializers/active_record_belongs_to_required_by_default.rb +5 -0
- data/spec/dummy/config/initializers/application_controller_renderer.rb +6 -0
- data/spec/dummy/config/initializers/assets.rb +11 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/callback_terminator.rb +5 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +4 -0
- data/spec/dummy/config/initializers/cors.rb +16 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/request_forgery_protection.rb +4 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/redis/cable.yml +9 -0
- data/spec/dummy/config/routes.rb +6 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/config.ru +9 -0
- data/spec/dummy/log/development.log +64 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/rails_helper.rb +57 -0
- data/spec/spec_helper.rb +92 -0
- metadata +206 -0
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
[![Code Climate](https://codeclimate.com/github/frankjmattia/jobshop/badges/gpa.svg)](https://codeclimate.com/github/frankjmattia/jobshop)
|
2
|
+
|
3
|
+
# Jobshop
|
4
|
+
|
5
|
+
This README is also [available in a friendly, navigable format](http://jobshop.frankjmattia.documentup.com).
|
6
|
+
|
7
|
+
## Getting Started
|
8
|
+
|
9
|
+
_Jobshop is being actively developed with Rails 5. Patches which add support for Rails 4+ are more than welcome._
|
10
|
+
|
11
|
+
Start by adding Jobshop to your Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem "jobshop", "~> 0.0.1"
|
15
|
+
```
|
16
|
+
|
17
|
+
Run the `bundle` command to install it.
|
18
|
+
|
19
|
+
Once Jobshop has been installed you can configure it by running the generator:
|
20
|
+
|
21
|
+
```console
|
22
|
+
% rails generate jobshop:config
|
23
|
+
```
|
24
|
+
|
25
|
+
The generator will install an initializer which describes ALL of Jobshop's configuration options.
|
26
|
+
|
27
|
+
Add Jobshop to your model using the generator:
|
28
|
+
|
29
|
+
```console
|
30
|
+
% rails generate jobshop MODEL
|
31
|
+
```
|
32
|
+
|
33
|
+
Replace MODEL with the class name used for the application’s users (it’s frequently `User` but could also be `Person` or even `Employee`). This will create a model (if one does not exist) and configure it. The generator also configures your `config/routes.rb` file to point to the Jobshop engine.
|
34
|
+
|
35
|
+
|
36
|
+
## Bug Reports
|
37
|
+
If you discover a problem with Jobshop, we would like to know about it.
|
38
|
+
|
39
|
+
https://github.com/frankjmattia/jobshop/issues
|
40
|
+
|
41
|
+
If you discover a security related bug, please do NOT use the GitHub issue tracker. Send an email to frankjmattia@jobshop.io
|
data/Rakefile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
|
3
|
+
begin
|
4
|
+
require "bundler/setup"
|
5
|
+
rescue LoadError
|
6
|
+
puts "You must `gem install bundler` and `bundle install` to run rake tasks"
|
7
|
+
end
|
8
|
+
|
9
|
+
require "rdoc/task"
|
10
|
+
|
11
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
12
|
+
rdoc.rdoc_dir = "rdoc"
|
13
|
+
rdoc.title = "Jobshop"
|
14
|
+
rdoc.options << "--line-numbers"
|
15
|
+
rdoc.rdoc_files.include("README.md")
|
16
|
+
rdoc.rdoc_files.include("lib/**/*.rb")
|
17
|
+
end
|
18
|
+
|
19
|
+
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
20
|
+
|
21
|
+
load "rails/tasks/engine.rake"
|
22
|
+
load "rails/tasks/statistics.rake"
|
23
|
+
|
24
|
+
Bundler::GemHelper.install_tasks
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
+
* It is generally better to create a new file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Jobshop</title>
|
5
|
+
<%= stylesheet_link_tag "jobshop/application", media: "all" %>
|
6
|
+
<%= javascript_include_tag "jobshop/application" %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
require "rails/generators/active_record"
|
2
|
+
require "generators/jobshop/orm_helpers"
|
3
|
+
|
4
|
+
module ActiveRecord
|
5
|
+
module Generators
|
6
|
+
class JobshopGenerator < ActiveRecord::Generators::Base
|
7
|
+
include Jobshop::Generators::OrmHelpers
|
8
|
+
|
9
|
+
source_root File.expand_path("../templates", __FILE__)
|
10
|
+
|
11
|
+
def copy_jobshop_migration
|
12
|
+
if model_exists_and_invoking? || migration_exists_and_revoking?
|
13
|
+
migration_template "migration_existing.rb", "db/migrate/add_jobshop_to_#{table_name}.rb"
|
14
|
+
else
|
15
|
+
migration_template "migration.rb", "db/migrate/jobshop_create_#{table_name}.rb"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def generate_model
|
20
|
+
invoke "active_record:model", [name], migration: false unless model_exists_and_invoking?
|
21
|
+
invoke "devise:install"
|
22
|
+
end
|
23
|
+
|
24
|
+
def inject_jobshop_content
|
25
|
+
content = <<-CONTENT.strip_heredoc
|
26
|
+
jobshop_user
|
27
|
+
CONTENT
|
28
|
+
|
29
|
+
class_path = namespaced? ? class_name.to_s.split("::") : [ class_name ]
|
30
|
+
indent_depth = class_path.size - 1
|
31
|
+
content = content.split("\n").map { |line| " " * indent_depth + line } .join("\n") << "\n"
|
32
|
+
inject_into_class(model_path, class_path.last, content) if model_exists?
|
33
|
+
end
|
34
|
+
|
35
|
+
no_tasks do
|
36
|
+
def model_exists_and_invoking?
|
37
|
+
model_exists? && behavior == :invoke
|
38
|
+
end
|
39
|
+
|
40
|
+
def migration_exists_and_revoking?
|
41
|
+
migration_exists?(table_name) && behavior == :revoke
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
class AddJobshopTo<%= table_name.camelize %> < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
end
|
4
|
+
|
5
|
+
def self.down
|
6
|
+
# By default, we don't want to make any assumption about how to roll back a migration when your
|
7
|
+
# model already existed. Please edit below which fields you would like to remove in this migration.
|
8
|
+
raise ActiveRecord::IrreversibleMigration
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Jobshop
|
2
|
+
module Generators
|
3
|
+
class ConfigGenerator < Rails::Generators::Base
|
4
|
+
source_root File.expand_path("../templates", __FILE__)
|
5
|
+
|
6
|
+
desc "Creates a Jobshop initializer."
|
7
|
+
|
8
|
+
def load_environment
|
9
|
+
begin
|
10
|
+
require File.expand_path("config/environment.rb")
|
11
|
+
rescue LoadError
|
12
|
+
say "This command must be run from a Rails application's root directory.", :red
|
13
|
+
fail SystemExit
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def copy_template
|
18
|
+
template "jobshop.rb.tt", "config/initializers/jobshop.rb"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Jobshop
|
2
|
+
module Generators
|
3
|
+
module OrmHelpers
|
4
|
+
private
|
5
|
+
|
6
|
+
def model_exists?
|
7
|
+
File.exists?(File.join(destination_root, model_path))
|
8
|
+
end
|
9
|
+
|
10
|
+
def migration_exists?(table_name)
|
11
|
+
Dir.glob("#{File.join(destination_root, migration_path)}/[0-9]*_*.rb").grep(/\d+_add_jobshop_to_#{table_name}.rb$/).first
|
12
|
+
end
|
13
|
+
|
14
|
+
def migration_path
|
15
|
+
@migration_path ||= File.join("db", "migrate")
|
16
|
+
end
|
17
|
+
|
18
|
+
def model_path
|
19
|
+
@model_path ||= File.join("app", "models", "#{file_path}.rb")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Jobshop
|
2
|
+
module Generators
|
3
|
+
class JobshopGenerator < Rails::Generators::NamedBase
|
4
|
+
namespace "jobshop"
|
5
|
+
|
6
|
+
desc <<-DESC.strip_heredoc
|
7
|
+
Generates a model with the given NAME, a migration (if one does not exist)
|
8
|
+
and adds Jobshop to config/routes.rb
|
9
|
+
DESC
|
10
|
+
|
11
|
+
hook_for :orm
|
12
|
+
|
13
|
+
def add_jobshop_route
|
14
|
+
jobshop_route = "# jobshop_to :#{plural_name}"
|
15
|
+
jobshop_route << %Q(, class_name: "#{class_name}") if class_name.include?("::")
|
16
|
+
route jobshop_route
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/jobshop.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require "rails"
|
2
|
+
require "rails/all"
|
3
|
+
require "jobshop/engine"
|
4
|
+
|
5
|
+
module Jobshop
|
6
|
+
class << self
|
7
|
+
attr_writer :configuration
|
8
|
+
end
|
9
|
+
|
10
|
+
# @example
|
11
|
+
# Jobshop.configuration.user_model = "User"
|
12
|
+
def self.configuration
|
13
|
+
@configuration ||= Configuration.new
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
# Yields the global configuration to a block.
|
18
|
+
# @yield [Configuration] global configuration
|
19
|
+
#
|
20
|
+
# @example
|
21
|
+
# Jobshop.configure do |config|
|
22
|
+
# config.user_model = "User"
|
23
|
+
# end
|
24
|
+
def self.configure
|
25
|
+
yield configuration if block_given?
|
26
|
+
end
|
27
|
+
|
28
|
+
class Configuration
|
29
|
+
attr_accessor :user_model
|
30
|
+
|
31
|
+
def initialize
|
32
|
+
@user_model = "User"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/spec/dummy/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# Action Cable provides the framework to deal with WebSockets in Rails.
|
2
|
+
# You can generate new channels where WebSocket features live using the rails generate channel command.
|
3
|
+
#
|
4
|
+
# Turn on the cable connection by removing the comments after the require statements (and ensure it's also on in config/routes.rb).
|
5
|
+
#
|
6
|
+
#= require action_cable
|
7
|
+
#= require_self
|
8
|
+
#= require_tree ./channels
|
9
|
+
#
|
10
|
+
# @App ||= {}
|
11
|
+
# App.cable = ActionCable.createConsumer()
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
+
* It is generally better to create a new file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= csrf_meta_tags %>
|
6
|
+
<%= action_cable_meta_tag %>
|
7
|
+
|
8
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
9
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
10
|
+
</head>
|
11
|
+
|
12
|
+
<body>
|
13
|
+
<%= yield %>
|
14
|
+
</body>
|
15
|
+
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield %>
|
data/spec/dummy/bin/rake
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
require 'fileutils'
|
4
|
+
include FileUtils
|
5
|
+
|
6
|
+
# path to your application root.
|
7
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
8
|
+
|
9
|
+
def system!(*args)
|
10
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
11
|
+
end
|
12
|
+
|
13
|
+
chdir APP_ROOT do
|
14
|
+
# This script is a starting point to setup your application.
|
15
|
+
# Add necessary setup steps to this file.
|
16
|
+
|
17
|
+
puts '== Installing dependencies =='
|
18
|
+
system! 'gem install bundler --conservative'
|
19
|
+
system('bundle check') or system!('bundle install')
|
20
|
+
|
21
|
+
# puts "\n== Copying sample files =="
|
22
|
+
# unless File.exist?('config/database.yml')
|
23
|
+
# cp 'config/database.yml.sample', 'config/database.yml'
|
24
|
+
# end
|
25
|
+
|
26
|
+
puts "\n== Preparing database =="
|
27
|
+
system! 'bin/rails db:setup'
|
28
|
+
|
29
|
+
puts "\n== Removing old logs and tempfiles =="
|
30
|
+
system! 'bin/rails log:clear tmp:clear'
|
31
|
+
|
32
|
+
puts "\n== Restarting application server =="
|
33
|
+
system! 'bin/rails restart'
|
34
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
require 'fileutils'
|
4
|
+
include FileUtils
|
5
|
+
|
6
|
+
# path to your application root.
|
7
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
8
|
+
|
9
|
+
def system!(*args)
|
10
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
11
|
+
end
|
12
|
+
|
13
|
+
chdir APP_ROOT do
|
14
|
+
# This script is a way to update your development environment automatically.
|
15
|
+
# Add necessary update steps to this file.
|
16
|
+
|
17
|
+
puts '== Installing dependencies =='
|
18
|
+
system! 'gem install bundler --conservative'
|
19
|
+
system 'bundle check' or system! 'bundle install'
|
20
|
+
|
21
|
+
puts "\n== Updating database =="
|
22
|
+
system! 'bin/rails db:migrate'
|
23
|
+
|
24
|
+
puts "\n== Removing old logs and tempfiles =="
|
25
|
+
system! 'bin/rails log:clear tmp:clear'
|
26
|
+
|
27
|
+
puts "\n== Restarting application server =="
|
28
|
+
system! 'bin/rails restart'
|
29
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
# Pick the frameworks you want:
|
4
|
+
require "active_record/railtie"
|
5
|
+
require "action_controller/railtie"
|
6
|
+
require "action_mailer/railtie"
|
7
|
+
require "action_view/railtie"
|
8
|
+
require "sprockets/railtie"
|
9
|
+
# require "rails/test_unit/railtie"
|
10
|
+
|
11
|
+
Bundler.require(*Rails.groups)
|
12
|
+
require "jobshop"
|
13
|
+
|
14
|
+
module Dummy
|
15
|
+
class Application < Rails::Application
|
16
|
+
# Settings in config/environments/* take precedence over those specified here.
|
17
|
+
# Application configuration should go into files in config/initializers
|
18
|
+
# -- all .rb files in that directory are automatically loaded.
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|