cmor_user_area 0.0.44.pre → 0.0.45.pre

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
  SHA256:
3
- metadata.gz: 2e10d0a9ada4d50d8a6a4ec9bb76f1b18240aaf1fb6a13a552b66896ff2b200a
4
- data.tar.gz: d1af2d65309d790944cd93a29a51338e759437b942e332ab3b24b1d1180c215c
3
+ metadata.gz: a80b124595cac270ca1c0006a697438f97f05700f19cfe5a778d0bdd898a28a0
4
+ data.tar.gz: bc1d3d10a5f3596fe609f388df580465f83b8acb7998ec1b72eb0ea4bfd185e6
5
5
  SHA512:
6
- metadata.gz: 0764d7f264d3792a1d53842851524d1bed880b21c07e7a697ee8da7a477294d591230186b3a05a5f203009ef4db514ec0ea517a642e539fc0ff5cf096264428c
7
- data.tar.gz: 192fee809a414d4641389aab72dfbeb5d059ce3c1ea912b00d424c63f2e2e591ff01716a129cfdd41941a40b9f9109d5b890a19c34fc3b220833842c4d8a3eb0
6
+ metadata.gz: 9db5c66476b3721fca1c4dea117e68b17da2b783fc220a1d542a2163e9ce9ec6423a950bb3ad36e2d263ee135655261818b61f7bb368dea6ffe2975e027f603d
7
+ data.tar.gz: 6ff75cbdc2ba4a197ff7115fd14dc86cb23a1ea397e314e8a82eff31c14e062cce49e0d282cde15024c9f4bf4b8a94bf789d8149bc6cc2bbb45c38e9f5b2c144
@@ -2,26 +2,38 @@ module Cmor
2
2
  module UserArea
3
3
  class CreateDefaultUserService < ::Cmor::UserArea::ApplicationService
4
4
  class Result < ::Cmor::UserArea::ApplicationService::Result
5
- attr_accessor :user
5
+ attr_accessor :user, :email, :password, :password_confirmation, :active, :approved, :confirmed
6
6
  end
7
7
 
8
+ attr_accessor :email, :password, :password_confirmation, :active, :approved, :confirmed
9
+
8
10
  def _perform
9
- @result.user = create_default_user
11
+ @result.user = create_user
10
12
  end
11
13
 
12
14
  private
13
15
 
14
- def create_default_user
16
+ def create_user
15
17
  user = Cmor::UserArea::User.new(user_attributes)
16
- if user.save
17
- say 'Created default user'
18
- else
19
- add_error_and_say(:base, "Could not create default user. Errors: #{user.errors.full_messages.to_sentence}")
18
+ say "Creating user [#{user.email}]" do
19
+ if user.save
20
+ say '=> [OK]'
21
+ else
22
+ add_error_and_say(:base, "=> [FAILED] Errors: #{user.errors.full_messages.to_sentence}")
23
+ end
24
+ user
20
25
  end
21
- user
22
26
  end
23
27
 
24
28
  def user_attributes
29
+ user_attribute_defaults.merge(user_attribute_overrides)
30
+ end
31
+
32
+ def user_attribute_overrides
33
+ { email: email, password: password, password_confirmation: password_confirmation, active: active, approved: approved, confirmed: confirmed }.compact
34
+ end
35
+
36
+ def user_attribute_defaults
25
37
  {
26
38
  email: 'user@example.com',
27
39
  password: 'password',
@@ -1,8 +1,10 @@
1
1
  namespace :cmor do
2
2
  namespace :user_area do
3
- desc 'Creates the default user with email/password: user@example.com/password'
4
- task create_default_user: :environment do
5
- Cmor::UserArea::CreateDefaultUserService.call
3
+ desc 'Creates the user with email/password. Defaults: email: "user@example.com", password: "password"'
4
+ task create_user: [ :environment ] do
5
+ email = ENV.fetch('email') { 'user@example.com' }
6
+ password = ENV.fetch('password') { 'password' }
7
+ Cmor::UserArea::CreateDefaultUserService.call(email: email, password: password, password_confirmation: password)
6
8
  end
7
9
  end
8
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cmor_user_area
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.44.pre
4
+ version: 0.0.45.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Vasquez Angel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-29 00:00:00.000000000 Z
11
+ date: 2020-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,42 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 5.2.0
19
+ version: 5.2.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 5.2.0
26
+ version: 5.2.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: cmor_core
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.0.44.pre
33
+ version: 0.0.45.pre
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 0.0.44.pre
40
+ version: 0.0.45.pre
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: cmor_core_frontend
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 0.0.44.pre
47
+ version: 0.0.45.pre
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 0.0.44.pre
54
+ version: 0.0.45.pre
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: sqlite3
57
57
  requirement: !ruby/object:Gem::Requirement