jobshop 0.0.67 → 0.0.101

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: 269cd370a578899a10889f466384114b6672b2d5
4
- data.tar.gz: bdff6efb80939367914d280e5bf84663c92fc24b
3
+ metadata.gz: 2dd90b50e7feb98aff7c02039f85914a92b21789
4
+ data.tar.gz: b08d3ec5ff1e5160bee39de1077be79cf870209e
5
5
  SHA512:
6
- metadata.gz: ec3a60f34dbe0139371b259a8651be8465b28199e0521a1377246ed0fb52b30899378b3bea6d76d6d4fa10803372ab4c602221198b7f05369ca8390b2186bd62
7
- data.tar.gz: 213a5e8e78e79a422e854e2000873b90636129aba8a4811d9e58b34d5e5548773f6e9ce7752fc236e4d3c0017dc5ef62d1d84417d46c44cee8a35e516b5aa604
6
+ metadata.gz: 715aaa6e6ea388e208074804f4141c36bca7a303579379d727afa67d118449128eba94e2ebe99a87a2784476031ae18c894df5db1ba39baaded235c55fa2efe9
7
+ data.tar.gz: ada7575067365e3785eb7eecb2f32bd040ba06ec1c2ba613962348e60418c84462acd570e7ca11ce55fb7a7bae8a861755a0211f6cef9aff8b0f30079ed31e38
data/README.md CHANGED
@@ -7,32 +7,33 @@
7
7
 
8
8
  Real-time production tracking and process evaluation in the cloud - or under your own roof.
9
9
 
10
- To see a live demo, check out [jobshop.io](https://jobshop.io).
11
-
12
10
  ## Requirements
13
11
 
14
12
  Jobshop only requires a few things:
15
13
 
16
- - Ruby >= 2.3
14
+ - Ruby >= 2.4
17
15
  - Rails >= 5.0
18
- - PostgreSQL
16
+ - PostgreSQL >= 9.5
19
17
 
20
18
  ## Quick Installation
21
19
 
22
20
  The Quick Installation is designed to get you up and running a local Jobshop
23
21
  server with minimum effort. This instance will be ideal for evaluating Jobshop
24
- on a small number of stations within your organization. If you would like to
22
+ at any number of stations within your organization. If you would like to
25
23
  deploy to a production server or create a local development instance, a few
26
24
  extra considerations will need to be made. There are no guides yet but pull
27
25
  requests are always welcome.
28
26
 
29
- First, generate a new rails app and target the PostgreSQL adapter. The provided
30
- application template does all the heavy lifting. It adds Jobshop to your
31
- `Gemfile`, defines reasonable defaults in `config/secrets.yml` and adds a route
32
- for the `Jobshop::Engine` to `config/routes.rb`.
27
+ First, install the Jobshop gem.
28
+
29
+ ```console
30
+ $ gem install jobshop
31
+ ```
32
+
33
+ Then create your app:
33
34
 
34
35
  ```console
35
- $ rails new my_jobshop --database=postgresql -m https://templates.jobshop.io/quick_install.rb
36
+ $ jobshop new my_jobshop
36
37
  ```
37
38
 
38
39
  Change into the app directory.
@@ -47,13 +48,14 @@ and edit as necessary. Create the database.
47
48
  ```console
48
49
  $ rails db:create
49
50
  ```
51
+
50
52
  Run the newly pending migrations.
51
53
 
52
54
  ```console
53
55
  $ rails db:migrate
54
56
  ```
55
57
 
56
- Fire up your server with `$ rails s` and point your web browser to
58
+ Fire up your server with `rails s` and point your web browser to
57
59
  [http://localhost:3000](http://localhost:3000)
58
60
 
59
61
  ## Bug Reports
@@ -0,0 +1,8 @@
1
+ Description:
2
+ The `jobshop new` command creates a new Jobshop application with a default
3
+ directory structure and configuration at the path you specify.
4
+
5
+ Example:
6
+ jobshop new ~/src/my_jobshop
7
+
8
+ This generates a skeletal Jobshop installation in ~/src/my_jobshop.
@@ -0,0 +1,70 @@
1
+ require "rails/generators"
2
+ require "rails/generators/rails/app/app_generator"
3
+
4
+ require "jobshop/version"
5
+
6
+ module Jobshop
7
+ class AppBuilder < Rails::AppBuilder
8
+ def readme
9
+ template "README.md.tt"
10
+ end
11
+
12
+ def gemfile
13
+ super
14
+ append_to_file "Gemfile", <<~GEMFILE
15
+ \ngem "jobshop", "~> #{Jobshop.gem_version}"
16
+ GEMFILE
17
+ end
18
+
19
+ def config
20
+ super
21
+ template "config/secrets.yml.tt", force: true
22
+ end
23
+
24
+ def mount_engine
25
+ route %Q(mount Jobshop::Engine => "/")
26
+ end
27
+ end
28
+
29
+ module Generators
30
+ class AppGenerator < Rails::Generators::AppGenerator
31
+ def self.source_root
32
+ File.expand_path("templates", __dir__)
33
+ end
34
+
35
+ def self.source_paths
36
+ [ Rails::Generators::AppGenerator.source_root,
37
+ Jobshop::Generators::AppGenerator.source_root ]
38
+ end
39
+
40
+ hide!
41
+
42
+ class_option :help, type: :boolean, aliases: "-h", group: :other,
43
+ desc: "Show this help message and quit"
44
+
45
+ class_options[:database].instance_variable_set(:@default, "postgresql")
46
+
47
+ class_option :version, type: :boolean, aliases: "-v", group: :other,
48
+ desc: "Show Jobshop version number and quit"
49
+
50
+ def self.banner
51
+ "jobshop new #{arguments.map(&:usage).join(' ')} [options]"
52
+ end
53
+
54
+ def finish_template
55
+ build :mount_engine
56
+ super
57
+ end
58
+
59
+ def run_bundle
60
+ super
61
+ bundle_command("binstub jobshop") if bundle_install?
62
+ end
63
+
64
+ protected
65
+ def get_builder_class
66
+ Jobshop::AppBuilder
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,3 @@
1
+ # README
2
+
3
+ You're running Jobshop!
@@ -0,0 +1,101 @@
1
+ require "jobshop/dummy_app"
2
+ require "generators/jobshop/app/app_generator"
3
+
4
+ module Jobshop
5
+ class DummyBuilder < Jobshop::AppBuilder
6
+ def readme
7
+ # Do not generate README.md
8
+ end
9
+
10
+ # Comment out username, password from production group.
11
+ def config_database_yml
12
+ gsub_file "config/database.yml",
13
+ /^([ ]*[^#])(username: .*|password: .*)$/, '\1# \2'
14
+ end
15
+
16
+ # The db/migrate folder isn't created automatically.
17
+ def db_migrate
18
+ unless Dir.exist?("db/migrate")
19
+ say_status :create, "db/migrate"
20
+ Dir.mkdir("db/migrate")
21
+ end
22
+ end
23
+
24
+ def expose_mailer_previews
25
+ # Mailer previews don't really play nice with Engines so in the dummy app we
26
+ # create an initializer to expose them properly.
27
+ initializer "jobshop_expose_mailer_previews.rb", <<~INITIALIZER
28
+ if Rails.env.development? || Rails.env.test?
29
+ Rails.application.configure do
30
+ config.action_mailer.preview_path = "\#{Jobshop::Engine.root}/spec/mailers"
31
+ end
32
+ end
33
+ INITIALIZER
34
+ end
35
+
36
+ def localhost_tld_length
37
+ # This allows us to easily use the localhost hostname in development.
38
+ initializer "jobshop_tld_length.rb", <<~INITIALIZER
39
+ if Rails.env.development? || Rails.env.test?
40
+ Rails.application.configure do
41
+ config.action_dispatch.tld_length = 0
42
+ end
43
+ end
44
+ INITIALIZER
45
+ end
46
+ end
47
+
48
+ module Generators
49
+ class DummyGenerator < Jobshop::Generators::AppGenerator
50
+ def self.source_root
51
+ File.expand_path("templates", __dir__)
52
+ end
53
+
54
+ def self.source_paths
55
+ Array(super) | [ Jobshop::Generators::DummyGenerator.source_root ]
56
+ end
57
+
58
+ hide!
59
+
60
+ class_options[:skip_bundle].instance_variable_set(:@default, "true")
61
+ class_options[:skip_gemfile].instance_variable_set(:@default, "true")
62
+ class_options[:skip_git].instance_variable_set(:@default, "true")
63
+ class_options[:skip_listen].instance_variable_set(:@default, "true")
64
+ class_options[:skip_test].instance_variable_set(:@default, "true")
65
+
66
+ def initialize(*)
67
+ DummyApp.destroy! if Jobshop::DummyApp.exist?
68
+ super
69
+ end
70
+
71
+ def self.banner
72
+ "jobshop dummy [options]"
73
+ end
74
+
75
+ def create_boot_file
76
+ template "config/boot.rb.tt"
77
+ end
78
+
79
+ def finish_template
80
+ build :config_database_yml
81
+ build :db_migrate
82
+ build :expose_mailer_previews
83
+ build :localhost_tld_length
84
+ super
85
+ end
86
+
87
+ def run_bundle
88
+ super
89
+ bundle_command("binstub jobshop --path=\"#{Jobshop::DummyApp.path}/bin\" --force")
90
+ bundle_command("exec rails db:drop RAILS_ENV=test")
91
+ bundle_command("exec rails db:create RAILS_ENV=test")
92
+ bundle_command("exec rails db:migrate RAILS_ENV=test")
93
+ end
94
+
95
+ protected
96
+ def get_builder_class
97
+ Jobshop::DummyBuilder
98
+ end
99
+ end
100
+ end
101
+ end
@@ -0,0 +1,5 @@
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __dir__)
3
+
4
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5
+ $LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)
data/lib/jobshop/cli.rb CHANGED
@@ -1,17 +1,66 @@
1
1
  require "thor"
2
2
 
3
- require "jobshop"
4
- require "jobshop/version"
3
+ require "jobshop/dummy_app"
4
+ require "generators/jobshop/app/app_generator"
5
+ require "generators/jobshop/dummy/dummy_generator"
5
6
 
6
7
  module Jobshop
7
- class CLI < Thor
8
- package_name "Jobshop"
8
+ class CLI
9
+ class Unbound < Thor
10
+ desc "new", "Create a new Jobshop application"
11
+ default_command def new(*)
12
+ Jobshop::Generators::AppGenerator.start \
13
+ Rails::Generators::ARGVScrubber.new(ARGV).prepare!
14
+ end
9
15
 
10
- map "-v" => :version
16
+ def help
17
+ Jobshop::Generators::AppGenerator.help(shell)
18
+ end
19
+ end
20
+
21
+ class Dummy < Thor
22
+ desc "create", "Create the dummy app"
23
+ default_command def create
24
+ ARGV.shift; ARGV.unshift("new", Jobshop::DummyApp.path)
25
+ Jobshop::Generators::DummyGenerator.start \
26
+ Rails::Generators::ARGVScrubber.new(ARGV).prepare!
27
+ end
28
+ end
29
+
30
+ class Development < Thor
31
+ register Jobshop::CLI::Dummy, "dummy", "dummy [options]", "Manage dummy app used for tests"
32
+ end
33
+
34
+ class << self
35
+ def start
36
+ if [ "-v", "--version" ].include?(ARGV[0])
37
+ require "jobshop/version"
38
+ puts "Jobshop #{Jobshop.gem_version}"
39
+ exit 0
40
+ elsif jobshop_application?
41
+ puts "No tasks available for the application environment yet"
42
+ elsif jobshop_development?
43
+ Jobshop::CLI::Development.start
44
+ else
45
+ Jobshop::CLI::Unbound.start
46
+ end
47
+ end
48
+
49
+ private def jobshop_application?
50
+ has_executable? && !has_gemspec?
51
+ end
52
+
53
+ private def jobshop_development?
54
+ has_executable? && has_gemspec?
55
+ end
56
+
57
+ private def has_executable?
58
+ @has_executable ||= File.file?("bin/jobshop")
59
+ end
11
60
 
12
- desc "version", "Print Jobshop version and exit."
13
- def version
14
- puts "Jobshop v#{Jobshop.gem_version}"
61
+ private def has_gemspec?
62
+ @jobshop_development ||= File.file?("jobshop.gemspec")
63
+ end
15
64
  end
16
65
  end
17
66
  end
@@ -1,58 +1,23 @@
1
- require "rails/generators/rails/app/app_generator"
1
+ require "rails/version"
2
2
 
3
3
  module Jobshop
4
4
  class DummyApp
5
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
6
  def destroy!
19
7
  FileUtils.rmtree(path)
20
- Object.send(:remove_const, constant_name)
21
8
  end
22
9
 
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
10
+ def exist?
11
+ Dir.exist?(path)
30
12
  end
31
13
 
32
14
  def rakefile
33
15
  File.join(path, "Rakefile")
34
16
  end
35
17
 
36
- def template
37
- @template ||=
38
- File.expand_path("templates/dummy_template.rb", __dir__)
18
+ def path
19
+ @path ||= File.expand_path("spec/dummy-#{Rails::VERSION::STRING}")
39
20
  end
40
21
  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
22
  end
58
23
  end
@@ -6,7 +6,7 @@ module Jobshop
6
6
  module VERSION
7
7
  MAJOR = 0
8
8
  MINOR = 0
9
- TINY = 67
9
+ TINY = 101
10
10
  PRE = nil
11
11
 
12
12
  CODE_NAME = "bump it up prime".freeze
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.67
4
+ version: 0.0.101
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frank J. Mattia
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-02-04 00:00:00.000000000 Z
11
+ date: 2017-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: coffee-rails
@@ -382,8 +382,14 @@ files:
382
382
  - db/migrate/20160720201947_add_authentication_token_to_jobshop_users.rb
383
383
  - db/migrate/keep
384
384
  - exe/jobshop
385
+ - lib/generators/jobshop/app/USAGE
386
+ - lib/generators/jobshop/app/app_generator.rb
387
+ - lib/generators/jobshop/app/templates/README.md.tt
388
+ - lib/generators/jobshop/app/templates/config/secrets.yml.tt
385
389
  - lib/generators/jobshop/config/config_generator.rb
386
390
  - lib/generators/jobshop/config/templates/jobshop.rb.tt
391
+ - lib/generators/jobshop/dummy/dummy_generator.rb
392
+ - lib/generators/jobshop/dummy/templates/config/boot.rb.tt
387
393
  - lib/generators/jobshop/orm_helpers.rb
388
394
  - lib/generators/jobshop/team/USAGE
389
395
  - lib/generators/jobshop/team/team_generator.rb
@@ -393,13 +399,8 @@ files:
393
399
  - lib/jobshop/engine.rb
394
400
  - lib/jobshop/failure_app.rb
395
401
  - lib/jobshop/support/memo_attr.rb
396
- - lib/jobshop/templates/boot.rb.tt
397
- - lib/jobshop/templates/dummy_template.rb
398
- - lib/jobshop/templates/quick_install.rb
399
- - lib/jobshop/templates/secrets.yml.erb
400
402
  - lib/jobshop/version.rb
401
403
  - lib/tasks/jobshop_tasks.rake
402
- - lib/templates/haml/scaffold/_form.html.haml
403
404
  homepage: https://jobshop.io
404
405
  licenses:
405
406
  - AGPL-3.0
@@ -1,5 +0,0 @@
1
- # Set up gems listed in the Gemfile.
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
-
4
- require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5
- $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
@@ -1,48 +0,0 @@
1
- def source_paths
2
- [ File.expand_path(File.dirname(__FILE__)) ]
3
- end
4
-
5
- # The generated config/boot.rb file references a Gemfile in the dummy app
6
- # directory so use one that references the parent app.
7
- remove_file "config/boot.rb"
8
- copy_file "boot.rb.tt", "config/boot.rb"
9
-
10
- # The generated config/secrets.yml file uses hardcoded values for
11
- # test/development environments. Generate secrets pragmatically.
12
- remove_file "config/secrets.yml"
13
- template "secrets.yml.erb", "config/secrets.yml"
14
-
15
- # Comment out username, password from production group.
16
- gsub_file "config/database.yml",
17
- /^([ ]*[^#])(username: .*|password: .*)$/, '\1# \2'
18
-
19
- # The db/migrate folder never gets created for the dummy_app so do it manually.
20
- unless Dir.exist?("db/migrate")
21
- say_status :create, "db/migrate"
22
- Dir.mkdir("db/migrate")
23
- end
24
-
25
- # Mailer previews don't really play nice with Engines so in the dummy app we
26
- # create an initializer to expose them properly.
27
- initializer "jobshop_expose_mailer_previews.rb", <<-INITIALIZER.strip_heredoc
28
- if Rails.env.development? || Rails.env.test?
29
- Rails.application.configure do
30
- config.action_mailer.preview_path = "\#{Jobshop::Engine.root}/spec/mailers"
31
- end
32
- end
33
- INITIALIZER
34
-
35
- # This allows us to easily use the localhost hostname in development.
36
- initializer "jobshop_tld_length.rb", <<-INITIALIZER.strip_heredoc
37
- if Rails.env.development? || Rails.env.test?
38
- Rails.application.configure do
39
- config.action_dispatch.tld_length = 0
40
- end
41
- end
42
- INITIALIZER
43
-
44
- route "mount Jobshop::Engine => \"/\""
45
-
46
- rake "db:drop:all"
47
- rake "db:create"
48
- rake "db:migrate"
@@ -1,30 +0,0 @@
1
- require "tempfile"
2
- require "net/http"
3
-
4
- # Add jobshop to the application `Gemfile`.
5
- gem "jobshop", "~> 0.0.11"
6
-
7
- def template_body(uri)
8
- uri = URI.parse(uri)
9
- Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
10
- http.request(Net::HTTP::Get.new(uri))
11
- end.body
12
- end
13
-
14
- # The generated config/secrets.yml file uses hardcoded values for
15
- # test/development environments. Generate secrets pragmatically.
16
- SECRETS_YML_URI = "https://raw.githubusercontent.com/" +
17
- "jobshop/jobshop/" +
18
- "master/lib/jobshop/templates/secrets.yml.erb"
19
-
20
- secrets_tempfile = Tempfile.new(["secrets", ".yml.erb"])
21
- secrets_tempfile.write(template_body(SECRETS_YML_URI))
22
- secrets_tempfile.close
23
-
24
- remove_file "config/secrets.yml"
25
- template secrets_tempfile.path, "config/secrets.yml"
26
- secrets_tempfile.unlink
27
-
28
- after_bundle do
29
- route %Q(mount Jobshop::Engine => "/")
30
- end
@@ -1,10 +0,0 @@
1
- = simple_form_for(@<%= singular_table_name %>) do |f|
2
- = f.error_notification
3
-
4
- .form-inputs
5
- <%- attributes.each do |attribute| -%>
6
- = f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %>
7
- <%- end -%>
8
-
9
- .form-actions
10
- = f.button :submit