scaffold_plus 1.7.7 → 1.7.8

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
  SHA1:
3
- metadata.gz: 51c441c15ba6a2a7130df7efa99d9621c2370d3f
4
- data.tar.gz: c79f2488a4c9abfc03d945647b3b21edde86a3d8
3
+ metadata.gz: 9a8de459e175237fd6d5333753480595d776524e
4
+ data.tar.gz: f8421fe1fb8d53ef51fadb6c465d0dee66501db4
5
5
  SHA512:
6
- metadata.gz: a271d0c7241262bc89ce571734fce2681ee2608740ae190c990ac7054059a2bff19a60a4330ebc58f1af889c039b4c86b117d8a034ab1cfb4ef2008ce1838bb0
7
- data.tar.gz: 0a92fd6c1c5abf0bdc3629d59eee026fa001dd06397781b1c40b26072c70ebce45ccba1cf9263286c4417b341c11320034e69e94627b2bb9b2dcf6216aaa582a
6
+ metadata.gz: 00dca3e633506ad5ceac27a7366ca6829a234c8ed86edb95e321dc3942b4794e0a57c547f07145c2e6d98caaeb807c894fae365848b22b673c9880425738d98e
7
+ data.tar.gz: 7106a4ef8f5708e6184b25280e3bd4ed7211805b049bf22dbf1e28993bf3e3c8146805aa455cc657ce8408a34e54ff136b59d52a0a0fd4a00df33d013fa1f4d4
@@ -14,6 +14,10 @@ module ScaffoldPlus
14
14
  desc: 'Create a migration for added attributes'
15
15
  class_option :address, type: :boolean, default: true,
16
16
  desc: 'Add an address field to the migration'
17
+ class_option :before, type: :boolean, default: false,
18
+ desc: 'Add a line before generated text in model'
19
+ class_option :after, type: :boolean, default: false,
20
+ desc: 'Add a line after generated text in model'
17
21
  source_root File.expand_path('../templates', __FILE__)
18
22
 
19
23
  def add_migration
@@ -26,7 +30,8 @@ module ScaffoldPlus
26
30
  lng = options.longitude
27
31
  file = "app/models/#{name}.rb"
28
32
  prepend_to_file file, "require 'geodesic_wgs84'\n\n"
29
- lines = [
33
+ lines = options.before? ? [ "" ] : []
34
+ lines << [
30
35
  " def to_lat_lon",
31
36
  " [#{lat}, #{lng}]",
32
37
  " end",
@@ -49,6 +54,7 @@ module ScaffoldPlus
49
54
  " end",
50
55
  ""
51
56
  ]
57
+ lines << "" if options.after?
52
58
  inject_into_class file, class_name, lines.join("\n")
53
59
  end
54
60
 
@@ -1,3 +1,3 @@
1
1
  module ScaffoldPlus
2
- VERSION = "1.7.7"
2
+ VERSION = "1.7.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scaffold_plus
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.7
4
+ version: 1.7.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Volker Wiegand