jobshop 0.0.37 → 0.0.41

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: 6d5aae0bc0ef493f3af548a3924df2d7d3bfa20d
4
- data.tar.gz: f3ec4420b0e9698bbfec1ba3d50c376c4fb8a261
3
+ metadata.gz: c86e7e67c1715d920f77caf807a4bc4e5d0d5dec
4
+ data.tar.gz: b61cde16d2ba6177ecc3bbb62d4b7e165692b92b
5
5
  SHA512:
6
- metadata.gz: 49cb1d2eda3f5e7cb29c119f8a6bc631784ab432479602df79327d6ea760be14a51d9b27fcb092765791d2646cf633f26583dd6a2c459ae0ff726e436604600d
7
- data.tar.gz: 8a715e7172f5d4acef51079c0ae58153416aee02a905278b9bf33b1a716e07fab7e0af0cae39b91bc8e8af0146cb6e2bd2d783cd1e19288e0cf6892107b0373b
6
+ metadata.gz: bb5e90365faeb6483033e4c16a776e399908ba489557ed89672bad4d864c176004ed729b41adcd5626d458f7a92e1b3e5a515ac601098e3fba86e5fac27d6cf2
7
+ data.tar.gz: bed3c0155ecd9c441f018d28f119fae407067cdb01965d770479fd496070b8c328d56dcdd0ad47ee08a5a1e90c07ef3badeb9f64188950820369f6712ad757b8
@@ -9,17 +9,9 @@ module Jobshop
9
9
  end
10
10
 
11
11
  def create
12
- email_addresses = params[:user][:email].split(",").map(&:strip).take(5)
12
+ emails = params[:user][:email].split(",").map(&:strip).take(5)
13
13
 
14
- @lookup = Jobshop::User
15
- .where(email: email_addresses)
16
- .joins(:team)
17
- .select("jobshop_users.id AS id",
18
- "email",
19
- "jobshop_teams.name AS team_name")
20
- .group_by(&:email)
21
-
22
- @lookup.each_pair do |email, teams|
14
+ Jobshop::Team.grouped_by_email(emails).each_pair do |email, teams|
23
15
  Jobshop::TeamsMailer.found_teams(email, teams).deliver_later
24
16
  end
25
17
 
@@ -1,10 +1,10 @@
1
1
  module Jobshop
2
2
  class TeamsMailer < ApplicationMailer
3
- def found_teams(email, teams)
4
- @email = email
3
+ def found_teams(user, teams)
4
+ @user = user
5
5
  @teams = teams
6
6
 
7
- mail(to: @email, subject: "We found your Jobshop Teams!")
7
+ mail(to: @user.email, subject: "We found your Jobshop Teams!")
8
8
  end
9
9
  end
10
10
  end
@@ -4,6 +4,16 @@ module Jobshop
4
4
  has_many :users, class_name: "Jobshop::User"
5
5
  has_one :default_dashboard, class_name: "Jobshop::Dashboard"
6
6
 
7
+ scope :grouped_by_email, ->(email_addresses) {
8
+ Jobshop::User
9
+ .where(email: email_addresses)
10
+ .joins(:team)
11
+ .includes(:team)
12
+ .each_with_object({}) { |user, teams|
13
+ (teams[user.email] ||= []) << user.team
14
+ }
15
+ }
16
+
7
17
  def generate_registration_token
8
18
  raw, encrypted = Devise.token_generator.generate(
9
19
  self.class, :registration_token)
@@ -22,8 +22,9 @@
22
22
  = f.fields_for(f.object.user) do |uf|
23
23
  = uf.input :email
24
24
  %p
25
- Pick a strong password, ideally being: longer than 8 characters,
26
- of mixed upper/lower case, including numbers and symbols.
25
+ Pick a strong password. Ideally it will be longer than eight
26
+ characters, have mixed upper/lower case, and include numbers
27
+ and symbols.
27
28
  = uf.input :password
28
29
  = uf.input :password_confirmation
29
30
  = f.button :submit, "Next &#187;".html_safe
@@ -1,7 +1,7 @@
1
- Hi <%= @email %>,
1
+ Hi <%= @user.email %>,
2
2
 
3
3
  We found the following teams linked to your email address:
4
4
 
5
5
  <% @teams.each do |team| %>
6
- You belong to: <%= team.team_name %>
6
+ You belong to: <%= team.name %>
7
7
  <% end %>
@@ -24,13 +24,25 @@ end
24
24
 
25
25
  # Mailer previews don't really play nice with Engines so in the dummy app we
26
26
  # create an initializer to expose them properly.
27
- initializer "expose_mailer_previews.rb", <<-INITIALIZER.strip_heredoc
28
- Rails.application.configure do
29
- config.action_mailer.preview_path = "\#{Jobshop::Engine.root}/spec/mailers"
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
30
41
  end
31
42
  INITIALIZER
32
43
 
33
44
  route "mount Jobshop::Engine => \"/\""
34
45
 
46
+ rake "db:drop:all"
35
47
  rake "db:create"
36
48
  rake "db:migrate"
@@ -1,25 +1,26 @@
1
- SECRETS_YML_URI = URI.parse("https://raw.githubusercontent.com/jobshop/jobshop/master/lib/jobshop/templates/secrets.yml.erb")
2
-
3
1
  require "tempfile"
4
2
  require "net/http"
5
3
 
6
4
  # Add jobshop to the application `Gemfile`.
7
5
  gem "jobshop", "~> 0.0.11"
8
6
 
9
- #require "pry"; binding.pry
10
- template_body = Net::HTTP.start(SECRETS_YML_URI.host,
11
- SECRETS_YML_URI.port,
12
- use_ssl: true) do |http|
13
- http.request(Net::HTTP::Get.new(SECRETS_YML_URI))
14
- end.body
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"
15
19
 
16
20
  secrets_tempfile = Tempfile.new(["secrets", ".yml.erb"])
17
- puts secrets_tempfile.path
18
- secrets_tempfile.write(template_body)
21
+ secrets_tempfile.write(template_body(SECRETS_YML_URI))
19
22
  secrets_tempfile.close
20
23
 
21
- # The generated config/secrets.yml file uses hardcoded values for
22
- # test/development environments. Generate secrets pragmatically.
23
24
  remove_file "config/secrets.yml"
24
25
  template secrets_tempfile.path, "config/secrets.yml"
25
26
  secrets_tempfile.unlink
@@ -6,7 +6,7 @@ module Jobshop
6
6
  module VERSION
7
7
  MAJOR = 0
8
8
  MINOR = 0
9
- TINY = 37
9
+ TINY = 41
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.37
4
+ version: 0.0.41
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-08-11 00:00:00.000000000 Z
11
+ date: 2016-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: coffee-rails