bamboo_legals 0.1.0 → 0.1.8

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: 339a9e831d587b9a9d727bc022ae399bce0a3362
4
- data.tar.gz: b9c8e5bb3f7261252b394225ae8f30e602d39c50
3
+ metadata.gz: 91213be293ef5f836ec9c44c6e796b030b0a603b
4
+ data.tar.gz: 3d0d44c0cdd7f3d8859f83ad077912292f9b833d
5
5
  SHA512:
6
- metadata.gz: 7bcf0204f7c542fb50f349aede43dad23c374c3fa9ad1f8ada87bbe90f782e944fa7b996bec54b25e3bda790926f271d78024e066ad85b71b023f3b4d8ae8177
7
- data.tar.gz: 8875a1a7e6a6d76d39a53216dd33d44db68688dc7c73bf471b17d6c524d05a53d19dc519ece59864ff91c460cd933b06324568788a15ccb2414035eb2e76b23c
6
+ metadata.gz: 76d96cf7c2f0256951371eb302a00ce020c28a7e0a52e8607241b4e323f05aeea22c40a71fb2207abb95897db8b3dba6acd7b199a8864f826d490174a79e84b0
7
+ data.tar.gz: 84f95bf02e5ac1b48151f4eb4dda5d99c318631fda3b5a512f922c44f539131f81e0f2f3f89492db58f561ff10b10f1f72ee4f23bacdaa51ac55b5204c1e7439
@@ -20,13 +20,17 @@ def run_generator(get_type)
20
20
  end
21
21
 
22
22
  if type
23
+
24
+ # get path to /home/mislav/.rvm/gems/ruby-2.3.1/gems/bamboo_legals-0.1.1/lib/templates
25
+ temp_path = "#{File.dirname(__FILE__)}/templates"
26
+
23
27
  overwrite_migration
24
- overwrite_model(type)
28
+ overwrite_model(type, temp_path)
25
29
 
26
- create_admin_controller(type)
27
- create_controller(type)
28
- create_admin_views(type)
29
- create_views(type)
30
+ create_admin_controller(type, temp_path)
31
+ create_controller(type, temp_path)
32
+ create_admin_views(type, temp_path)
33
+ create_views(type, temp_path)
30
34
 
31
35
  overwrite_routes
32
36
  print_manual(type)
@@ -1,7 +1,7 @@
1
- def create_admin_controller(type)
1
+ def create_admin_controller(type, temp_path)
2
2
  # find the legal controller
3
3
  controller_path = "app/controllers/admin/legals_controller.rb"
4
- template_controller_path = "bamboo_legals/bamboo_legals_lib/templates/#{type}/admin_legals_controller.txt"
4
+ template_controller_path = "#{temp_path}/#{type}/admin_legals_controller.txt"
5
5
 
6
6
  new_controller_text = File.open(template_controller_path).read
7
7
  File.write(controller_path, new_controller_text)
@@ -9,10 +9,10 @@ def create_admin_controller(type)
9
9
  puts "++ Created -> #{controller_path}"
10
10
  end
11
11
 
12
- def create_controller(type)
12
+ def create_controller(type, temp_path)
13
13
  # find the legal controller
14
14
  controller_path = "app/controllers/legals_controller.rb"
15
- template_controller_path = "bamboo_legals/bamboo_legals_lib/templates/#{type}/legals_controller.txt"
15
+ template_controller_path = "#{temp_path}/#{type}/legals_controller.txt"
16
16
 
17
17
  new_controller_text = File.open(template_controller_path).read
18
18
  File.write(controller_path, new_controller_text)
@@ -1,7 +1,7 @@
1
- def overwrite_model(type)
1
+ def overwrite_model(type, temp_path)
2
2
  # find the legal model
3
3
  model_path = "app/models/legal.rb"
4
- template_model_path = "bamboo_legals/bamboo_legals_lib/templates/#{type}/legal.txt"
4
+ template_model_path = "#{temp_path}/#{type}/legal.txt"
5
5
 
6
6
  new_model_text = File.open(template_model_path).read
7
7
  File.write(model_path, new_model_text)
@@ -10,7 +10,7 @@ def overwrite_model(type)
10
10
 
11
11
  if type == "multilingual"
12
12
  model_translation_path = "app/models/legal_translation.rb"
13
- template_model_translation_path = "bamboo_legals/bamboo_legals_lib/templates/#{type}/legal_translation.txt"
13
+ template_model_translation_path = "#{temp_path}/#{type}/legal_translation.txt"
14
14
 
15
15
  new_model_translation_text = File.open(template_model_translation_path).read
16
16
  File.write(model_translation_path, new_model_translation_text)
@@ -1,11 +1,11 @@
1
- def create_admin_views(type)
1
+ def create_admin_views(type, temp_path)
2
2
  admin_view_dir_path = 'app/views/admin/legals/'
3
3
 
4
4
  # create directory for legal views in admin
5
5
  Dir.mkdir admin_view_dir_path
6
6
 
7
7
  # find all template views
8
- template_views_path = "bamboo_legals/bamboo_legals_lib/templates/#{type}/admin_views/"
8
+ template_views_path = "#{temp_path}/#{type}/admin_views/"
9
9
  Dir.entries(template_views_path).each do |template|
10
10
  next if template == "." or template == ".."
11
11
 
@@ -17,14 +17,14 @@ def create_admin_views(type)
17
17
  end
18
18
  end
19
19
 
20
- def create_views(type)
20
+ def create_views(type, temp_path)
21
21
  view_dir_path = 'app/views/legals/'
22
22
 
23
23
  # create directory for legal views
24
24
  Dir.mkdir view_dir_path
25
25
 
26
26
  # find all template views
27
- template_views_path = "bamboo_legals/bamboo_legals_lib/templates/#{type}/views/"
27
+ template_views_path = "#{temp_path}/#{type}/views/"
28
28
  Dir.entries(template_views_path).each do |template|
29
29
  next if template == "." or template == ".."
30
30
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bamboo_legals
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mislav Kvesić