jobshop 0.0.9 → 0.0.10

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: 2bd0bcde3a6f36b79899a911d0499199482ba12a
4
- data.tar.gz: 333ab400a210b72dc40aa7c854298ff0dbf42245
3
+ metadata.gz: 682c0ee84f3983c9b0008608ceaf935e8274954f
4
+ data.tar.gz: 8ccd26b27cde56d81cdca13d48731bb6f272cf88
5
5
  SHA512:
6
- metadata.gz: a92b671c57a17332ede5cdc3aaf19485cf2c40eb0434d20f893809e727cbd1ef0ad9a6210ebe3aeaeaa92a6cc5f233f19142d7729a35d5187c3fe880d605196b
7
- data.tar.gz: a8b51203f51fc9a4ce1a59936c624b0766f720c91fea0d1ed9643d6b2e084d0d840b7458245787149ad9587b62ba8709e5a5caa71b2ac94f1a77b4d0c1abbab3
6
+ metadata.gz: 50bc98ac77ef2d50da1dc9b0cf371f4816f373fe7c3527d58c6c32a86b332ffe92f6cd780231d2c7bd143272b88a5bbda2c7ef763ca01c492d11164b86dbe267
7
+ data.tar.gz: a65c6f4e5e1d72c5abb4e995b4c2890aa813d2c8124ccc89d44df9086f0fcd69fed2d5c82a4390c62fd88b0bbad24caf43e45ca2c3f09dd1f6070a01e1a7c565
data/README.md CHANGED
@@ -2,7 +2,9 @@
2
2
  _This README is also [available in a friendly, navigable format](http://documentup.com/jobshop/jobshop/)._
3
3
 
4
4
  [![Gem Version](https://badge.fury.io/rb/jobshop.svg)](https://badge.fury.io/rb/jobshop)
5
- [![Code Climate](https://codeclimate.com/github/frankjmattia/jobshop/badges/gpa.svg)](https://codeclimate.com/github/frankjmattia/jobshop)
5
+ [![Code Climate](https://codeclimate.com/github/jobshop/jobshop/badges/gpa.svg)](https://codeclimate.com/github/jobshop/jobshop)
6
+ [![Build Status](https://semaphoreci.com/api/v1/frankjmattia/jobshop/branches/master/shields_badge.svg)](https://semaphoreci.com/frankjmattia/jobshop)
7
+ [![Coverage Status](https://coveralls.io/repos/github/jobshop/jobshop/badge.svg?branch=master)](https://coveralls.io/github/jobshop/jobshop?branch=master)
6
8
 
7
9
  Real-time production tracking and process evaluation in the cloud - or under your own roof.
8
10
 
@@ -27,7 +29,7 @@ requests are always welcome.
27
29
 
28
30
  First, generate a new rails app and target the PostgreSQL adapter. The provided
29
31
  application template does all the heavy lifting. It adds Jobshop to your
30
- `Gemfile`, defines reasonable defaults in `config/secrets.yml` and a adds aroute
32
+ `Gemfile`, defines reasonable defaults in `config/secrets.yml` and adds a route
31
33
  for the `Jobshop::Engine` to `config/routes.rb`.
32
34
 
33
35
  ```console
data/Rakefile CHANGED
@@ -17,25 +17,17 @@ RDoc::Task.new(:rdoc) do |rdoc|
17
17
  rdoc.rdoc_files.include("lib/**/*.rb")
18
18
  end
19
19
 
20
- APP_RAKEFILE = File.expand_path("../spec/dummy-#{Rails::VERSION::STRING}/Rakefile", __FILE__)
20
+ require "jobshop/dummy_app"
21
21
 
22
- if File.exists?(APP_RAKEFILE)
23
- load "rails/tasks/engine.rake"
24
- else
25
- puts <<WARNING
26
- The Jobshop dummy app has not yet been generated at spec/dummy-(rails_version).
27
- Please run `rake jobshop:dummy` to generate it for development.
28
-
29
- WARNING
30
- end
22
+ APP_RAKEFILE = Jobshop::DummyApp.rakefile
31
23
 
24
+ load "rails/tasks/engine.rake" if File.exist?(APP_RAKEFILE)
32
25
  load "rails/tasks/statistics.rake"
33
26
 
34
27
  namespace :jobshop do
35
28
  desc "Create dummy app"
36
29
  task :dummy do
37
- require "jobshop/dummy"
38
- Jobshop::Dummy.generate
30
+ Jobshop::DummyApp.new
39
31
  end
40
32
  end
41
33
 
@@ -5,11 +5,11 @@ module Jobshop
5
5
  include RegistrationTokenValidation
6
6
 
7
7
  def new
8
- @registration = Jobshop::Registration.new(params)
8
+ @registration = ::Jobshop::Registration.new(params)
9
9
  end
10
10
 
11
11
  def create
12
- @registration = Jobshop::Registration.new(params)
12
+ @registration = ::Jobshop::Registration.new(params)
13
13
 
14
14
  if @registration.save
15
15
  sign_in_and_redirect(@registration.user)
@@ -2,7 +2,7 @@ module Jobshop
2
2
  class Registration < VirtualRecord
3
3
  memo_attr(:user) { team.users.build(user_params) }
4
4
  memo_attr(:team) {
5
- record = Jobshop::Team.find(params[:team_id])
5
+ record = ::Jobshop::Team.find(params[:team_id])
6
6
  record.assign_attributes(team_params)
7
7
  record
8
8
  }
@@ -1,6 +1,6 @@
1
1
  module Jobshop
2
2
  class Team < ApplicationRecord
3
- belongs_to :owner, class_name: "Jobshop::User"
3
+ belongs_to :owner, class_name: "Jobshop::User", optional: true
4
4
  has_many :users, class_name: "Jobshop::User"
5
5
  has_one :default_dashboard, class_name: "Jobshop::Dashboard"
6
6
 
@@ -4,7 +4,7 @@ module Jobshop
4
4
  # :confirmable, :lockable, :timeoutable and :omniauthable
5
5
  devise :database_authenticatable, :recoverable, :rememberable, :validatable
6
6
 
7
- belongs_to :team
7
+ belongs_to :team, optional: true
8
8
  has_one :default_dashboard, class_name: "Jobshop::Dashboard", through: :team
9
9
 
10
10
  validates_uniqueness_of :email
@@ -4,7 +4,7 @@ module Jobshop
4
4
  private
5
5
 
6
6
  def model_exists?
7
- File.exists?(File.join(destination_root, model_path))
7
+ File.exist?(File.join(destination_root, model_path))
8
8
  end
9
9
 
10
10
  def migration_exists?(table_name)
@@ -18,7 +18,7 @@ module Jobshop
18
18
  end
19
19
 
20
20
  def create_team
21
- @team = Jobshop::Team.create!(name: name)
21
+ @team = ::Jobshop::Team.create!(name: name)
22
22
  end
23
23
 
24
24
  def generate_token
@@ -31,7 +31,7 @@ module Jobshop
31
31
  # TODO: Give environments besides development a decent host and
32
32
  # protocol. HTTPS isn't mandatory in production but it is very, VERY
33
33
  # highly recommended.
34
- @link_text = Jobshop::Engine.routes.url_helpers.
34
+ @link_text = ::Jobshop::Engine.routes.url_helpers.
35
35
  new_team_registration_url(@team,
36
36
  protocol: link_protocol,
37
37
  host: link_host,
@@ -0,0 +1,58 @@
1
+ require "rails/generators/rails/app/app_generator"
2
+
3
+ module Jobshop
4
+ class DummyApp
5
+ class << self
6
+ def require_environment!
7
+ if exist?
8
+ require File.join(path, "config/environment")
9
+ else
10
+ abort("Dummy app does not exist. Please run `rake jobshop:dummy` to create it.")
11
+ end
12
+ end
13
+
14
+ def exist?
15
+ Dir.exist?(path)
16
+ end
17
+
18
+ def destroy!
19
+ FileUtils.rmtree(path)
20
+ Object.send(:remove_const, constant_name)
21
+ end
22
+
23
+ def path
24
+ @path ||= File.expand_path("spec/dummy-#{Rails::VERSION::STRING}")
25
+ end
26
+
27
+ def constant_name
28
+ @constant_name = File.basename(path)
29
+ .gsub(/\W/, '_').squeeze('_').camelize
30
+ end
31
+
32
+ def rakefile
33
+ File.join(path, "Rakefile")
34
+ end
35
+
36
+ def template
37
+ @template ||=
38
+ File.expand_path("templates/dummy_template.rb", __dir__)
39
+ end
40
+ end
41
+
42
+ def initialize
43
+ options = {
44
+ api: false,
45
+ database: "postgresql",
46
+ skip_gemfile: true,
47
+ skip_git: true,
48
+ skip_bundle: true,
49
+ skip_listen: true,
50
+ skip_test: true,
51
+ template: DummyApp.template
52
+ }
53
+
54
+ DummyApp.destroy! if DummyApp.exist?
55
+ Rails::Generators::AppGenerator.new([ DummyApp.path ], options).invoke_all
56
+ end
57
+ end
58
+ end
@@ -17,7 +17,7 @@ module Jobshop
17
17
  g.javascripts false
18
18
  end
19
19
 
20
- initializer "foo_bar", before: :load_config_initializers do |app|
20
+ initializer "jobshop.append_migrations_paths", before: :load_config_initializers do
21
21
  config.paths["db/migrate"].expanded.each do |expanded_path|
22
22
  Rails.application.config.paths["db/migrate"] << expanded_path
23
23
  end
@@ -13,7 +13,7 @@ remove_file "config/secrets.yml"
13
13
  copy_file "secrets.yml.tt", "config/secrets.yml"
14
14
 
15
15
  # The db/migrate folder never gets created for the dummy_app so do it manually.
16
- unless Dir.exists?("db/migrate")
16
+ unless Dir.exist?("db/migrate")
17
17
  say_status :create, "db/migrate"
18
18
  Dir.mkdir("db/migrate")
19
19
  end
@@ -21,3 +21,4 @@ end
21
21
  route "mount Jobshop::Engine => \"/\""
22
22
 
23
23
  rake "db:create"
24
+ rake "db:migrate"
@@ -1,6 +1,4 @@
1
- def source_paths
2
- [ "https://raw.githubusercontent.com/jobshop/jobshop/master/lib/jobshop/templates/" ]
3
- end
1
+ SECRETS_YML_TT_URI = URI.parse("https://raw.githubusercontent.com/jobshop/jobshop/master/lib/jobshop/templates/secrets.yml.tt")
4
2
 
5
3
  # Add jobshop to the application `Gemfile`.
6
4
  gem "jobshop", "~> 0.0.9"
@@ -8,7 +6,12 @@ gem "jobshop", "~> 0.0.9"
8
6
  # The generated config/secrets.yml file uses hardcoded values for
9
7
  # test/development environments. Generate secrets pragmatically.
10
8
  remove_file "config/secrets.yml"
11
- copy_file "secrets.yml.tt", "config/secrets.yml"
9
+ create_file "config/secrets.yml" do
10
+ Net::HTTP.start(SECRETS_YML_TT_URI.host,
11
+ SECRETS_YML_TT_URI.port, use_ssl: true) do |http|
12
+ http.request(Net::HTTP::Get.new(SECRETS_YML_TT_URI))
13
+ end.body
14
+ end
12
15
 
13
16
  after_bundle do
14
17
  route %Q(mount Jobshop::Engine => "/")
@@ -11,26 +11,10 @@
11
11
  # if you're sharing your code publicly.
12
12
 
13
13
  development:
14
- secret_key_base: <%=
15
- path_to_key = File.expand_path("tmp/development_secret_key_base")
16
- if File.exists?(path_to_key)
17
- File.read(path_to_key).chomp
18
- else
19
- new_key = SecureRandom.hex(64)
20
- File.write(path_to_key, new_key)
21
- new_key
22
- end %>
14
+ secret_key_base: <%= SecureRandom.hex(64) %>
23
15
 
24
16
  test:
25
- secret_key_base: <%=
26
- path_to_key = File.expand_path("tmp/test_secret_key_base")
27
- if File.exists?(path_to_key)
28
- File.read(path_to_key).chomp
29
- else
30
- new_key = SecureRandom.hex(64)
31
- File.write(path_to_key, new_key)
32
- new_key
33
- end %>
17
+ secret_key_base: <%= SecureRandom.hex(64) %>
34
18
 
35
19
  # Do not keep production secrets in the repository,
36
20
  # instead read values from the environment.
@@ -6,7 +6,7 @@ module Jobshop
6
6
  module VERSION
7
7
  MAJOR = 0
8
8
  MINOR = 0
9
- TINY = 9
9
+ TINY = 10
10
10
  PRE = nil
11
11
 
12
12
  CODE_NAME = "bump it up".freeze
data/lib/jobshop.rb CHANGED
@@ -1,26 +1,4 @@
1
1
  require "jobshop/engine"
2
2
 
3
3
  module Jobshop
4
- class << self
5
- attr_writer :configuration
6
- end
7
-
8
- def self.configuration
9
- @configuration ||= Configuration.new
10
- end
11
-
12
- # Yields the global configuration to a block.
13
- # @yield [Configuration] global configuration
14
- #
15
- # @example
16
- # Jobshop.configure do |config|
17
- # end
18
- def self.configure
19
- yield configuration if block_given?
20
- end
21
-
22
- class Configuration
23
- def initialize
24
- end
25
- end
26
4
  end
@@ -13,6 +13,15 @@ namespace :jobshop do
13
13
  }
14
14
  end
15
15
  end
16
+
17
+ desc "Outputs team[:name] and team[:id] for all sites within Jobshop."
18
+ task teams: :environment do
19
+ Jobshop::Team.joins(:owner)
20
+ .select([ "jobshop_teams.id", "name", "jobshop_users.email AS owner_email" ]).each do |team|
21
+ team_name = team.name.ljust(32)
22
+ puts "#{team_name} | #{team.id} | #{team.owner_email} "
23
+ end
24
+ end
16
25
  end
17
26
 
18
27
  %w( db:migrate db:rollback db:migrate:up db:migrate:down ).each do |t|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jobshop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frank J. Mattia
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-05 00:00:00.000000000 Z
11
+ date: 2016-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: coffee-rails
@@ -176,6 +176,20 @@ dependencies:
176
176
  - - "~>"
177
177
  - !ruby/object:Gem::Version
178
178
  version: '2.6'
179
+ - !ruby/object:Gem::Dependency
180
+ name: coveralls
181
+ requirement: !ruby/object:Gem::Requirement
182
+ requirements:
183
+ - - ">="
184
+ - !ruby/object:Gem::Version
185
+ version: '0'
186
+ type: :development
187
+ prerelease: false
188
+ version_requirements: !ruby/object:Gem::Requirement
189
+ requirements:
190
+ - - ">="
191
+ - !ruby/object:Gem::Version
192
+ version: '0'
179
193
  - !ruby/object:Gem::Dependency
180
194
  name: factory_girl_rails
181
195
  requirement: !ruby/object:Gem::Requirement
@@ -345,7 +359,7 @@ files:
345
359
  - lib/generators/jobshop/team/USAGE
346
360
  - lib/generators/jobshop/team/team_generator.rb
347
361
  - lib/jobshop.rb
348
- - lib/jobshop/dummy.rb
362
+ - lib/jobshop/dummy_app.rb
349
363
  - lib/jobshop/engine.rb
350
364
  - lib/jobshop/support/memo_attr.rb
351
365
  - lib/jobshop/templates/boot.rb.tt
data/lib/jobshop/dummy.rb DELETED
@@ -1,43 +0,0 @@
1
- require "rails/generators/rails/app/app_generator"
2
-
3
- module Jobshop
4
- class Dummy
5
- class << self
6
- def generate
7
- new
8
- end
9
- end
10
-
11
- def initialize
12
- options = {
13
- api: false,
14
- database: "postgresql",
15
- skip_gemfile: true,
16
- skip_git: true,
17
- skip_bundle: true,
18
- skip_listen: true,
19
- skip_test: true,
20
- template: template_path
21
- }
22
-
23
- if Dir.exists?(dummy_path)
24
- FileUtils.rmtree(dummy_path)
25
- dummy_constant = File.basename(dummy_path).gsub(/\W/, '_').squeeze('_').camelize
26
- Object.send(:remove_const, dummy_constant)
27
- end
28
-
29
- Rails::Generators::AppGenerator.new([ dummy_path ], options).invoke_all
30
- end
31
-
32
- private
33
-
34
- def dummy_path
35
- @dummy_path ||= File.expand_path("spec/dummy-#{Rails::VERSION::STRING}")
36
- end
37
-
38
- def template_path
39
- @template_path ||=
40
- File.expand_path("../templates/dummy_template.rb", __FILE__)
41
- end
42
- end
43
- end