bamboolab_contact_form 0.0.16 → 0.0.17

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/bamboolab_contact_form +34 -30
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2cdbadafdd5c727b857af179732ab0e370433227
4
- data.tar.gz: bbef63d3ff2c92e23efebc678aa9e5a743725a10
3
+ metadata.gz: 7b7fdb3d0ae9782895e9da88777ad8e63f21a54d
4
+ data.tar.gz: 495e129539b47297f0621f49cfa09e6ab35d09d2
5
5
  SHA512:
6
- metadata.gz: f4717c798d01b35463d0da378a8dd4269861e02c645b877077bc9fe9df5cebe8add084c1c01686665b7b0a345bb3dec0d40cad545e289370d896a89cc01056ad
7
- data.tar.gz: 2a919581b4757a027873a68cab02e738143cc8fae6485bbea2ab6f8c6edb4004128a9ffd72c4aef76934da2ac9c2c89828ab07986564ddc58aef405bfa00d7f5
6
+ metadata.gz: 8e16a0674790d7abdca010b308b7ae7f18a3fbc26ed136aac0b444c91007a3bcddec7a8c57b211f1db893cca2d408c5383e231eb37c1eb849362213191ed9327
7
+ data.tar.gz: b4a8765bc1644a482b4d3a34fd034911623b67580495225aa9985e95285958fc6774c211677e2e7a25e068580597b57fd44eb09130af66c03ae376e0437e3ff2
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  arg = ARGV
4
- name_arg = arg[0]
4
+ name_arg = arg[0] || "message"
5
5
  fields = arg[1].split(", ") || "[name:text_field, email:email_field, content:text_area]"
6
6
  fields.first.slice!(0)
7
7
  fields.last.slice!(-1)
@@ -11,7 +11,6 @@ if name_arg
11
11
  save = name_arg.split(":")[1]
12
12
  end
13
13
 
14
-
15
14
  mailer_arg = arg[2] || "[kvesic.mislav@gmail.com, name]"
16
15
  mailer = mailer_arg.split(", ") unless mailer_arg == "nil"
17
16
  unless mailer_arg == "nil"
@@ -23,32 +22,37 @@ require 'bamboolab_contact_form'
23
22
 
24
23
  form = Bamboolab_contact_form.new(name, fields, mailer)
25
24
 
26
- system("rails generate controller #{name}s")
27
-
28
- unless save
29
- form.model
30
- form.controller
31
- else
32
-
33
- fields_string = ""
34
- fields.each do |field|
35
- type = field.split(":")[1]
36
- if type == "text_field" or type == "email_field"
37
- fields_string << " #{field.split(":")[0]}:string"
38
- elsif type == "text_area"
39
- fields_string << " #{field.split(":")[0]}:text"
40
- end
41
- end
42
-
43
- system("rails generate model #{name.capitalize}#{fields_string}")
44
- form.model_save
45
- form.controller_save
46
- end
47
-
48
- form.helper
49
- form.view
25
+ if save == "destroy"
26
+ system("rails generate controller #{name}s")
27
+
28
+ unless save
29
+ form.model
30
+ form.controller
31
+ else
32
+ fields_string = ""
33
+ fields.each do |field|
34
+ type = field.split(":")[1]
35
+ if type == "text_field" or type == "email_field"
36
+ fields_string << " #{field.split(":")[0]}:string"
37
+ elsif type == "text_area"
38
+ fields_string << " #{field.split(":")[0]}:text"
39
+ end
40
+ end
41
+
42
+ system("rails generate model #{name.capitalize}#{fields_string}")
43
+ form.model_save
44
+ form.controller_save
45
+ end
46
+
47
+ form.helper
48
+ form.view
49
+
50
+ system("rails generate mailer #{name}s") unless mailer_arg=="nil"
51
+ form.mailer unless mailer_arg=="nil"
52
+ form.notice
53
+ else
54
+ system("rails destroy controller #{name}s")
55
+ system("rails destroy model #{name}")
56
+ system("rails destroy mailer #{name}s")
50
57
 
51
- system("rails generate mailer #{name}s") unless mailer_arg=="nil"
52
- form.mailer unless mailer_arg=="nil"
53
-
54
- form.notice
58
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bamboolab_contact_form
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.16
4
+ version: 0.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mislav Kvesić
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-04 00:00:00.000000000 Z
11
+ date: 2016-10-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Form out of the box.
14
14
  email: kvesic.mislav@gmail.com