dm-is-read_only 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --colour --format documentation
data/ChangeLog.md CHANGED
@@ -1,3 +1,12 @@
1
+ ### 0.2.0 / 2010-11-05
2
+
3
+ * Added {DataMapper::Resource::State::ReadOnly}:
4
+ * Inherits from the `Clean` state.
5
+ * Raises {DataMapper::ReadOnlyError} exceptions when `set` or `delete`
6
+ are called.
7
+ * Fixed a bug where read-only resources with relationships were not being
8
+ loaded.
9
+
1
10
  ### 0.1.1 / 2010-08-11
2
11
 
3
12
  * Override `saved?` in `DataMapper::Resource` to always return `true`,
data/Gemfile CHANGED
@@ -1,81 +1,104 @@
1
- source 'http://rubygems.org'
2
- dm = 'git://github.com/datamapper'
1
+ # If you're working on more than one datamapper gem at a time, then it's
2
+ # recommended to create a local Gemfile and use this instead of the git
3
+ # sources. This will make sure that you are developing against your
4
+ # other local datamapper sources that you currently work on. Gemfile.local
5
+ # will behave identically to the standard Gemfile apart from the fact that
6
+ # it fetches the datamapper gems from local paths. This means that you can
7
+ # use the same environment variables, like ADAPTER(S) or PLUGIN(S) when
8
+ # running
9
+ # bundle commands. Gemfile.local is added to .gitignore, so you don't need
10
+ # to worry about accidentally checking local development paths into git.
11
+ # In order to create a local Gemfile, all you need to do is run:
12
+ #
13
+ # bundle exec rake local_gemfile
14
+ #
15
+ # This will give you a Gemfile.local file that points to your local clones
16
+ # of the various datamapper gems. It's assumed that all datamapper repo
17
+ # clones reside in the same directory. You can use the Gemfile.local like
18
+ # so for running any bundle command:
19
+ #
20
+ # BUNDLE_GEMFILE=Gemfile.local bundle foo
21
+ #
22
+ # You can also specify which adapter(s) should be part of the bundle by
23
+ # setting an environment variable. This of course also works when using the
24
+ # Gemfile.local
25
+ #
26
+ # bundle foo # dm-sqlite-adapter
27
+ #
28
+ # ADAPTER=mysql bundle foo # dm-mysql-adapter
29
+ #
30
+ # ADAPTERS=sqlite,mysql bundle foo # dm-sqlite-adapter, dm-mysql-adapter
31
+ #
32
+ # Of course you can also use the ADAPTER(S) variable when using the
33
+ # Gemfile.local and running specs against selected adapters.
34
+ #
35
+ # For easily working with adapters supported on your machine, it's
36
+ # recommended that you first install all adapters that you are planning to
37
+ # use or work on by doing something like
38
+ #
39
+ # ADAPTERS=sqlite,mysql,postgres bundle install
40
+ #
41
+ # This will clone the various repositories and make them available to
42
+ # bundler. Once you have them installed you can easily switch between
43
+ # adapters for the various development tasks. Running something like
44
+ #
45
+ # ADAPTER=mysql bundle exec rake spec
46
+ #
47
+ # will make sure that the dm-mysql-adapter is part of the bundle, and will
48
+ # be used when running the specs.
49
+ #
50
+ # You can also specify which plugin(s) should be part of the bundle by
51
+ # setting an environment variable. This also works when using the
52
+ # Gemfile.local
53
+ #
54
+ # bundle foo # dm-migrations
55
+ #
56
+ # PLUGINS=dm-validations bundle foo # dm-migrations,
57
+ # # dm-validations
58
+ #
59
+ # PLUGINS=dm-validations,dm-types bundle foo # dm-migrations,
60
+ # # dm-validations,
61
+ # # dm-types
62
+ #
63
+ # Of course you can combine the PLUGIN(S) and ADAPTER(S) env vars to run
64
+ # specs for certain adapter/plugin combinations.
65
+ #
66
+ # Finally, to speed up running specs and other tasks, it's recommended to
67
+ # run
68
+ #
69
+ # bundle lock
70
+ #
71
+ # after running 'bundle install' for the first time. This will make
72
+ # 'bundle exec' run a lot faster compared to the unlocked version. With an
73
+ # unlocked bundle you would typically just run 'bundle install' from time
74
+ # to time to fetch the latest sources from upstream. When you locked your
75
+ # bundle, you need to run
76
+ #
77
+ # bundle install --relock
78
+ #
79
+ # to make sure to fetch the latest updates and then lock the bundle again.
80
+ # Gemfile.lock is added to the .gitignore file, so you don't need to worry
81
+ # about accidentally checking it into version control.
3
82
 
4
- group :runtime do
5
- # We bundle both AS and extlib while extlib compatibility needs to be kept
6
- # around. require 'dm-core' will ensure that only one is activated at any
7
- # time though. This is done by trying to require AS components and
8
- # fallback to requiring extlib in case a LoadError was rescued when
9
- # requiring AS code.
10
- #
11
- # Due to bundle exec activating all groups in the Gemfile, it's
12
- # recommended to run
13
- #
14
- # bundle install --without quality
15
- #
16
- # to have a development environment that is able to run the specs.
17
- # The problem is that metric_fu activates active_support=2.2.3 if we
18
- # comment out the gem 'activesupport' declaration - have a look below for
19
- # why we would want to do that (and a bit later, for why that's actually
20
- # not *strictly* necessary, but recommended)
21
- #
22
- # To run the specs using AS, leave this Gemfile as it is and just run:
23
- #
24
- # bundle install --without qality
25
- # ADAPTERS=sqlite3 bundle exec rake spec # or whatever adapter
26
- #
27
- # To run the specs using extlib, comment out the: gem 'activesupport' line
28
- # and run:
29
- #
30
- # bundle install --without quality
31
- # ADAPTERS=sqlite3 bundle exec rake spec # or whatever adapter
32
- #
33
- # If you want to run the quality tasks as provided by metric_fu and
34
- # related gems, you have to run:
35
- #
36
- # bundle install
37
- # bundle exec rake metrics:all
38
- #
39
- # Switch back to a bundle without quality gems before trying to run the
40
- # specs again:
41
- #
42
- # bundle install --without quality
43
- # ADAPTERS=sqlite3 bundle exec rake spec # or whatever adapter
44
- #
45
- # It was mentioned above that all this is not *strictly* necessary, and
46
- # this is true. Currently dm-core does the following as the first require
47
- # when checking for AS:
48
- #
49
- # require 'active_support/core_ext/object/singleton_class'
50
- #
51
- # Because this method is not present in activesupport <= 3.0.0.beta,
52
- # dm-core's feature detection will actually do the "right thing" and fall
53
- # back to extlib. However, since this is not the case for all dm-more gems
54
- # as well, the safest thing to do is to respect the more tedious workflow
55
- # for now, as it will at least be guaranteed to work the same for both
56
- # dm-core and dm-more.
57
- #
58
- # Note that this won't be an issue anymore once we dropped support for
59
- # extlib completely, or bundler folks decide to support something like
60
- # "bundle exec --without=foo rake spec" (which probably is not going to
61
- # happen anytime soon).
62
- #
83
+ source :rubygems
63
84
 
64
- if ENV['EXTLIB']
65
- gem 'extlib', '~> 0.9.15'
66
- else
67
- gem 'activesupport', '~> 3.0.0.beta3', :require => 'active_support'
68
- end
85
+ DATAMAPPER = 'http://github.com/datamapper'
86
+ DM_VERSION = '~> 1.0.0'
87
+ DO_VERSION = '~> 0.10.2'
88
+ DM_DO_ADAPTERS = %w[ sqlite postgres mysql oracle sqlserver ]
89
+ RAILS = 'http://github.com/rails/rails.git'
69
90
 
70
- gem 'dm-core', '~> 1.0.0'
91
+ if ENV['EXTLIB']
92
+ gem 'extlib', '~> 0.9.15', :git => '#{DATAMAPPER}/extlib.git'
93
+ else
94
+ gem 'activesupport', '~> 3.0.0', :git => RAILS,
95
+ :branch => '3-0-stable',
96
+ :require => nil
71
97
  end
72
98
 
73
- group :development do
74
- gem 'rake', '~> 0.8.7'
75
- gem 'jeweler', '~> 1.4.0', :git => 'git://github.com/technicalpickles/jeweler.git'
76
- end
99
+ gem 'dm-core', DM_VERSION, :git => "#{DATAMAPPER}/dm-core.git"
77
100
 
78
- group :doc do
101
+ group :development do
79
102
  case RUBY_PLATFORM
80
103
  when 'java'
81
104
  gem 'maruku', '~> 0.6.0'
@@ -83,15 +106,42 @@ group :doc do
83
106
  gem 'rdiscount', '~> 1.6.3'
84
107
  end
85
108
 
86
- gem 'yard', '~> 0.5.3'
109
+ gem 'rake', '~> 0.8.7'
110
+ gem 'ore', '~> 0.2.0'
111
+ gem 'ore-tasks', '~> 0.1.2'
112
+ gem 'rspec', '~> 2.0.0'
113
+ gem 'yard', '~> 0.6.0'
87
114
  end
88
115
 
89
- group :test do
90
- gem 'data_objects', '~> 0.10.2'
91
- gem 'do_sqlite3', '~> 0.10.2'
92
- gem 'dm-do-adapter', '~> 1.0.0'
93
- gem 'dm-sqlite-adapter', '~> 1.0.0'
94
- gem 'dm-migrations', '~> 1.0.0'
95
- end
116
+ group :datamapper do
117
+ # We need this because we want to pin these dependencies to their git
118
+ # master sources
119
+
120
+ adapters = ENV['ADAPTER'] || ENV['ADAPTERS']
121
+ adapters = adapters.to_s.tr(',', ' ').split.uniq - %w[ in_memory ]
122
+
123
+ if (do_adapters = DM_DO_ADAPTERS & adapters).any?
124
+ options = {}
125
+ options[:git] = "#{DATAMAPPER}/do.git" if ENV['DO_GIT'] == 'true'
96
126
 
97
- gem 'rspec', '~> 1.3.0', :group => [:development, :test]
127
+ gem 'data_objects', DO_VERSION, options.dup
128
+
129
+ do_adapters.each do |adapter|
130
+ adapter = 'sqlite3' if adapter == 'sqlite'
131
+ gem "do_#{adapter}", DO_VERSION, options.dup
132
+ end
133
+
134
+ gem 'dm-do-adapter', DM_VERSION, :git => "#{DATAMAPPER}/dm-do-adapter.git"
135
+ end
136
+
137
+ adapters.each do |adapter|
138
+ gem "dm-#{adapter}-adapter", DM_VERSION, :git => "#{DATAMAPPER}/dm-#{adapter}-adapter.git"
139
+ end
140
+
141
+ plugins = ENV['PLUGINS'] || ENV['PLUGIN']
142
+ plugins = plugins.to_s.tr(',', ' ').split.push('dm-migrations').uniq
143
+
144
+ plugins.each do |plugin|
145
+ gem plugin, DM_VERSION, :git => "#{DATAMAPPER}/#{plugin}.git"
146
+ end
147
+ end
data/Rakefile CHANGED
@@ -1,8 +1,15 @@
1
1
  require 'rubygems'
2
- require 'bundler'
3
2
 
4
3
  begin
5
- Bundler.setup(:development, :doc)
4
+ require 'bundler'
5
+ rescue LoadError => e
6
+ STDERR.puts e.message
7
+ STDERR.puts "Run `gem install bundler` to install Bundler."
8
+ exit e.status_code
9
+ end
10
+
11
+ begin
12
+ Bundler.setup(:development)
6
13
  rescue Bundler::BundlerError => e
7
14
  STDERR.puts e.message
8
15
  STDERR.puts "Run `bundle install` to install missing gems"
@@ -10,26 +17,12 @@ rescue Bundler::BundlerError => e
10
17
  end
11
18
 
12
19
  require 'rake'
13
- require 'jeweler'
14
-
15
- Jeweler::Tasks.new do |gem|
16
- gem.name = 'dm-is-read_only'
17
- gem.license = 'MIT'
18
- gem.summary = %Q{A DataMapper plugin for making Models absolutely read-only.}
19
- gem.description = %Q{A DataMapper plugin for making Models absolutely read-only.}
20
- gem.email = 'postmodern.mod3@gmail.com'
21
- gem.homepage = 'http://github.com/postmodern/dm-is-read_only'
22
- gem.authors = ['Postmodern']
23
- gem.has_rdoc = 'yard'
24
- end
25
20
 
26
- require 'spec/rake/spectask'
27
- Spec::Rake::SpecTask.new(:spec) do |spec|
28
- spec.libs += ['lib', 'spec']
29
- spec.spec_files = FileList['spec/**/*_spec.rb']
30
- spec.spec_opts = ['--options', '.specopts']
31
- end
21
+ require 'ore/tasks'
22
+ Ore::Tasks.new
32
23
 
24
+ require 'rspec/core/rake_task'
25
+ RSpec::Core::RakeTask.new
33
26
  task :default => :spec
34
27
 
35
28
  require 'yard'
@@ -1,77 +1,10 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
1
  # -*- encoding: utf-8 -*-
5
2
 
6
- Gem::Specification.new do |s|
7
- s.name = %q{dm-is-read_only}
8
- s.version = "0.1.1"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Postmodern"]
12
- s.date = %q{2010-08-11}
13
- s.description = %q{A DataMapper plugin for making Models absolutely read-only.}
14
- s.email = %q{postmodern.mod3@gmail.com}
15
- s.extra_rdoc_files = [
16
- "ChangeLog.md",
17
- "LICENSE.txt",
18
- "README.md"
19
- ]
20
- s.files = [
21
- ".gitignore",
22
- ".specopts",
23
- ".yardopts",
24
- "ChangeLog.md",
25
- "Gemfile",
26
- "Gemfile.lock",
27
- "LICENSE.txt",
28
- "README.md",
29
- "Rakefile",
30
- "VERSION",
31
- "dm-is-read_only.gemspec",
32
- "lib/dm-is-read_only.rb",
33
- "lib/dm-is-read_only/is/read_only.rb",
34
- "spec/classes/backend_model.rb",
35
- "spec/classes/read_only_model.rb",
36
- "spec/integration/read_only_spec.rb",
37
- "spec/spec_helper.rb"
38
- ]
39
- s.has_rdoc = %q{yard}
40
- s.homepage = %q{http://github.com/postmodern/dm-is-read_only}
41
- s.licenses = ["MIT"]
42
- s.require_paths = ["lib"]
43
- s.rubygems_version = %q{1.3.7}
44
- s.summary = %q{A DataMapper plugin for making Models absolutely read-only.}
45
- s.test_files = [
46
- "spec/classes/backend_model.rb",
47
- "spec/classes/read_only_model.rb",
48
- "spec/integration/read_only_spec.rb",
49
- "spec/spec_helper.rb"
50
- ]
51
-
52
- if s.respond_to? :specification_version then
53
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
54
- s.specification_version = 3
55
-
56
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
57
- s.add_runtime_dependency(%q<activesupport>, ["~> 3.0.0.beta3"])
58
- s.add_runtime_dependency(%q<dm-core>, ["~> 1.0.0"])
59
- s.add_development_dependency(%q<rake>, ["~> 0.8.7"])
60
- s.add_development_dependency(%q<jeweler>, ["~> 1.4.0"])
61
- s.add_development_dependency(%q<rspec>, ["~> 1.3.0"])
62
- else
63
- s.add_dependency(%q<activesupport>, ["~> 3.0.0.beta3"])
64
- s.add_dependency(%q<dm-core>, ["~> 1.0.0"])
65
- s.add_dependency(%q<rake>, ["~> 0.8.7"])
66
- s.add_dependency(%q<jeweler>, ["~> 1.4.0"])
67
- s.add_dependency(%q<rspec>, ["~> 1.3.0"])
68
- end
69
- else
70
- s.add_dependency(%q<activesupport>, ["~> 3.0.0.beta3"])
71
- s.add_dependency(%q<dm-core>, ["~> 1.0.0"])
72
- s.add_dependency(%q<rake>, ["~> 0.8.7"])
73
- s.add_dependency(%q<jeweler>, ["~> 1.4.0"])
74
- s.add_dependency(%q<rspec>, ["~> 1.3.0"])
3
+ begin
4
+ Ore::Specification.new do |gemspec|
5
+ # custom logic here
75
6
  end
7
+ rescue NameError
8
+ STDERR.puts "The 'dm-is-read_only.gemspec' file requires Ore."
9
+ STDERR.puts "Run `gem install ore` to install Ore."
76
10
  end
77
-
data/gemspec.yml ADDED
@@ -0,0 +1,18 @@
1
+ name: dm-is-read_only
2
+ version: 0.2.0
3
+ summary: DataMapper plugin for making models absolutely read-only.
4
+ description:
5
+ A DataMapper plugin for making models absolutely read-only.
6
+
7
+ license: MIT
8
+ authors: Postmodern
9
+ email: postmodern.mod3@gmail.com
10
+ homepage: http://github.com/postmodern/dm-is-read_only
11
+ has_yard: true
12
+
13
+ dependencies:
14
+ dm-core: ~> 1.0.0
15
+
16
+ development_dependencies:
17
+ bundler: ~> 1.0.0
18
+ yard: ~> 0.6.0
@@ -0,0 +1,4 @@
1
+ module DataMapper
2
+ class ReadOnlyError < RuntimeError
3
+ end
4
+ end
@@ -1,3 +1,5 @@
1
+ require 'dm-is-read_only/resource/state/read_only'
2
+
1
3
  module DataMapper
2
4
  module Is
3
5
  module ReadOnly
@@ -67,13 +69,13 @@ module DataMapper
67
69
  module InstanceMethods
68
70
  #
69
71
  # Overrides the default `persisted_state` method, to always use
70
- # `DataMapper::Resource::State::Immutable`.
72
+ # {DataMapper::Resource::State::ReadOnly}.
71
73
  #
72
- # @return [DataMapper::Resource::State::Immutable]
73
- # The immutable state.
74
+ # @return [DataMapper::Resource::State::ReadOnly]
75
+ # The read-only state.
74
76
  #
75
77
  def persisted_state
76
- @_state ||= Resource::State::Immutable.new(self)
78
+ @_state ||= Resource::State::ReadOnly.new(self)
77
79
  end
78
80
 
79
81
  #
@@ -82,24 +84,12 @@ module DataMapper
82
84
  # @param [DataMapper::Resource::State] new_state
83
85
  # The new state to use.
84
86
  #
85
- # @return [DataMapper::Resource::State::Immutabe]
86
- # Always returns the immutable state.
87
+ # @return [DataMapper::Resource::State::ReadOnly]
88
+ # Always returns the read-only state.
87
89
  #
88
90
  def persisted_state=(new_state)
89
91
  persisted_state
90
92
  end
91
-
92
- #
93
- # Determines whether the resource has been saved.
94
- #
95
- # @return [true]
96
- # Always returns true.
97
- #
98
- # @since 0.1.1
99
- #
100
- def saved?
101
- true
102
- end
103
93
  end
104
94
  end
105
95
  end
@@ -0,0 +1,38 @@
1
+ require 'dm-is-read_only/exceptions/read_only_error'
2
+
3
+ module DataMapper
4
+ module Resource
5
+ class State
6
+ #
7
+ # A lazy-loaded and unmodifiable resource.
8
+ #
9
+ class ReadOnly < Clean
10
+
11
+ #
12
+ # Receives modifications attempts on a read-only resource.
13
+ #
14
+ # @raise [ReadOnlyError]
15
+ # A read-only resource cannot be modified.
16
+ #
17
+ # @since 0.2.0
18
+ #
19
+ def set(subject,value)
20
+ raise(ReadOnlyError,"ReadOnly resource cannot be modified",caller)
21
+ end
22
+
23
+ #
24
+ # Receives deletion attempts on a read-only resource.
25
+ #
26
+ # @raise [ReadOnlyError]
27
+ # A read-only resource cannot be deleted.
28
+ #
29
+ # @since 0.2.0
30
+ #
31
+ def delete
32
+ raise(ReadOnlyError,"ReadOnly resource cannot be deleted",caller)
33
+ end
34
+
35
+ end
36
+ end
37
+ end
38
+ end
@@ -12,4 +12,6 @@ class ReadOnlyModel
12
12
 
13
13
  property :value, String
14
14
 
15
+ has 0..n, :related_models
16
+
15
17
  end
@@ -0,0 +1,11 @@
1
+ require 'classes/read_only_model'
2
+
3
+ class RelatedModel
4
+
5
+ include DataMapper::Resource
6
+
7
+ property :id, Serial
8
+
9
+ belongs_to :read_only_model
10
+
11
+ end
@@ -2,6 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  require 'classes/backend_model'
4
4
  require 'classes/read_only_model'
5
+ require 'classes/related_model'
5
6
 
6
7
  describe DataMapper::Is::ReadOnly do
7
8
  context "migrate!" do
@@ -49,46 +50,63 @@ describe DataMapper::Is::ReadOnly do
49
50
 
50
51
  context "immutable" do
51
52
  before(:all) do
53
+ RelatedModel.auto_migrate!
52
54
  BackendModel.auto_migrate!
53
55
  BackendModel.create(:value => 'x')
54
56
 
55
57
  @resource = ReadOnlyModel.first(:value => 'x')
58
+
59
+ RelatedModel.create(:read_only_model => @resource)
60
+
61
+ @related_resource = RelatedModel.first
56
62
  end
57
63
 
58
- it "should prevent modifying properties" do
64
+ it "should prevent setting properties" do
59
65
  lambda {
60
66
  @resource.value = 'z'
61
- }.should raise_error()
67
+ }.should raise_error(DataMapper::ReadOnlyError)
62
68
  end
63
69
 
64
- it "should prevent calling save" do
70
+ it "should prevent updating resources" do
65
71
  lambda {
66
- @resource.save
67
- }.should raise_error()
72
+ @resource.update(:value => 'z')
73
+ }.should raise_error(DataMapper::ReadOnlyError)
68
74
  end
69
75
 
70
- it "should prevent calling save!" do
71
- lambda {
72
- @resource.save!
73
- }.should raise_error()
76
+ it "should mark read-only resources as saved" do
77
+ @resource.should be_saved
74
78
  end
75
79
 
76
- it "should prevent calling destroy" do
77
- @resource.destroy
80
+ it "should mark read-only resources as clean" do
81
+ @resource.should be_clean
82
+ end
78
83
 
79
- original = BackendModel.first(:value => 'x')
80
- original.should_not be_nil
84
+ it "should not mark read-only resources as dirty" do
85
+ @resource.should_not be_dirty
81
86
  end
82
87
 
83
- it "should prevent calling destroy!" do
84
- @resource.destroy!
88
+ it "should return true when calling save" do
89
+ @resource.save.should == true
90
+ end
91
+
92
+ it "should return true when calling save!" do
93
+ @resource.save!.should == true
94
+ end
85
95
 
86
- original = BackendModel.first(:value => 'x')
87
- original.should_not be_nil
96
+ it "should prevent calling destroy" do
97
+ lambda {
98
+ @resource.destroy
99
+ }.should raise_error(DataMapper::ReadOnlyError)
88
100
  end
89
101
 
90
- it "should have an Immutable persisted state" do
91
- @resource.persisted_state.class.should == DataMapper::Resource::State::Immutable
102
+ it "should prevent calling destroy!" do
103
+ lambda {
104
+ @resource.destroy!
105
+ }.should raise_error(DataMapper::ReadOnlyError)
106
+ end
107
+
108
+ it "should have an ReadOnly persisted state" do
109
+ @resource.persisted_state.class.should == DataMapper::Resource::State::ReadOnly
92
110
  end
93
111
 
94
112
  it "should prevent forcibly changing the persisted state" do
@@ -103,5 +121,10 @@ describe DataMapper::Is::ReadOnly do
103
121
  it "should report the resource as having already been saved" do
104
122
  @resource.should be_saved
105
123
  end
124
+
125
+ it "should still allow relationships with non-read-only models" do
126
+ @resource.related_models.first.should == @related_resource
127
+ @related_resource.read_only_model.should == @resource
128
+ end
106
129
  end
107
130
  end
data/spec/spec_helper.rb CHANGED
@@ -1,15 +1,4 @@
1
- require 'rubygems'
2
- require 'bundler'
3
-
4
- begin
5
- Bundler.setup(:runtime, :test)
6
- rescue Bundler::BundlerError => e
7
- STDERR.puts e.message
8
- STDERR.puts "Run `bundle install` to install missing gems"
9
- exit e.status_code
10
- end
11
-
12
- require 'spec'
1
+ require 'rspec'
13
2
  require 'dm-core/spec/setup'
14
3
  require 'dm-core/spec/lib/adapter_helpers'
15
4
 
@@ -17,6 +6,6 @@ require 'dm-is-read_only'
17
6
 
18
7
  DataMapper::Spec.setup
19
8
 
20
- Spec::Runner.configure do |config|
9
+ RSpec.configure do |config|
21
10
  config.extend(DataMapper::Spec::Adapters::Helpers)
22
11
  end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
8
- - 1
9
- version: 0.1.1
7
+ - 2
8
+ - 0
9
+ version: 0.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Postmodern
@@ -14,27 +14,26 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-08-11 00:00:00 -07:00
17
+ date: 2010-11-05 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
- name: activesupport
21
+ name: dm-core
22
22
  requirement: &id001 !ruby/object:Gem::Requirement
23
23
  none: false
24
24
  requirements:
25
25
  - - ~>
26
26
  - !ruby/object:Gem::Version
27
27
  segments:
28
- - 3
28
+ - 1
29
29
  - 0
30
30
  - 0
31
- - beta3
32
- version: 3.0.0.beta3
31
+ version: 1.0.0
33
32
  type: :runtime
34
33
  prerelease: false
35
34
  version_requirements: *id001
36
35
  - !ruby/object:Gem::Dependency
37
- name: dm-core
36
+ name: bundler
38
37
  requirement: &id002 !ruby/object:Gem::Requirement
39
38
  none: false
40
39
  requirements:
@@ -45,11 +44,11 @@ dependencies:
45
44
  - 0
46
45
  - 0
47
46
  version: 1.0.0
48
- type: :runtime
47
+ type: :development
49
48
  prerelease: false
50
49
  version_requirements: *id002
51
50
  - !ruby/object:Gem::Dependency
52
- name: rake
51
+ name: yard
53
52
  requirement: &id003 !ruby/object:Gem::Requirement
54
53
  none: false
55
54
  requirements:
@@ -57,68 +56,37 @@ dependencies:
57
56
  - !ruby/object:Gem::Version
58
57
  segments:
59
58
  - 0
60
- - 8
61
- - 7
62
- version: 0.8.7
63
- type: :development
64
- prerelease: false
65
- version_requirements: *id003
66
- - !ruby/object:Gem::Dependency
67
- name: jeweler
68
- requirement: &id004 !ruby/object:Gem::Requirement
69
- none: false
70
- requirements:
71
- - - ~>
72
- - !ruby/object:Gem::Version
73
- segments:
74
- - 1
75
- - 4
59
+ - 6
76
60
  - 0
77
- version: 1.4.0
61
+ version: 0.6.0
78
62
  type: :development
79
63
  prerelease: false
80
- version_requirements: *id004
81
- - !ruby/object:Gem::Dependency
82
- name: rspec
83
- requirement: &id005 !ruby/object:Gem::Requirement
84
- none: false
85
- requirements:
86
- - - ~>
87
- - !ruby/object:Gem::Version
88
- segments:
89
- - 1
90
- - 3
91
- - 0
92
- version: 1.3.0
93
- type: :development
94
- prerelease: false
95
- version_requirements: *id005
96
- description: A DataMapper plugin for making Models absolutely read-only.
64
+ version_requirements: *id003
65
+ description: A DataMapper plugin for making models absolutely read-only.
97
66
  email: postmodern.mod3@gmail.com
98
67
  executables: []
99
68
 
100
69
  extensions: []
101
70
 
102
71
  extra_rdoc_files:
103
- - ChangeLog.md
104
- - LICENSE.txt
105
72
  - README.md
106
73
  files:
107
- - .gitignore
108
- - .specopts
74
+ - .rspec
109
75
  - .yardopts
110
76
  - ChangeLog.md
111
77
  - Gemfile
112
- - Gemfile.lock
113
78
  - LICENSE.txt
114
79
  - README.md
115
80
  - Rakefile
116
- - VERSION
117
81
  - dm-is-read_only.gemspec
82
+ - gemspec.yml
118
83
  - lib/dm-is-read_only.rb
84
+ - lib/dm-is-read_only/exceptions/read_only_error.rb
119
85
  - lib/dm-is-read_only/is/read_only.rb
86
+ - lib/dm-is-read_only/resource/state/read_only.rb
120
87
  - spec/classes/backend_model.rb
121
88
  - spec/classes/read_only_model.rb
89
+ - spec/classes/related_model.rb
122
90
  - spec/integration/read_only_spec.rb
123
91
  - spec/spec_helper.rb
124
92
  has_rdoc: yard
@@ -135,7 +103,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
135
103
  requirements:
136
104
  - - ">="
137
105
  - !ruby/object:Gem::Version
138
- hash: -555306040342459765
139
106
  segments:
140
107
  - 0
141
108
  version: "0"
@@ -145,17 +112,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
112
  - - ">="
146
113
  - !ruby/object:Gem::Version
147
114
  segments:
148
- - 0
149
- version: "0"
115
+ - 1
116
+ - 3
117
+ - 6
118
+ version: 1.3.6
150
119
  requirements: []
151
120
 
152
- rubyforge_project:
121
+ rubyforge_project: dm-is-read_only
153
122
  rubygems_version: 1.3.7
154
123
  signing_key:
155
124
  specification_version: 3
156
- summary: A DataMapper plugin for making Models absolutely read-only.
125
+ summary: DataMapper plugin for making models absolutely read-only.
157
126
  test_files:
158
- - spec/classes/backend_model.rb
159
- - spec/classes/read_only_model.rb
160
127
  - spec/integration/read_only_spec.rb
161
- - spec/spec_helper.rb
data/.gitignore DELETED
@@ -1,11 +0,0 @@
1
- doc
2
- pkg
3
- tmp/*
4
- spec/db
5
- .DS_Store
6
- .bundle
7
- .yardoc
8
- *.db
9
- *.log
10
- *.swp
11
- *~
data/.specopts DELETED
@@ -1 +0,0 @@
1
- --colour --format specdoc
data/Gemfile.lock DELETED
@@ -1,54 +0,0 @@
1
- GIT
2
- remote: git://github.com/technicalpickles/jeweler.git
3
- revision: b996854
4
- specs:
5
- jeweler (1.4.0)
6
- bundler (>= 0.9.5)
7
- gemcutter (>= 0.1.0)
8
- git (>= 1.2.5)
9
- rake
10
-
11
- GEM
12
- remote: http://rubygems.org/
13
- specs:
14
- activesupport (3.0.0.rc)
15
- addressable (2.2.0)
16
- data_objects (0.10.2)
17
- addressable (~> 2.1)
18
- dm-core (1.0.0)
19
- addressable (~> 2.1)
20
- extlib (~> 0.9.15)
21
- dm-do-adapter (1.0.0)
22
- data_objects (~> 0.10.1)
23
- dm-core (~> 1.0.0)
24
- dm-migrations (1.0.0)
25
- dm-core (~> 1.0.0)
26
- dm-sqlite-adapter (1.0.0)
27
- dm-do-adapter (~> 1.0.0)
28
- do_sqlite3 (~> 0.10.2)
29
- do_sqlite3 (0.10.2)
30
- data_objects (= 0.10.2)
31
- extlib (0.9.15)
32
- gemcutter (0.6.1)
33
- git (1.2.5)
34
- rake (0.8.7)
35
- rdiscount (1.6.5)
36
- rspec (1.3.0)
37
- yard (0.5.8)
38
-
39
- PLATFORMS
40
- ruby
41
-
42
- DEPENDENCIES
43
- activesupport (~> 3.0.0.beta3)
44
- data_objects (~> 0.10.2)
45
- dm-core (~> 1.0.0)
46
- dm-do-adapter (~> 1.0.0)
47
- dm-migrations (~> 1.0.0)
48
- dm-sqlite-adapter (~> 1.0.0)
49
- do_sqlite3 (~> 0.10.2)
50
- jeweler (~> 1.4.0)!
51
- rake (~> 0.8.7)
52
- rdiscount (~> 1.6.3)
53
- rspec (~> 1.3.0)
54
- yard (~> 0.5.3)
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.1.1