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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a80b124595cac270ca1c0006a697438f97f05700f19cfe5a778d0bdd898a28a0
|
4
|
+
data.tar.gz: bc1d3d10a5f3596fe609f388df580465f83b8acb7998ec1b72eb0ea4bfd185e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 =
|
11
|
+
@result.user = create_user
|
10
12
|
end
|
11
13
|
|
12
14
|
private
|
13
15
|
|
14
|
-
def
|
16
|
+
def create_user
|
15
17
|
user = Cmor::UserArea::User.new(user_attributes)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
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
|
4
|
-
task
|
5
|
-
|
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.
|
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
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
54
|
+
version: 0.0.45.pre
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: sqlite3
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|