persistent_settings 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -14,6 +14,14 @@ Install
14
14
 
15
15
  bundle install
16
16
 
17
+ Create the migrations
18
+
19
+ rails g persistent_settings:migration
20
+
21
+ Run those migrations
22
+
23
+ rake db:migrate
24
+
17
25
  ## Usage
18
26
 
19
27
  The gem adds a new class called Settings. It will automatically create new
@@ -1,3 +1,4 @@
1
+ require 'rails'
1
2
  require 'persistent_settings'
2
3
 
3
4
  ::ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
@@ -0,0 +1,17 @@
1
+ require 'rails/generators'
2
+ require 'rails/generators/migration'
3
+
4
+ module PersistentSettings
5
+ class MigrationGenerator < ::Rails::Generators::Base
6
+ include ::Rails::Generators::Migration
7
+ source_root File.expand_path('../templates', __FILE__)
8
+
9
+ def install
10
+ migration_template "create_settings_table.rb", "db/migrate/create_settings_table.rb"
11
+ end
12
+
13
+ def self.next_migration_number(path)
14
+ Time.now.utc.strftime("%Y%m%d%H%M%S")
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,12 @@
1
+ class CreateSettingsTable < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :settings do |t|
4
+ t.string :var
5
+ t.string :value
6
+ end
7
+ end
8
+
9
+ def self.down
10
+ drop_table :settings
11
+ end
12
+ end
@@ -0,0 +1,5 @@
1
+ module PersistentSettings
2
+ module Rails
3
+ class Engine < ::Rails::Engine ; end
4
+ end
5
+ end
@@ -1,3 +1,8 @@
1
1
  require "active_record"
2
2
  require "settings"
3
3
  require "settings/version"
4
+
5
+ unless ::Rails.version < "3.1"
6
+ require "persistent_settings/rails/engine"
7
+ require "generators/persistent_settings/migration_generator"
8
+ end
@@ -1,3 +1,3 @@
1
1
  class Settings < ActiveRecord::Base
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "persistent_settings"
6
- s.version = "1.0.0"
6
+ s.version = "1.0.1"
7
7
  s.authors = ["David Padilla"]
8
8
  s.email = ["david@crowdint.com"]
9
9
  s.homepage = ""
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
18
  s.require_paths = ["lib"]
19
19
 
20
- s.add_dependency 'activerecord', '~> 3'
20
+ s.add_dependency 'rails', '~> 3.0'
21
21
  s.add_development_dependency "cucumber" , "~> 1.1.4"
22
22
  s.add_development_dependency "rake"
23
23
  s.add_development_dependency "rspec" , "~> 2.7.0"
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'rails'
1
2
  require 'active_record'
2
3
  require 'persistent_settings'
3
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: persistent_settings
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,19 +12,19 @@ cert_chain: []
12
12
  date: 2011-12-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: activerecord
16
- requirement: &70264754810580 !ruby/object:Gem::Requirement
15
+ name: rails
16
+ requirement: &70238115921840 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: '3'
21
+ version: '3.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70264754810580
24
+ version_requirements: *70238115921840
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: cucumber
27
- requirement: &70264754810100 !ruby/object:Gem::Requirement
27
+ requirement: &70238115921360 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.1.4
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70264754810100
35
+ version_requirements: *70238115921360
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &70264754809720 !ruby/object:Gem::Requirement
38
+ requirement: &70238115920980 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70264754809720
46
+ version_requirements: *70238115920980
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec
49
- requirement: &70264754809180 !ruby/object:Gem::Requirement
49
+ requirement: &70238115920440 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 2.7.0
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70264754809180
57
+ version_requirements: *70238115920440
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: sqlite3
60
- requirement: &70264754808680 !ruby/object:Gem::Requirement
60
+ requirement: &70238115936300 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '1.3'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70264754808680
68
+ version_requirements: *70238115936300
69
69
  description: Simple global Settings class for ActiveRecord based applications
70
70
  email:
71
71
  - david@crowdint.com
@@ -81,7 +81,10 @@ files:
81
81
  - features/settings.feature
82
82
  - features/step_definitions/settings_steps.rb
83
83
  - features/support/env.rb
84
+ - lib/generators/persistent_settings/migration_generator.rb
85
+ - lib/generators/persistent_settings/templates/create_settings_table.rb
84
86
  - lib/persistent_settings.rb
87
+ - lib/persistent_settings/rails/engine.rb
85
88
  - lib/settings.rb
86
89
  - lib/settings/version.rb
87
90
  - persistent_settings.gemspec