dm-is-nested_set 0.9.7 → 0.9.8

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/History.txt CHANGED
@@ -1 +1,3 @@
1
+ === 0.9.8 / 2008-12-07
1
2
 
3
+ * No changes this version
data/Manifest.txt CHANGED
@@ -10,3 +10,5 @@ lib/dm-is-nested_set/is/version.rb
10
10
  spec/integration/nested_set_spec.rb
11
11
  spec/spec.opts
12
12
  spec/spec_helper.rb
13
+ tasks/install.rb
14
+ tasks/spec.rb
data/Rakefile CHANGED
@@ -1,58 +1,25 @@
1
- require 'rubygems'
2
- require 'spec'
3
- require 'spec/rake/spectask'
4
1
  require 'pathname'
2
+ require 'rubygems'
3
+
4
+ ROOT = Pathname(__FILE__).dirname.expand_path
5
+ JRUBY = RUBY_PLATFORM =~ /java/
6
+ WINDOWS = Gem.win_platform?
7
+ SUDO = (WINDOWS || JRUBY) ? '' : ('sudo' unless ENV['SUDOLESS'])
5
8
 
6
- ROOT = Pathname(__FILE__).dirname.expand_path
7
9
  require ROOT + 'lib/dm-is-nested_set/is/version'
8
10
 
9
- AUTHOR = "Sindre Aarsaether"
10
- EMAIL = "sindre [a] identu [d] no"
11
- GEM_NAME = "dm-is-nested_set"
11
+ AUTHOR = 'Sindre Aarsaether'
12
+ EMAIL = 'sindre [a] identu [d] no'
13
+ GEM_NAME = 'dm-is-nested_set'
12
14
  GEM_VERSION = DataMapper::Is::NestedSet::VERSION
13
- GEM_DEPENDENCIES = [["dm-core", GEM_VERSION]]
14
- GEM_CLEAN = ["log", "pkg"]
15
- GEM_EXTRAS = { :has_rdoc => true, :extra_rdoc_files => %w[ README.txt LICENSE TODO ] }
16
-
17
- PROJECT_NAME = "datamapper"
18
- PROJECT_URL = "http://github.com/sam/dm-more/tree/master/dm-is-nested_set"
19
- PROJECT_DESCRIPTION = PROJECT_SUMMARY = "DataMapper plugin allowing the creation of nested sets from data models"
20
-
21
- require ROOT.parent + 'tasks/hoe'
22
-
23
- task :default => [ :spec ]
24
-
25
- WIN32 = (RUBY_PLATFORM =~ /win32|mingw|cygwin/) rescue nil
26
- SUDO = WIN32 ? '' : ('sudo' unless ENV['SUDOLESS'])
27
-
28
- desc "Install #{GEM_NAME} #{GEM_VERSION} (default ruby)"
29
- task :install => [ :package ] do
30
- sh "#{SUDO} gem install --local pkg/#{GEM_NAME}-#{GEM_VERSION} --no-update-sources", :verbose => false
31
- end
32
-
33
- desc "Uninstall #{GEM_NAME} #{GEM_VERSION} (default ruby)"
34
- task :uninstall => [ :clobber ] do
35
- sh "#{SUDO} gem uninstall #{GEM_NAME} -v#{GEM_VERSION} -I -x", :verbose => false
36
- end
37
-
38
- namespace :jruby do
39
- desc "Install #{GEM_NAME} #{GEM_VERSION} with JRuby"
40
- task :install => [ :package ] do
41
- sh %{#{SUDO} jruby -S gem install --local pkg/#{GEM_NAME}-#{GEM_VERSION} --no-update-sources}, :verbose => false
42
- end
43
- end
15
+ GEM_DEPENDENCIES = [['dm-core', "~>#{GEM_VERSION}"], ['dm-adjust', "~>#{GEM_VERSION}"]]
16
+ GEM_CLEAN = %w[ log pkg coverage ]
17
+ GEM_EXTRAS = { :has_rdoc => true, :extra_rdoc_files => %w[ README.txt LICENSE TODO History.txt ] }
44
18
 
45
- desc 'Run specifications'
46
- Spec::Rake::SpecTask.new(:spec) do |t|
47
- t.spec_opts << '--options' << 'spec/spec.opts' if File.exists?('spec/spec.opts')
48
- t.spec_files = Pathname.glob((ROOT + 'spec/**/*_spec.rb').to_s)
19
+ PROJECT_NAME = 'datamapper'
20
+ PROJECT_URL = "http://github.com/sam/dm-more/tree/master/#{GEM_NAME}"
21
+ PROJECT_DESCRIPTION = PROJECT_SUMMARY = 'DataMapper plugin allowing the creation of nested sets from data models'
49
22
 
50
- begin
51
- t.rcov = ENV.has_key?('NO_RCOV') ? ENV['NO_RCOV'] != 'true' : true
52
- t.rcov_opts << '--exclude' << 'spec'
53
- t.rcov_opts << '--text-summary'
54
- t.rcov_opts << '--sort' << 'coverage' << '--sort-reverse'
55
- rescue Exception
56
- # rcov not installed
57
- end
23
+ [ ROOT, ROOT.parent ].each do |dir|
24
+ Pathname.glob(dir.join('tasks/**/*.rb').to_s).each { |f| require f }
58
25
  end
@@ -24,26 +24,24 @@ module DataMapper
24
24
  belongs_to :parent, :class_name => self.name, :child_key => options[:child_key], :order => [:lft.asc]
25
25
  has n, :children, :class_name => self.name, :child_key => options[:child_key], :order => [:lft.asc]
26
26
 
27
- before :save do
28
- if self.new_record?
29
- if !self.parent
30
- # TODO must change for nested sets
31
- self.root ? self.move_without_saving(:into => self.root) : self.move_without_saving(:to => 1)
32
- elsif self.parent && !self.lft
33
- self.move_without_saving(:into => self.parent)
34
- end
35
- else
36
-
37
- if self.nested_set_scope != self.original_nested_set_scope
38
- # TODO detach from old list first. many edge-cases here, need good testing
39
- self.lft,self.rgt = nil,nil
40
- #puts "#{self.root.inspect} - #{[self.nested_set_scope,self.original_nested_set_scope].inspect}"
41
- self.root ? self.move_without_saving(:into => self.root) : self.move_without_saving(:to => 1)
42
- elsif (self.parent && !self.lft) || (self.parent != self.ancestor)
43
- # if the parent is set, we try to move this into that parent, otherwise move into root.
44
- self.parent ? self.move_without_saving(:into => self.parent) : self.move_without_saving(:into => self.class.root)
45
- end
27
+ before :create do
28
+ if !self.parent
29
+ # TODO must change for nested sets
30
+ self.root ? self.move_without_saving(:into => self.root) : self.move_without_saving(:to => 1)
31
+ elsif self.parent && !self.lft
32
+ self.move_without_saving(:into => self.parent)
33
+ end
34
+ end
46
35
 
36
+ before :update do
37
+ if self.nested_set_scope != self.original_nested_set_scope
38
+ # TODO detach from old list first. many edge-cases here, need good testing
39
+ self.lft,self.rgt = nil,nil
40
+ #puts "#{self.root.inspect} - #{[self.nested_set_scope,self.original_nested_set_scope].inspect}"
41
+ self.root ? self.move_without_saving(:into => self.root) : self.move_without_saving(:to => 1)
42
+ elsif (self.parent && !self.lft) || (self.parent != self.ancestor)
43
+ # if the parent is set, we try to move this into that parent, otherwise move into root.
44
+ self.parent ? self.move_without_saving(:into => self.parent) : self.move_without_saving(:into => self.class.root)
47
45
  end
48
46
  end
49
47
 
@@ -1,7 +1,7 @@
1
1
  module DataMapper
2
2
  module Is
3
3
  module NestedSet
4
- VERSION = "0.9.7"
4
+ VERSION = '0.9.8'
5
5
  end
6
6
  end
7
7
  end
@@ -1,10 +1,10 @@
1
- require 'rubygems'
2
1
  require 'pathname'
2
+ require 'rubygems'
3
3
 
4
- gem 'dm-core', '~>0.9.7'
4
+ gem 'dm-core', '~>0.9.8'
5
5
  require 'dm-core'
6
6
 
7
- gem 'dm-adjust', '~>0.9.7'
7
+ #gem 'dm-adjust', '~>0.9.8'
8
8
  require 'dm-adjust'
9
9
 
10
- require Pathname(__FILE__).dirname.expand_path / 'dm-is-nested_set' / 'is' / 'nested_set.rb'
10
+ require Pathname(__FILE__).dirname.expand_path / 'dm-is-nested_set' / 'is' / 'nested_set'
data/spec/spec.opts CHANGED
@@ -1,2 +1 @@
1
- --format specdoc
2
1
  --colour
data/spec/spec_helper.rb CHANGED
@@ -1,23 +1,26 @@
1
+ require 'pathname'
1
2
  require 'rubygems'
2
- gem 'rspec', '>=1.1.3'
3
+
4
+ gem 'rspec', '~>1.1.11'
3
5
  require 'spec'
4
- require 'pathname'
5
- require Pathname(__FILE__).dirname.expand_path.parent + 'lib/dm-is-nested_set'
6
+
7
+ ROOT = Pathname(__FILE__).dirname.parent.expand_path
8
+
9
+ # use local dm-adjust if running from dm-more directly
10
+ lib = ROOT.parent.join('dm-adjust', 'lib').expand_path
11
+ $LOAD_PATH.unshift(lib) if lib.directory?
12
+
13
+ require ROOT + 'lib/dm-is-nested_set'
6
14
 
7
15
  def load_driver(name, default_uri)
8
16
  return false if ENV['ADAPTER'] != name.to_s
9
17
 
10
- lib = "do_#{name}"
11
-
12
18
  begin
13
- gem lib, '~>0.9.7'
14
- require lib
15
19
  DataMapper.setup(name, ENV["#{name.to_s.upcase}_SPEC_URI"] || default_uri)
16
20
  DataMapper::Repository.adapters[:default] = DataMapper::Repository.adapters[name]
17
- DataObjects::Sqlite3.logger = DataObjects::Logger.new(Pathname(__FILE__).dirname+'dm.log',0)
18
21
  true
19
- rescue Gem::LoadError => e
20
- warn "Could not load #{lib}: #{e}"
22
+ rescue LoadError => e
23
+ warn "Could not load do_#{name}: #{e}"
21
24
  false
22
25
  end
23
26
  end
data/tasks/install.rb ADDED
@@ -0,0 +1,13 @@
1
+ def sudo_gem(cmd)
2
+ sh "#{SUDO} #{RUBY} -S gem #{cmd}", :verbose => false
3
+ end
4
+
5
+ desc "Install #{GEM_NAME} #{GEM_VERSION}"
6
+ task :install => [ :package ] do
7
+ sudo_gem "install --local pkg/#{GEM_NAME}-#{GEM_VERSION} --no-update-sources"
8
+ end
9
+
10
+ desc "Uninstall #{GEM_NAME} #{GEM_VERSION}"
11
+ task :uninstall => [ :clobber ] do
12
+ sudo_gem "uninstall #{GEM_NAME} -v#{GEM_VERSION} -Ix"
13
+ end
data/tasks/spec.rb ADDED
@@ -0,0 +1,25 @@
1
+ begin
2
+ gem 'rspec', '~>1.1.11'
3
+ require 'spec'
4
+ require 'spec/rake/spectask'
5
+
6
+ task :default => [ :spec ]
7
+
8
+ desc 'Run specifications'
9
+ Spec::Rake::SpecTask.new(:spec) do |t|
10
+ t.spec_opts << '--options' << 'spec/spec.opts' if File.exists?('spec/spec.opts')
11
+ t.spec_files = Pathname.glob((ROOT + 'spec/**/*_spec.rb').to_s)
12
+
13
+ begin
14
+ gem 'rcov', '~>0.8'
15
+ t.rcov = JRUBY ? false : (ENV.has_key?('NO_RCOV') ? ENV['NO_RCOV'] != 'true' : true)
16
+ t.rcov_opts << '--exclude' << 'spec'
17
+ t.rcov_opts << '--text-summary'
18
+ t.rcov_opts << '--sort' << 'coverage' << '--sort-reverse'
19
+ rescue LoadError
20
+ # rcov not installed
21
+ end
22
+ end
23
+ rescue LoadError
24
+ # rspec not installed
25
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dm-is-nested_set
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.7
4
+ version: 0.9.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sindre Aarsaether
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-11-18 00:00:00 -08:00
12
+ date: 2008-12-07 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -18,19 +18,19 @@ dependencies:
18
18
  version_requirement:
19
19
  version_requirements: !ruby/object:Gem::Requirement
20
20
  requirements:
21
- - - "="
21
+ - - ~>
22
22
  - !ruby/object:Gem::Version
23
- version: 0.9.7
23
+ version: 0.9.8
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
- name: hoe
27
- type: :development
26
+ name: dm-adjust
27
+ type: :runtime
28
28
  version_requirement:
29
29
  version_requirements: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: 1.8.2
33
+ version: 0.9.8
34
34
  version:
35
35
  description: DataMapper plugin allowing the creation of nested sets from data models
36
36
  email:
@@ -43,6 +43,7 @@ extra_rdoc_files:
43
43
  - README.txt
44
44
  - LICENSE
45
45
  - TODO
46
+ - History.txt
46
47
  files:
47
48
  - History.txt
48
49
  - LICENSE
@@ -56,6 +57,8 @@ files:
56
57
  - spec/integration/nested_set_spec.rb
57
58
  - spec/spec.opts
58
59
  - spec/spec_helper.rb
60
+ - tasks/install.rb
61
+ - tasks/spec.rb
59
62
  has_rdoc: true
60
63
  homepage: http://github.com/sam/dm-more/tree/master/dm-is-nested_set
61
64
  post_install_message: