jobshop 0.0.1 → 0.0.2

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: e8dd341e2ba7adfa2333156f2f2c1a5e4cbb659a
4
- data.tar.gz: 3b9cbdb9e8a85ef3ec3d4a9e24307274f6f62523
3
+ metadata.gz: 876e6aee1405334c14052d549fcc6ddc88cfb550
4
+ data.tar.gz: 0395d324483a6a56d74d5987a7d3a5c3ba522833
5
5
  SHA512:
6
- metadata.gz: 39d8abbdc0431f50a4670d44b2ed6dcb5e6f0590e10932592ddac1954bc169005906127459395e53d81e73e73dd47616b0fed49f25a503c5eed1e431fd640d68
7
- data.tar.gz: 65e70535a961a98cc7b42ce2dc36bf6624817d2d9139da3db3d6bf692ef07c3c7cd26537a86e4333fce09e47117d1b19d9b3c47e1d870c47180ad26f0a1b5256
6
+ metadata.gz: 9de754c9dc0a2abaa61711392edbb8e25859b98f26ecef30d94b5270311eb64e37a816975d9ad5df62ad187c8349edc4dc3bdeab64bcbf41b1d39cbfccee5b1d
7
+ data.tar.gz: 0ff782a7bb0957e8302dc0522bbaccc13131ecbe4f2d234dadd275d7fd562f4a37b95f77732837a66cb430e1c6d4b0988893a7ddeb9a224a6141bbd7b74ba949
data/README.md CHANGED
@@ -22,20 +22,19 @@ Once Jobshop has been installed you can configure it by running the generator:
22
22
  % rails generate jobshop:config
23
23
  ```
24
24
 
25
- The generator will install an initializer which describes ALL of Jobshop's configuration options.
25
+ The generator will install an initializer which describes Jobshop's configuration options.
26
26
 
27
- Add Jobshop to your model using the generator:
27
+ Next mount the engine in `config/routes.rb`.
28
28
 
29
- ```console
30
- % rails generate jobshop MODEL
29
+ ```ruby
30
+ mount Jobshop::Engine => "/jobshop"
31
31
  ```
32
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
-
33
+ Fire up your server and navigate to localhost
35
34
 
36
35
  ## Bug Reports
37
36
  If you discover a problem with Jobshop, we would like to know about it.
38
37
 
39
- https://github.com/frankjmattia/jobshop/issues
38
+ [https://github.com/frankjmattia/jobshop/issues](https://github.com/frankjmattia/jobshop/issues)
40
39
 
41
- If you discover a security related bug, please do NOT use the GitHub issue tracker. Send an email to frankjmattia@jobshop.io
40
+ If you discover a security related bug, please do NOT use the GitHub issue tracker. Send an email to [frankjmattia@jobshop.io](mailto:frankjmattia@jobshop.io)
data/config/routes.rb CHANGED
@@ -1,2 +1,3 @@
1
1
  Jobshop::Engine.routes.draw do
2
+ get "/about" => redirect("https://jobshop.io"), as: :about_jobshop
2
3
  end
@@ -1,3 +1,5 @@
1
+ require "rails/generators/base"
2
+
1
3
  module Jobshop
2
4
  module Generators
3
5
  class ConfigGenerator < Rails::Generators::Base
@@ -5,15 +7,6 @@ module Jobshop
5
7
 
6
8
  desc "Creates a Jobshop initializer."
7
9
 
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
10
  def copy_template
18
11
  template "jobshop.rb.tt", "config/initializers/jobshop.rb"
19
12
  end
@@ -6,7 +6,7 @@ module Jobshop
6
6
  module VERSION
7
7
  MAJOR = 0
8
8
  MINOR = 0
9
- TINY = 1
9
+ TINY = 2
10
10
  PRE = nil
11
11
 
12
12
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
@@ -1,4 +1,5 @@
1
1
  Rails.application.routes.draw do
2
+ mount Jobshop::Engine => "/"
2
3
  # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
3
4
 
4
5
  # Serve websocket cable requests in-process
@@ -0,0 +1,19 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended that you check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(version: 0) do
15
+
16
+ # These are extensions that must be enabled in order to support this database
17
+ enable_extension "plpgsql"
18
+
19
+ end
@@ -0,0 +1,17 @@
1
+ require "rails_helper"
2
+ require "generator_spec"
3
+
4
+ require "generators/jobshop/config/config_generator"
5
+
6
+ RSpec.describe Jobshop::Generators::ConfigGenerator, type: :generator do
7
+ destination File.expand_path("../../../tmp", __FILE__)
8
+
9
+ before do
10
+ prepare_destination
11
+ run_generator
12
+ end
13
+
14
+ it "copies the initializer" do
15
+ assert_file "config/initializers/jobshop.rb"
16
+ end
17
+ end
data/spec/rails_helper.rb CHANGED
@@ -5,8 +5,9 @@ require File.expand_path('../dummy/config/environment', __FILE__)
5
5
  abort("The Rails environment is running in production mode!") if Rails.env.production?
6
6
  require 'spec_helper'
7
7
  require 'rspec/rails'
8
+
8
9
  # Add additional requires below this line. Rails is not loaded until this point!
9
- puts "hi"
10
+
10
11
  # Requires supporting ruby files with custom matchers and macros, etc, in
11
12
  # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
12
13
  # run as spec files by default. This means that files in spec/support that end
@@ -28,7 +29,7 @@ ActiveRecord::Migration.maintain_test_schema!
28
29
 
29
30
  RSpec.configure do |config|
30
31
  # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
31
- config.fixture_path = "#{::Rails.root}/spec/fixtures"
32
+ # config.fixture_path = "#{::Rails.root}/spec/fixtures"
32
33
 
33
34
  # If you're not using ActiveRecord, or you'd prefer not to run each of your
34
35
  # examples within a transaction, remove the following line or assign false
@@ -48,7 +49,7 @@ RSpec.configure do |config|
48
49
  #
49
50
  # The different available types are documented in the features, such as in
50
51
  # https://relishapp.com/rspec/rspec-rails/docs
51
- config.infer_spec_type_from_file_location!
52
+ # config.infer_spec_type_from_file_location!
52
53
 
53
54
  # Filter lines from Rails gems in backtraces.
54
55
  config.filter_rails_from_backtrace!
@@ -0,0 +1,12 @@
1
+ require "rails_helper"
2
+
3
+ RSpec.describe "/about", type: :request do
4
+ before(:each) do
5
+ @routes = Jobshop::Engine.routes
6
+ end
7
+
8
+ it "redirects /about to https://jobshop.io" do
9
+ get "/about"
10
+ expect(response).to redirect_to("https://jobshop.io")
11
+ end
12
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jobshop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frank J. Mattia
@@ -44,6 +44,20 @@ dependencies:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0.18'
47
+ - !ruby/object:Gem::Dependency
48
+ name: generator_spec
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '0.9'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '0.9'
47
61
  description: Continuously monitor and improve your manufacturing process.
48
62
  email:
49
63
  - frankjmattia@gmail.com
@@ -64,13 +78,9 @@ files:
64
78
  - app/models/application_record.rb
65
79
  - app/views/layouts/jobshop/application.html.erb
66
80
  - config/routes.rb
67
- - lib/generators/active_record/jobshop_generator.rb
68
- - lib/generators/active_record/templates/migration.rb.tt
69
- - lib/generators/active_record/templates/migration_existing.rb.tt
70
81
  - lib/generators/jobshop/config/config_generator.rb
71
82
  - lib/generators/jobshop/config/templates/jobshop.rb.tt
72
83
  - lib/generators/jobshop/orm_helpers.rb
73
- - lib/generators/jobshop_generator.rb
74
84
  - lib/jobshop.rb
75
85
  - lib/jobshop/engine.rb
76
86
  - lib/jobshop/version.rb
@@ -120,12 +130,14 @@ files:
120
130
  - spec/dummy/config/redis/cable.yml
121
131
  - spec/dummy/config/routes.rb
122
132
  - spec/dummy/config/secrets.yml
123
- - spec/dummy/log/development.log
133
+ - spec/dummy/db/schema.rb
124
134
  - spec/dummy/public/404.html
125
135
  - spec/dummy/public/422.html
126
136
  - spec/dummy/public/500.html
127
137
  - spec/dummy/public/favicon.ico
138
+ - spec/generators/config_generator_spec.rb
128
139
  - spec/rails_helper.rb
140
+ - spec/requests/about_spec.rb
129
141
  - spec/spec_helper.rb
130
142
  homepage: https://jobshop.io
131
143
  licenses:
@@ -196,11 +208,13 @@ test_files:
196
208
  - spec/dummy/config/routes.rb
197
209
  - spec/dummy/config/secrets.yml
198
210
  - spec/dummy/config.ru
199
- - spec/dummy/log/development.log
211
+ - spec/dummy/db/schema.rb
200
212
  - spec/dummy/public/404.html
201
213
  - spec/dummy/public/422.html
202
214
  - spec/dummy/public/500.html
203
215
  - spec/dummy/public/favicon.ico
204
216
  - spec/dummy/Rakefile
217
+ - spec/generators/config_generator_spec.rb
205
218
  - spec/rails_helper.rb
219
+ - spec/requests/about_spec.rb
206
220
  - spec/spec_helper.rb
@@ -1,46 +0,0 @@
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
@@ -1,8 +0,0 @@
1
- class JobshopCreate<%= table_name.camelize %> < ActiveRecord::Migration
2
- def change
3
- enable_extension("pgcrypto")
4
- create_table(:<%= table_name %>, id: :uuid, default: gen_random_uuid()) do |t|
5
- t.timestamps
6
- end
7
- end
8
- end
@@ -1,10 +0,0 @@
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
@@ -1,20 +0,0 @@
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
@@ -1,64 +0,0 @@
1
-
2
-
3
- Started GET "/" for ::1 at 2016-01-06 21:54:32 -0500
4
-
5
- ActiveRecord::NoDatabaseError (FATAL: database "dummy_development" does not exist
6
- ):
7
- activerecord (5.0.0.beta1) lib/active_record/connection_adapters/postgresql_adapter.rb:652:in `rescue in connect'
8
- activerecord (5.0.0.beta1) lib/active_record/connection_adapters/postgresql_adapter.rb:642:in `connect'
9
- activerecord (5.0.0.beta1) lib/active_record/connection_adapters/postgresql_adapter.rb:211:in `initialize'
10
- activerecord (5.0.0.beta1) lib/active_record/connection_adapters/postgresql_adapter.rb:38:in `new'
11
- activerecord (5.0.0.beta1) lib/active_record/connection_adapters/postgresql_adapter.rb:38:in `postgresql_connection'
12
- activerecord (5.0.0.beta1) lib/active_record/connection_adapters/abstract/connection_pool.rb:721:in `new_connection'
13
- activerecord (5.0.0.beta1) lib/active_record/connection_adapters/abstract/connection_pool.rb:765:in `checkout_new_connection'
14
- activerecord (5.0.0.beta1) lib/active_record/connection_adapters/abstract/connection_pool.rb:744:in `try_to_checkout_new_connection'
15
- activerecord (5.0.0.beta1) lib/active_record/connection_adapters/abstract/connection_pool.rb:705:in `acquire_connection'
16
- activerecord (5.0.0.beta1) lib/active_record/connection_adapters/abstract/connection_pool.rb:501:in `checkout'
17
- activerecord (5.0.0.beta1) lib/active_record/connection_adapters/abstract/connection_pool.rb:364:in `connection'
18
- activerecord (5.0.0.beta1) lib/active_record/connection_adapters/abstract/connection_pool.rb:879:in `retrieve_connection'
19
- activerecord (5.0.0.beta1) lib/active_record/connection_handling.rb:113:in `retrieve_connection'
20
- activerecord (5.0.0.beta1) lib/active_record/connection_handling.rb:87:in `connection'
21
- activerecord (5.0.0.beta1) lib/active_record/migration.rb:530:in `connection'
22
- activerecord (5.0.0.beta1) lib/active_record/migration.rb:517:in `call'
23
- actionpack (5.0.0.beta1) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
24
- activesupport (5.0.0.beta1) lib/active_support/callbacks.rb:97:in `__run_callbacks__'
25
- activesupport (5.0.0.beta1) lib/active_support/callbacks.rb:750:in `_run_call_callbacks'
26
- activesupport (5.0.0.beta1) lib/active_support/callbacks.rb:90:in `run_callbacks'
27
- actionpack (5.0.0.beta1) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
28
- actionpack (5.0.0.beta1) lib/action_dispatch/middleware/reloader.rb:71:in `call'
29
- actionpack (5.0.0.beta1) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
30
- actionpack (5.0.0.beta1) lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call'
31
- actionpack (5.0.0.beta1) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
32
- railties (5.0.0.beta1) lib/rails/rack/logger.rb:42:in `call_app'
33
- railties (5.0.0.beta1) lib/rails/rack/logger.rb:24:in `block in call'
34
- activesupport (5.0.0.beta1) lib/active_support/tagged_logging.rb:70:in `block in tagged'
35
- activesupport (5.0.0.beta1) lib/active_support/tagged_logging.rb:26:in `tagged'
36
- activesupport (5.0.0.beta1) lib/active_support/tagged_logging.rb:70:in `tagged'
37
- railties (5.0.0.beta1) lib/rails/rack/logger.rb:24:in `call'
38
- actionpack (5.0.0.beta1) lib/action_dispatch/middleware/request_id.rb:24:in `call'
39
- rack (2.0.0.alpha) lib/rack/method_override.rb:22:in `call'
40
- rack (2.0.0.alpha) lib/rack/runtime.rb:22:in `call'
41
- activesupport (5.0.0.beta1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
42
- actionpack (5.0.0.beta1) lib/action_dispatch/middleware/load_interlock.rb:13:in `call'
43
- actionpack (5.0.0.beta1) lib/action_dispatch/middleware/static.rb:132:in `call'
44
- rack (2.0.0.alpha) lib/rack/sendfile.rb:111:in `call'
45
- railties (5.0.0.beta1) lib/rails/engine.rb:522:in `call'
46
- rack (2.0.0.alpha) lib/rack/handler/webrick.rb:86:in `service'
47
- /Users/frankjmattia/.rbenv/versions/2.3.0/lib/ruby/2.3.0/webrick/httpserver.rb:140:in `service'
48
- /Users/frankjmattia/.rbenv/versions/2.3.0/lib/ruby/2.3.0/webrick/httpserver.rb:96:in `run'
49
- /Users/frankjmattia/.rbenv/versions/2.3.0/lib/ruby/2.3.0/webrick/server.rb:296:in `block in start_thread'
50
-
51
-
52
- Rendered /Users/frankjmattia/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.0.beta1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (3.5ms)
53
- Rendered /Users/frankjmattia/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.0.beta1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.5ms)
54
- Rendered /Users/frankjmattia/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.0.beta1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.1ms)
55
- Rendered /Users/frankjmattia/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-5.0.0.beta1/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (45.8ms)
56
-  (22.3ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL) 
57
-  (1.6ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
58
-  (0.2ms) SELECT pg_try_advisory_lock(1721091371569202325);
59
- ActiveRecord::SchemaMigration Load (0.4ms) SELECT "schema_migrations".* FROM "schema_migrations"
60
- Migrating to AddDeviseToUsers (20160104092148)
61
-  (0.1ms) BEGIN
62
-  (6.3ms) ALTER TABLE "users" ADD "email" character varying DEFAULT '' NOT NULL
63
-  (0.1ms) ROLLBACK
64
-  (0.2ms) SELECT pg_advisory_unlock(1721091371569202325)