usman 0.3.25 → 0.3.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 00f8b99360de48eb40662b9a493d9e2919444e23
4
- data.tar.gz: 0b322710c79ca0746362c5beab0606454a118672
3
+ metadata.gz: 7af4414597edcc1c594ec129f781c08b1e065cf9
4
+ data.tar.gz: 3fc75080e583e8690c928c59dc9631bd2790b720
5
5
  SHA512:
6
- metadata.gz: a65b90b6f52f4e591538db1b25ff94d2309bbb0443ca66dd13f88e1717f51365273ae6478b3a8abe954245fd7feb4f1ecde5eb6a9451b68f0fa7ecc973b6555f
7
- data.tar.gz: a38a3e54a76fc1ca1c45925a58e3b91dfb5174a1d126ddd099934a09465d6ad7a8425477a70b8b344bdb8d89e22d512e7bea2bae465980e6d18780955d5fc014
6
+ metadata.gz: 6978436bb08a879e2083d2c6d942bbaffe3f6beb04139f6a9650beb7c32effbaa9ca9b691ac336a4c0c39aac99346216fed4d8a3bd9f652b9145d16c04b9b2db
7
+ data.tar.gz: 171ec6ec396622040719344ff329c983a56468cc916a50d4f480f1a5f58cdd048f0eb7170a6e3e0165e77e60424ec84aeea59c5849703947569e8e5281d714cf
@@ -30,15 +30,17 @@ class Feature < Usman::ApplicationRecord
30
30
  # Initializing error hash for displaying all errors altogether
31
31
  error_object = Kuppayam::Importer::ErrorHash.new
32
32
 
33
- return error_object if hsh[:name].blank?
33
+ return error_object if hsh[:name].to_s.strip.blank?
34
34
 
35
- feature = Feature.find_by_name(hsh[:name]) || Feature.new
36
- feature.name = hsh[:name]
37
- feature.status = hsh[:status]
35
+ feature = Feature.find_by_name(hsh[:name].to_s.strip) || Feature.new
36
+ feature.name = hsh[:name].to_s.strip
37
+ feature.status = hsh[:status].to_s.strip
38
+ feature.categorisable = hsh[:categorisable].to_s.strip
38
39
 
39
40
  if feature.valid?
40
41
  begin
41
42
  feature.save!
43
+ # puts "#{feature.name} saved".green
42
44
  rescue Exception => e
43
45
  summary = "uncaught #{e} exception while handling connection: #{e.message}"
44
46
  details = "Stack trace: #{e.backtrace.map {|l| " #{l}\n"}.join}"
@@ -34,16 +34,21 @@ class Permission < Usman::ApplicationRecord
34
34
  # Initializing error hash for displaying all errors altogether
35
35
  error_object = Kuppayam::Importer::ErrorHash.new
36
36
 
37
- user = User.find_by_username(hsh[:user])
37
+ user = User.find_by_username(hsh[:user].to_s.strip)
38
38
  unless user
39
- summary = "User '#{hsh[:user]}' doesn't exist"
39
+ summary = "User '#{hsh[:user].to_s.strip}' doesn't exist"
40
40
  error_object.errors << { summary: summary }
41
41
  return error_object
42
42
  end
43
43
 
44
- feature = Feature.find_by_name(hsh[:feature])
44
+ feature = Feature.find_by_name(hsh[:feature].to_s.strip)
45
+
46
+ unless feature
47
+ binding.pry
48
+ end
49
+
45
50
  unless feature
46
- summary = "Feature '#{hsh[:feature]}' doesn't exist"
51
+ summary = "Feature '#{hsh[:feature].to_s.strip}' doesn't exist"
47
52
  error_object.errors << { summary: summary }
48
53
  return error_object
49
54
  end
@@ -51,10 +56,10 @@ class Permission < Usman::ApplicationRecord
51
56
  permission = Permission.where("user_id = ? AND feature_id = ?", user.id, feature.id).first || Permission.new
52
57
  permission.user = user
53
58
  permission.feature = feature
54
- permission.can_create = hsh[:can_create]
55
- permission.can_read = hsh[:can_read]
56
- permission.can_update = hsh[:can_update]
57
- permission.can_delete = hsh[:can_delete]
59
+ permission.can_create = hsh[:can_create].to_s.strip
60
+ permission.can_read = hsh[:can_read].to_s.strip
61
+ permission.can_update = hsh[:can_update].to_s.strip
62
+ permission.can_delete = hsh[:can_delete].to_s.strip
58
63
 
59
64
  if permission.valid?
60
65
  begin
@@ -1 +0,0 @@
1
- My Account - yet to be done
@@ -1 +1,2 @@
1
- user,feature,can_create,can_read,can_update,can_delete
1
+ user,feature,can_create,can_read,can_update,can_delete
2
+ kpvarma,User,TRUE,TRUE,TRUE,TRUE
@@ -1,9 +1,9 @@
1
- name,status
2
- User,published
3
- Registration,unpublished
4
- Role,published
5
- Permission,published
6
- Country,published
7
- Region,published
8
- City,published
9
- Locality,published
1
+ name,status,categorisable
2
+ User,published,FALSE
3
+ Registration,unpublished,FALSE
4
+ Role,published,FALSE
5
+ Permission,published,FALSE
6
+ Country,published,FALSE
7
+ Region,published,FALSE
8
+ City,published,FALSE
9
+ Locality,published,FALSE
@@ -35,7 +35,9 @@ namespace 'usman' do
35
35
  destroy_all = false
36
36
  destroy_all = true if ["true", "t","1","yes","y"].include?(ENV["destroy_all"].to_s.downcase.strip)
37
37
 
38
- path = Usman::Engine.root.join('db', 'master_data', "#{cls_name.constantize.table_name}.csv")
38
+ path = Rails.root.join('db', 'master_data', "#{cls_name.constantize.table_name}.csv")
39
+ path = Usman::Engine.root.join('db', 'master_data', "#{cls_name.constantize.table_name}.csv") unless File.exists?(path)
40
+
39
41
  cls_name.constantize.destroy_all if destroy_all
40
42
  cls_name.constantize.import_data_file(path, true, verbose)
41
43
  # puts "Importing Completed".green if verbose
data/lib/usman/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Usman
2
- VERSION = '0.3.25'
2
+ VERSION = '0.3.26'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: usman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.25
4
+ version: 0.3.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - kpvarma
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-29 00:00:00.000000000 Z
11
+ date: 2017-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -107,7 +107,7 @@ dependencies:
107
107
  version: '0.1'
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: 0.1.26
110
+ version: 0.1.27
111
111
  type: :runtime
112
112
  prerelease: false
113
113
  version_requirements: !ruby/object:Gem::Requirement
@@ -117,7 +117,7 @@ dependencies:
117
117
  version: '0.1'
118
118
  - - ">="
119
119
  - !ruby/object:Gem::Version
120
- version: 0.1.26
120
+ version: 0.1.27
121
121
  - !ruby/object:Gem::Dependency
122
122
  name: pattana
123
123
  requirement: !ruby/object:Gem::Requirement