jobs 0.0.1 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +5 -13
  2. data/.ruby-version +1 -0
  3. data/README.md +14 -5
  4. data/Rakefile +30 -6
  5. data/app/assets/images/jobs/.keep +0 -0
  6. data/app/assets/javascripts/jobs/application.js +13 -0
  7. data/app/assets/javascripts/jobs/jobs.js +2 -0
  8. data/app/assets/stylesheets/jobs/application.css +15 -0
  9. data/app/assets/stylesheets/jobs/jobs.css +4 -0
  10. data/app/assets/stylesheets/scaffold.css +56 -0
  11. data/app/controllers/jobs/application_controller.rb +4 -0
  12. data/app/controllers/jobs/jobs_controller.rb +62 -0
  13. data/app/helpers/jobs/application_helper.rb +4 -0
  14. data/app/helpers/jobs/jobs_helper.rb +4 -0
  15. data/app/models/jobs/job.rb +4 -0
  16. data/app/views/jobs/jobs/_form.html.erb +37 -0
  17. data/app/views/jobs/jobs/edit.html.erb +6 -0
  18. data/app/views/jobs/jobs/index.html.erb +33 -0
  19. data/app/views/jobs/jobs/new.html.erb +5 -0
  20. data/app/views/jobs/jobs/show.html.erb +29 -0
  21. data/app/views/layouts/jobs/application.html.erb +14 -0
  22. data/bin/rails +12 -0
  23. data/config/routes.rb +4 -0
  24. data/db/migrate/20141102175536_create_jobs_jobs.rb +13 -0
  25. data/jobs.gemspec +13 -3
  26. data/lib/jobs.rb +1 -1
  27. data/lib/jobs/engine.rb +5 -0
  28. data/lib/jobs/version.rb +1 -1
  29. data/lib/tasks/jobs_tasks.rake +9 -0
  30. data/spec/jobs_spec.rb +20 -2
  31. data/test/controllers/jobs/jobs_controller_test.rb +51 -0
  32. data/test/dummy/README.rdoc +28 -0
  33. data/test/dummy/Rakefile +6 -0
  34. data/test/dummy/app/assets/images/.keep +0 -0
  35. data/test/dummy/app/assets/javascripts/application.js +13 -0
  36. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  37. data/test/dummy/app/controllers/application_controller.rb +5 -0
  38. data/test/dummy/app/controllers/concerns/.keep +0 -0
  39. data/test/dummy/app/helpers/application_helper.rb +2 -0
  40. data/test/dummy/app/mailers/.keep +0 -0
  41. data/test/dummy/app/models/.keep +0 -0
  42. data/test/dummy/app/models/concerns/.keep +0 -0
  43. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  44. data/test/dummy/bin/bundle +3 -0
  45. data/test/dummy/bin/rails +4 -0
  46. data/test/dummy/bin/rake +4 -0
  47. data/test/dummy/config.ru +4 -0
  48. data/test/dummy/config/application.rb +23 -0
  49. data/test/dummy/config/boot.rb +5 -0
  50. data/test/dummy/config/database.yml +25 -0
  51. data/test/dummy/config/environment.rb +5 -0
  52. data/test/dummy/config/environments/development.rb +37 -0
  53. data/test/dummy/config/environments/production.rb +82 -0
  54. data/test/dummy/config/environments/test.rb +39 -0
  55. data/test/dummy/config/initializers/assets.rb +8 -0
  56. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  57. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  58. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  59. data/test/dummy/config/initializers/inflections.rb +16 -0
  60. data/test/dummy/config/initializers/mime_types.rb +4 -0
  61. data/test/dummy/config/initializers/session_store.rb +3 -0
  62. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  63. data/test/dummy/config/locales/en.yml +23 -0
  64. data/test/dummy/config/routes.rb +4 -0
  65. data/test/dummy/config/secrets.yml +22 -0
  66. data/test/dummy/db/development.sqlite3 +0 -0
  67. data/test/dummy/db/production.sqlite3 +0 -0
  68. data/test/dummy/db/schema.rb +26 -0
  69. data/test/dummy/db/test.sqlite3 +0 -0
  70. data/test/dummy/lib/assets/.keep +0 -0
  71. data/test/dummy/log/.keep +0 -0
  72. data/test/dummy/log/test.log +284 -0
  73. data/test/dummy/public/404.html +67 -0
  74. data/test/dummy/public/422.html +67 -0
  75. data/test/dummy/public/500.html +66 -0
  76. data/test/dummy/public/favicon.ico +0 -0
  77. data/test/dummy/tmp/cache/assets/test/sprockets/34a5299fd5516643b34a7a3383ad8dea +0 -0
  78. data/test/dummy/tmp/cache/assets/test/sprockets/3e9a8d2c878538ac7918cc051038b449 +0 -0
  79. data/test/dummy/tmp/cache/assets/test/sprockets/5ca2db0e669c24a7441fc383b8084270 +0 -0
  80. data/test/dummy/tmp/cache/assets/test/sprockets/5ef710f3ce193913ccba1491b54852ef +0 -0
  81. data/test/dummy/tmp/cache/assets/test/sprockets/714583cfa15997bd320c61d1f185fe4b +0 -0
  82. data/test/dummy/tmp/cache/assets/test/sprockets/9b2173533a1385aae7c2dbb457253ffb +0 -0
  83. data/test/dummy/tmp/cache/assets/test/sprockets/e99940d73e2da7cac5ba06f4cbc1e0ec +0 -0
  84. data/test/dummy/tmp/cache/assets/test/sprockets/f258cf7f22278073449e1b15898967ae +0 -0
  85. data/test/dummy/tmp/cache/assets/test/sprockets/fc53e4ef0d375dae41c0b9a5ff946b74 +0 -0
  86. data/test/dummy/tmp/cache/assets/test/sprockets/fe3be59013dd28ce7524b1f49f110cb4 +0 -0
  87. data/test/fixtures/jobs/jobs.yml +15 -0
  88. data/test/helpers/jobs/jobs_helper_test.rb +6 -0
  89. data/test/integration/navigation_test.rb +10 -0
  90. data/test/jobs_test.rb +7 -0
  91. data/test/models/jobs/job_test.rb +9 -0
  92. data/test/test_helper.rb +28 -0
  93. metadata +207 -31
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MDQ5OWI0YWEzNjFhMGFkNzlkZjY1YjcwZDY1MGY2MDRiY2VkNzJhOA==
5
- data.tar.gz: !binary |-
6
- ZDE4ZWFiNjk4OGM2YjNkYWNhYzJhY2MxOGQ3ZTVjNDExMTEwMGZhYQ==
2
+ SHA1:
3
+ metadata.gz: 1c6cfff0b8f6f28dee0696fec4a66971cbfe991b
4
+ data.tar.gz: 59a0e2a9cea787556ff41b44e2d2da912c42a01d
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- ODkxNmQ5OTAxZDNhNWE2MGE5NDRiZDkzZGMwMDk4NGJhMjU0OTRiMGY5M2Ey
10
- MGVhZWE4NDZlYWE0ZGY0NGE5OTZkZWMxNTk0NTJhNTc2NGYzNjk2ZTI1MjNh
11
- NTRlNTA0MjE3NTNlMGJlMmJhZWRiZGQ4YzY4ZDlhYjE4MDBjMTk=
12
- data.tar.gz: !binary |-
13
- Njc4MDU2NjZmMmFjMTVlODk2OWVkNWNmNzA4NDU4ZTk1MGFlY2IxNTdmZDEy
14
- MDBiZmZjZDMyODc5MTI4NWU5MDdmMmZlMTA3YjIyMWRmMTIxYjc0YjI4NTEx
15
- Nzg5ZDA2ZGE0NGJkMTQ0ZjgxZWE5OGQ5NDM2NWZjZTYwMzJkMmY=
6
+ metadata.gz: 0fe349ccab878937d53b93ede3d7a6ac6f0dbe69d0d2be790aae41ed3d7d615ee2b2a03c59b561e68bdfb89880c0395820cae2ef1b98fdc5ad5a189ecafa2912
7
+ data.tar.gz: 8f4daa8fcf663c75cde3c6ae3bc3fd1dfffc977397e81ddc163f8ffc46c3256deafbe5de459d19fc15cb6b909eba8447b4d1c273a7cbc01c24a7b0bd365eab97
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.1.2
data/README.md CHANGED
@@ -1,6 +1,11 @@
1
1
  # Jobs
2
2
 
3
- TODO: Write a gem description
3
+ The jobs gem is focused with managing jobs in a Rails 4.x application and adds a persisted jobs table to your store.
4
+ It offers a 'public' searchable index of vacancies - and an admin interface to signed in users for adding, editing and deleting jobs.
5
+
6
+ The jobs gem does not require you to install other gems - but if you do install the 'jobber' gem, it will show a sidebar on the public
7
+ index if the jobber is signed in, with jobs currently assigned to the jobber. And likewise on the admin index; any selected job will show
8
+ the jobber(s) assigned to the job.
4
9
 
5
10
  ## Current state
6
11
 
@@ -15,7 +20,7 @@ TODO: Write a gem description
15
20
  Add this line to your application's Gemfile:
16
21
 
17
22
  ```ruby
18
- gem 'jobs'
23
+ gem 'jobs', path: "vendor/engines/jobs"
19
24
  ```
20
25
 
21
26
  And then execute:
@@ -32,7 +37,7 @@ TODO: Write usage instructions here
32
37
 
33
38
  ## Contributing
34
39
 
35
- 1. Fork it ( https://github.com/[my-github-username]/jobs/fork )
40
+ 1. Fork it ( https://github.com/wdiechmann/jobs/fork )
36
41
  2. Create your feature branch (`git checkout -b my-new-feature`)
37
42
  3. Commit your changes (`git commit -am 'Add some feature'`)
38
43
  4. Push to the branch (`git push origin my-new-feature`)
@@ -40,7 +45,10 @@ TODO: Write usage instructions here
40
45
 
41
46
  ## Building the gem
42
47
 
43
- 1. install or update bundler
48
+ Documenting the build process is instructional only - it has no influence on how the gem works and you do not have to
49
+ complete any of these tasks to use the gem!
50
+
51
+ 1. install or update bundler, ruby and rubygems respectively
44
52
  2. run `bundle gem jobs`
45
53
  3. add dependencies to jobs/jobs.gemspec
46
54
  4. add task to Rakefile
@@ -58,4 +66,5 @@ TODO: Write usage instructions here
58
66
  16. do a first release with
59
67
  - rake build
60
68
  - rake install
61
- - rake release
69
+ - rake release
70
+ 17. make the gem a mountable Rails Engine - following the [Rails Engine Guide](http://edgeguides.rubyonrails.org/engines.html) transposing the blorgh to jobs
data/Rakefile CHANGED
@@ -1,10 +1,34 @@
1
- require 'rspec/core/rake_task'
2
1
  require 'bundler/gem_tasks'
2
+ Dir.glob('lib/tasks/**/*.rake').each(&method(:import))
3
+ #
4
+ begin
5
+ require 'bundler/setup'
6
+ rescue LoadError
7
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
8
+ end
9
+
10
+ require 'rdoc/task'
11
+
12
+ RDoc::Task.new(:rdoc) do |rdoc|
13
+ rdoc.rdoc_dir = 'rdoc'
14
+ rdoc.title = 'Jobs'
15
+ rdoc.options << '--line-numbers'
16
+ rdoc.rdoc_files.include('README.rdoc')
17
+ rdoc.rdoc_files.include('lib/**/*.rb')
18
+ end
19
+
20
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
21
+ load 'rails/tasks/engine.rake'
22
+
23
+ # Bundler::GemHelper.install_tasks
24
+
25
+ require 'rake/testtask'
3
26
 
4
- # Default directory to look in is `/specs`
5
- # Run with `rake spec`
6
- RSpec::Core::RakeTask.new(:spec) do |task|
7
- task.rspec_opts = ['--color', '--format', 'nested']
27
+ Rake::TestTask.new(:test) do |t|
28
+ t.libs << 'lib'
29
+ t.libs << 'test'
30
+ t.pattern = 'test/**/*_test.rb'
31
+ t.verbose = false
8
32
  end
9
33
 
10
- task :default => :spec
34
+ task default: :test
File without changes
@@ -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 vendor/assets/javascripts of plugins, if any, 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.
9
+ //
10
+ // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -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 vendor/assets/stylesheets of plugins, if any, 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 styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,56 @@
1
+ body { background-color: #fff; color: #333; }
2
+
3
+ body, p, ol, ul, td {
4
+ font-family: verdana, arial, helvetica, sans-serif;
5
+ font-size: 13px;
6
+ line-height: 18px;
7
+ }
8
+
9
+ pre {
10
+ background-color: #eee;
11
+ padding: 10px;
12
+ font-size: 11px;
13
+ }
14
+
15
+ a { color: #000; }
16
+ a:visited { color: #666; }
17
+ a:hover { color: #fff; background-color:#000; }
18
+
19
+ div.field, div.actions {
20
+ margin-bottom: 10px;
21
+ }
22
+
23
+ #notice {
24
+ color: green;
25
+ }
26
+
27
+ .field_with_errors {
28
+ padding: 2px;
29
+ background-color: red;
30
+ display: table;
31
+ }
32
+
33
+ #error_explanation {
34
+ width: 450px;
35
+ border: 2px solid red;
36
+ padding: 7px;
37
+ padding-bottom: 0;
38
+ margin-bottom: 20px;
39
+ background-color: #f0f0f0;
40
+ }
41
+
42
+ #error_explanation h2 {
43
+ text-align: left;
44
+ font-weight: bold;
45
+ padding: 5px 5px 5px 15px;
46
+ font-size: 12px;
47
+ margin: -7px;
48
+ margin-bottom: 0px;
49
+ background-color: #c00;
50
+ color: #fff;
51
+ }
52
+
53
+ #error_explanation ul li {
54
+ font-size: 12px;
55
+ list-style: square;
56
+ }
@@ -0,0 +1,4 @@
1
+ module Jobs
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,62 @@
1
+ require_dependency "jobs/application_controller"
2
+
3
+ module Jobs
4
+ class JobsController < ApplicationController
5
+ before_action :set_job, only: [:show, :edit, :update, :destroy]
6
+
7
+ # GET /jobs
8
+ def index
9
+ @jobs = Job.all
10
+ end
11
+
12
+ # GET /jobs/1
13
+ def show
14
+ end
15
+
16
+ # GET /jobs/new
17
+ def new
18
+ @job = Job.new
19
+ end
20
+
21
+ # GET /jobs/1/edit
22
+ def edit
23
+ end
24
+
25
+ # POST /jobs
26
+ def create
27
+ @job = Job.new(job_params)
28
+
29
+ if @job.save
30
+ redirect_to @job, notice: 'Job was successfully created.'
31
+ else
32
+ render :new
33
+ end
34
+ end
35
+
36
+ # PATCH/PUT /jobs/1
37
+ def update
38
+ if @job.update(job_params)
39
+ redirect_to @job, notice: 'Job was successfully updated.'
40
+ else
41
+ render :edit
42
+ end
43
+ end
44
+
45
+ # DELETE /jobs/1
46
+ def destroy
47
+ @job.destroy
48
+ redirect_to jobs_url, notice: 'Job was successfully destroyed.'
49
+ end
50
+
51
+ private
52
+ # Use callbacks to share common setup or constraints between actions.
53
+ def set_job
54
+ @job = Job.find(params[:id])
55
+ end
56
+
57
+ # Only allow a trusted parameter "white list" through.
58
+ def job_params
59
+ params.require(:job).permit(:where_to, :when_to, :how_to, :who_to, :description)
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,4 @@
1
+ module Jobs
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Jobs
2
+ module JobsHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Jobs
2
+ class Job < ActiveRecord::Base
3
+ end
4
+ end
@@ -0,0 +1,37 @@
1
+ <%= form_for(@job) do |f| %>
2
+ <% if @job.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@job.errors.count, "error") %> prohibited this job from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @job.errors.full_messages.each do |message| %>
8
+ <li><%= message %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="field">
15
+ <%= f.label :where_to %><br>
16
+ <%= f.text_field :where_to %>
17
+ </div>
18
+ <div class="field">
19
+ <%= f.label :when_to %><br>
20
+ <%= f.text_field :when_to %>
21
+ </div>
22
+ <div class="field">
23
+ <%= f.label :how_to %><br>
24
+ <%= f.text_field :how_to %>
25
+ </div>
26
+ <div class="field">
27
+ <%= f.label :who_to %><br>
28
+ <%= f.text_field :who_to %>
29
+ </div>
30
+ <div class="field">
31
+ <%= f.label :description %><br>
32
+ <%= f.text_area :description %>
33
+ </div>
34
+ <div class="actions">
35
+ <%= f.submit %>
36
+ </div>
37
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <h1>Editing job</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Show', @job %> |
6
+ <%= link_to 'Back', jobs_path %>
@@ -0,0 +1,33 @@
1
+ <h1>Listing jobs</h1>
2
+
3
+ <table>
4
+ <thead>
5
+ <tr>
6
+ <th>Where to</th>
7
+ <th>When to</th>
8
+ <th>How to</th>
9
+ <th>Who to</th>
10
+ <th>Description</th>
11
+ <th colspan="3"></th>
12
+ </tr>
13
+ </thead>
14
+
15
+ <tbody>
16
+ <% @jobs.each do |job| %>
17
+ <tr>
18
+ <td><%= job.where_to %></td>
19
+ <td><%= job.when_to %></td>
20
+ <td><%= job.how_to %></td>
21
+ <td><%= job.who_to %></td>
22
+ <td><%= job.description %></td>
23
+ <td><%= link_to 'Show', job %></td>
24
+ <td><%= link_to 'Edit', edit_job_path(job) %></td>
25
+ <td><%= link_to 'Destroy', job, method: :delete, data: { confirm: 'Are you sure?' } %></td>
26
+ </tr>
27
+ <% end %>
28
+ </tbody>
29
+ </table>
30
+
31
+ <br>
32
+
33
+ <%= link_to 'New Job', new_job_path %>
@@ -0,0 +1,5 @@
1
+ <h1>New job</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Back', jobs_path %>
@@ -0,0 +1,29 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <p>
4
+ <strong>Where to:</strong>
5
+ <%= @job.where_to %>
6
+ </p>
7
+
8
+ <p>
9
+ <strong>When to:</strong>
10
+ <%= @job.when_to %>
11
+ </p>
12
+
13
+ <p>
14
+ <strong>How to:</strong>
15
+ <%= @job.how_to %>
16
+ </p>
17
+
18
+ <p>
19
+ <strong>Who to:</strong>
20
+ <%= @job.who_to %>
21
+ </p>
22
+
23
+ <p>
24
+ <strong>Description:</strong>
25
+ <%= @job.description %>
26
+ </p>
27
+
28
+ <%= link_to 'Edit', edit_job_path(@job) %> |
29
+ <%= link_to 'Back', jobs_path %>
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Jobs</title>
5
+ <%= stylesheet_link_tag "jobs/application", media: "all" %>
6
+ <%= javascript_include_tag "jobs/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
data/bin/rails ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 4 gems installed from the root of your application.
3
+
4
+ ENGINE_ROOT = File.expand_path('../..', __FILE__)
5
+ ENGINE_PATH = File.expand_path('../../lib/jobs/engine', __FILE__)
6
+
7
+ # Set up gems listed in the Gemfile.
8
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
9
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
10
+
11
+ require 'rails/all'
12
+ require 'rails/engine/commands'