gettext_simple_rails 0.0.1 → 0.0.2

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: 8f86be4cc31cf06bfca2ded7ec383931acf7bbee
4
- data.tar.gz: b08add1067098dfc01d24c2a9eebd25e56f47006
3
+ metadata.gz: 0e38c32669d7fd2af3f78ff0ae9c42ef6fc695b9
4
+ data.tar.gz: ef1955873b59221d9fe492f46c3a38a41178c1da
5
5
  SHA512:
6
- metadata.gz: 8b13ef7dcfa94085a1d76f4575a35c91f59a946a6a750c54d28f5d484777b619bc7661e2d11ac19e5a293e827e9368b60398ef85f863a89661a62abe1dfa065b
7
- data.tar.gz: 6470cd0e81c04a29d14f46f4cd6a1422ec20b90d52c43c1e992e466a939f449dd7e2621e59c154514511826dfcd312e278068853d28df8b032d62468984830a7
6
+ metadata.gz: ef56d940a537a34f4b4cd944cb9975a9bc81d446b77a0a2eb0f8e0f71d60dd0c55ba3f673c9715bb31b8f0a2443a42cdb977f639af54b22ffb9e62d9024e3525
7
+ data.tar.gz: 4e5c63b37c29ca79ee3fd3d3369e03dda61c77b79dc5c7b0311cb5d7046fef1557fe092628ba8653e1946afbfb1c7d13e80bf8a1e3ec43ad75aea3fbb3b73be8
@@ -24,6 +24,16 @@ class GettextSimpleRails::ModelInspector
24
24
  end
25
25
  end
26
26
 
27
+ def paperclip_attachments
28
+ if !::Kernel.const_defined?("Paperclip")
29
+ return []
30
+ end
31
+
32
+ Paperclip::AttachmentRegistry.names_for(@clazz).each do |name|
33
+ yield(name)
34
+ end
35
+ end
36
+
27
37
  def snake_name
28
38
  return ::StringCases.camel_to_snake(clazz.name)
29
39
  end
@@ -0,0 +1,9 @@
1
+ class GettextSimpleRails::SimpleFormDetector
2
+ def simple_form_detected?
3
+ if ::Kernel.const_defined?("SimpleForm")
4
+ return true
5
+ end
6
+
7
+ return false
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module GettextSimpleRails
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -1,8 +1,3 @@
1
- # desc "Explaining what the task does"
2
- # task :gettext_simple_rails do
3
- # # Task goes here
4
- # end
5
-
6
1
  namespace :gettext_simple_rails do
7
2
  task "generate_model_translation_files" => :environment do
8
3
  GettextSimpleRails::ModelInspector.model_classes do |inspector|
@@ -28,6 +23,15 @@ namespace :gettext_simple_rails do
28
23
 
29
24
  fp.puts " end"
30
25
 
26
+ fp.puts ""
27
+ fp.puts " def self.paperclip_attachments"
28
+
29
+ inspector.paperclip_attachments do |name|
30
+ fp.puts " puts _('#{inspector.relationship_gettext_key(name)}')"
31
+ end
32
+
33
+ fp.puts " end"
34
+
31
35
  fp.puts ""
32
36
  fp.puts " def self.model_name"
33
37
  fp.puts " puts _('#{inspector.gettext_key}.one')"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gettext_simple_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kasper Johansen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-11 00:00:00.000000000 Z
11
+ date: 2014-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -82,6 +82,7 @@ files:
82
82
  - config/routes.rb
83
83
  - lib/gettext_simple_rails/engine.rb
84
84
  - lib/gettext_simple_rails/i18n_injector.rb
85
+ - lib/gettext_simple_rails/simple_form_detector.rb
85
86
  - lib/gettext_simple_rails/version.rb
86
87
  - lib/gettext_simple_rails/model_inspector.rb
87
88
  - lib/gettext_simple_rails.rb