catarse_settings_db 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: b36c108217855da398664c3a59c028fc313df67b
4
- data.tar.gz: f7854ce879ddbae0559be4de10b84494aa0bcb1b
3
+ metadata.gz: 6b545ddb28bb84458ae4994a26d2add507e9bbb7
4
+ data.tar.gz: 06013d2c56c053c6c84f56e3f5d193c11541fc1e
5
5
  SHA512:
6
- metadata.gz: 62bde62f65c46700f280b1d50a6a8c889ee384bbe3bef320cd4d512079397ea1e4213c24e1389435696f053207276f53d1f7de6d4e3ba17b12d510628c42c18e
7
- data.tar.gz: 496712e6bfd22124b2bf9a77cf63a126934343a5d89de47a6369625e713c4bda6ac6bf296eba3dd7fd20c26877ce4a7aa51854d9cb652349ca08896d653cd3ff
6
+ metadata.gz: a6d687d1b0e7f3a6c71376396d30da5028d8af9cd73da0d58a25ea3fb716cfef35a23b47028a59078371dde825a78cd556851a960dbf2c66b12bcc51625c3381
7
+ data.tar.gz: 457d5ba1ca968eac8f79ab8b48420a6cb873d0c61905ac8c2205f8a5362722d4ce8a9123eeccf649708a41134931a930007ca3d624b587cd98d2b24eb8b736af
@@ -29,11 +29,7 @@ module CatarseSettingsDb
29
29
  end
30
30
 
31
31
  def set key, value
32
- begin
33
- find_by_name(key).update_attribute :value, value
34
- rescue
35
- create!(name: key, value: value)
36
- end
32
+ find_or_create_by!(name: key).update(value: value)
37
33
  Rails.cache.write("/configurations/#{key}", value)
38
34
  value
39
35
  end
@@ -1,3 +1,3 @@
1
1
  module CatarseSettingsDb
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -0,0 +1,16 @@
1
+ require 'rails'
2
+ require 'rails/generators'
3
+ require 'rails/generators/migration'
4
+ require 'active_record'
5
+
6
+ class SettingsGenerator < Rails::Generators::Base
7
+ include Rails::Generators::Migration
8
+
9
+ def self.source_root
10
+ @source_root ||= File.join(File.dirname(__FILE__), '..', 'templates')
11
+ end
12
+
13
+ def create_migration_file
14
+ migration_template 'create_settings.rb', 'db/migrate/create_settings.rb'
15
+ end
16
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: catarse_settings_db
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
  - Antônio Roberto Silva
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-04-10 00:00:00.000000000 Z
12
+ date: 2014-06-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 4.0.3
20
+ version: 4.1.1
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: 4.0.3
27
+ version: 4.1.1
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: pg
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -98,6 +98,7 @@ files:
98
98
  - lib/catarse_settings_db.rb
99
99
  - lib/catarse_settings_db/engine.rb
100
100
  - lib/catarse_settings_db/version.rb
101
+ - lib/generators/settings_generator.rb
101
102
  - lib/tasks/catarse_settings_db_tasks.rake
102
103
  homepage: http://github.com/catarse/catarse_settings_db
103
104
  licenses: []
@@ -118,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
119
  version: '0'
119
120
  requirements: []
120
121
  rubyforge_project:
121
- rubygems_version: 2.2.0
122
+ rubygems_version: 2.2.2
122
123
  signing_key:
123
124
  specification_version: 4
124
125
  summary: Engine to store catarse settings in the database.