finalist-readonly_fields 0.0.1
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.
- data/Manifest +8 -0
- data/README.rdoc +26 -0
- data/Rakefile +23 -0
- data/lib/locale/en.yml +5 -0
- data/lib/readonly_fields.rb +9 -0
- data/rails/init.rb +2 -0
- data/readonly_fields.gemspec +30 -0
- data/spec/spec_helper.rb +10 -0
- metadata +67 -0
data/Manifest
ADDED
data/README.rdoc
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
= readonly_fields
|
2
|
+
|
3
|
+
A simple rails plugin to make fields readonly. This means that it will add
|
4
|
+
an error to fields when they are changed.
|
5
|
+
|
6
|
+
== Installation
|
7
|
+
|
8
|
+
./script/plugin install git://github.com/finalist/readonly_fields.git
|
9
|
+
|
10
|
+
== Usage
|
11
|
+
|
12
|
+
class Post < ActiveRecord::Base
|
13
|
+
|
14
|
+
readonly_fields :title, :on => :update
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
All the usual validation options are available. See the documentation on
|
19
|
+
ActiveRecord::Validations::ClassMethods#validates_each.
|
20
|
+
|
21
|
+
== i18n
|
22
|
+
|
23
|
+
Translate it with the "readonly" key as you would normally do. See the
|
24
|
+
Rails guide on internationalization for this.
|
25
|
+
|
26
|
+
Copyright (c) 2009 Iain Hecker, released under the MIT license
|
data/Rakefile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'spec/rake/spectask'
|
3
|
+
require 'echoe'
|
4
|
+
|
5
|
+
Echoe.new('readonly_fields', '0.0.1') do |p|
|
6
|
+
p.description = "Make fields readonly"
|
7
|
+
p.url = "http://github.com/finalist/readonly_fields"
|
8
|
+
p.author = "Iain Hecker"
|
9
|
+
p.email = "iain@finalist.com"
|
10
|
+
p.ignore_pattern = ["tmp/*", "script/*"]
|
11
|
+
p.development_dependencies = []
|
12
|
+
end
|
13
|
+
|
14
|
+
Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
|
15
|
+
|
16
|
+
desc 'Default: run specs.'
|
17
|
+
task :default => :spec
|
18
|
+
|
19
|
+
desc 'Run the specs'
|
20
|
+
Spec::Rake::SpecTask.new(:spec) do |t|
|
21
|
+
t.spec_opts = ['--colour --format progress --loadby mtime --reverse']
|
22
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
23
|
+
end
|
data/lib/locale/en.yml
ADDED
data/rails/init.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{readonly_fields}
|
5
|
+
s.version = "0.0.1"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Iain Hecker"]
|
9
|
+
s.date = %q{2009-07-04}
|
10
|
+
s.description = %q{Make fields readonly}
|
11
|
+
s.email = %q{iain@finalist.com}
|
12
|
+
s.extra_rdoc_files = ["lib/locale/en.yml", "lib/readonly_fields.rb", "README.rdoc"]
|
13
|
+
s.files = ["lib/locale/en.yml", "lib/readonly_fields.rb", "Manifest", "rails/init.rb", "Rakefile", "README.rdoc", "readonly_fields.gemspec", "spec/spec_helper.rb"]
|
14
|
+
s.homepage = %q{http://github.com/finalist/readonly_fields}
|
15
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Readonly_fields", "--main", "README.rdoc"]
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
s.rubyforge_project = %q{readonly_fields}
|
18
|
+
s.rubygems_version = %q{1.3.4}
|
19
|
+
s.summary = %q{Make fields readonly}
|
20
|
+
|
21
|
+
if s.respond_to? :specification_version then
|
22
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
23
|
+
s.specification_version = 3
|
24
|
+
|
25
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
26
|
+
else
|
27
|
+
end
|
28
|
+
else
|
29
|
+
end
|
30
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
begin
|
2
|
+
require File.dirname(__FILE__) + '/../../../../spec/spec_helper'
|
3
|
+
rescue LoadError
|
4
|
+
puts "You need to install rspec in your base app"
|
5
|
+
exit
|
6
|
+
end
|
7
|
+
|
8
|
+
plugin_spec_dir = File.dirname(__FILE__)
|
9
|
+
ActiveRecord::Base.logger = Logger.new(plugin_spec_dir + "/debug.log")
|
10
|
+
|
metadata
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: finalist-readonly_fields
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Iain Hecker
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-07-04 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Make fields readonly
|
17
|
+
email: iain@finalist.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- lib/locale/en.yml
|
24
|
+
- lib/readonly_fields.rb
|
25
|
+
- README.rdoc
|
26
|
+
files:
|
27
|
+
- lib/locale/en.yml
|
28
|
+
- lib/readonly_fields.rb
|
29
|
+
- Manifest
|
30
|
+
- rails/init.rb
|
31
|
+
- Rakefile
|
32
|
+
- README.rdoc
|
33
|
+
- readonly_fields.gemspec
|
34
|
+
- spec/spec_helper.rb
|
35
|
+
has_rdoc: false
|
36
|
+
homepage: http://github.com/finalist/readonly_fields
|
37
|
+
post_install_message:
|
38
|
+
rdoc_options:
|
39
|
+
- --line-numbers
|
40
|
+
- --inline-source
|
41
|
+
- --title
|
42
|
+
- Readonly_fields
|
43
|
+
- --main
|
44
|
+
- README.rdoc
|
45
|
+
require_paths:
|
46
|
+
- lib
|
47
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: "0"
|
52
|
+
version:
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: "1.2"
|
58
|
+
version:
|
59
|
+
requirements: []
|
60
|
+
|
61
|
+
rubyforge_project: readonly_fields
|
62
|
+
rubygems_version: 1.2.0
|
63
|
+
signing_key:
|
64
|
+
specification_version: 3
|
65
|
+
summary: Make fields readonly
|
66
|
+
test_files: []
|
67
|
+
|