Commits

Michael Granger committed d6887cd

Split out from the library gem

  • Participants
  • Parent commits 7c227f9

Comments (0)

Files changed (8)

+^ChangeLog$
+^lib/treequel/shell\.rb$
+hoe-deveiate -v0.1.1
+treequel -v1.10.0
+loggability -v0.4.0
+trollop -v 1.16.2
+highline -v 1.6.12
+sysexits -v 1.0.2
+
+#!/usr/bin/env bash
+
+# This is an RVM Project .rvmrc file, used to automatically load the ruby
+# development environment upon cd'ing into the directory
+
+environment_id="ruby-1.9.3@treequel"
+
+if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
+	&& -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]; then
+	echo "Using ${environment_id}"
+	. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
+
+	if [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]]; then
+		. "${rvm_path:-$HOME/.rvm}/hooks/after_use"
+	fi
+else
+	# If the environment file has not yet been created, use the RVM CLI to select.
+	if ! rvm --create use  "$environment_id"
+	then
+		echo "Failed to create RVM environment '${environment_id}'."
+		exit 1
+	fi
+fi
+
+filename=".rvm.gems"
+if [[ -s "$filename" ]]; then
+	rvm gemset import "$filename"
+fi
+
+echo "Happy LDAPing!"
+echo

File History.rdoc

+== v1.9.1 [2012-06-07] Michael Granger <ged@FaerieMUD.org>
+
+- Fix dependency on eliminated file.
+
+
+== v1.9.0 [2012-06-06] Michael Granger <ged@FaerieMUD.org>
+
+- Convert to Loggability for logging
+- Update README, use Fivefish if available.
+
+
+== v1.8.6 [2012-03-20] Michael Granger <ged@FaerieMUD.org>
+
+- Fix encoding of directory strings under Ruby 1.9 and newer versions
+  of Ruby-LDAP.
+- Update the examples.
+
+
+== v1.8.5 [2012-03-07] Michael Granger <ged@FaerieMUD.org>
+
+- Fix an edge-case bug in LDIF-generation logic. Thanks to Mahlon E. Smith
+  for the report and the pair to fix it.
+
+
+== v1.8.4 [2012-02-02] Michael Granger <ged@FaerieMUD.org>
+
+- Fixed a bug with handling of BOOLEAN values in Treequel::Model. Thanks to
+  Patricio Bruna <pbruna@it-linux.cl> for the bug report.
+
+
+== v1.8.3 [2012-01-24] Michael Granger <ged@FaerieMUD.org>
+
+- A fix for Treequel::Model#save LDIF. Thanks to Patricio Bruna <pbruna@it-linux.cl> for
+  pointing out the problem.
+
+
+== v1.8.2 [2011-12-19] Michael Granger <ged@FaerieMUD.org>
+
+- Fixing Treequel::Model#create by merging ADD and DELETE mods
+  generated by #modifications.
+- Don't include non-lengthable ivars in
+  Treequel::Schema#ivar_descriptions (thanks to Ben Bleything for
+  reporting this).
+
+
+== v1.8.1 [2011-12-05] Michael Granger <ged@FaerieMUD.org>
+
+- Fixed #eql? implementation by using the hash-value instead of just
+  comparing DNs.
+
+
+== v1.8.0 [2011-12-05] Michael Granger <ged@FaerieMUD.org>
+
+- Added signature for changeset fa0d500e2dee
+
+
+== v1.8.0 [2011-12-05] Michael Granger <ged@FaerieMUD.org>
+
+- Implemented #eql? for Treequel::Branch for correct behavior in
+  Array#-, Hash#[], etc.
+
+
+== v1.7.2 [2011-11-30] Michael Granger <ged@FaerieMUD.org>
+
+- Added signature for changeset a8a3bca987c3
+
+== v1.7.2 [2011-11-29] Michael Granger <ged@FaerieMUD.org>
+
+- Add a workaround for Time objects used in generalizedTime fields,
+  since Time has a #to_ary.
+- Columns down in treewhat output instead of columns across
+- Fix inheritance of syntax for datatype conversion
+
+
+== v1.7.1 [2011-11-28] Michael Granger <ged@FaerieMUD.org>
+
+- Modified filter expressions to eliminate unnecessary ORing
+- Efficiency fixes for Treequel::Model#modifications (delete/add -> replace)
+- Fixing missing DN attribute/s on Treequel::Model objects created via
+  attribute traversal methods.
+- Log errors added during validation at ERROR level
+
+
+== v1.7.0 [2011-11-09] Michael Granger <ged@FaerieMUD.org>
+
+- Treat Treequel::Model#[]= with a nil value on a SINGLE-VALUE
+  attribute as a delete.
+- Splat the filterspec used in Branchset#not to avoid unnecessary
+  filter clauses.
+- Efficiency fix for Treequel::Branch#must_attribute_types
+- Removed some of the more-redundant/verbose debugging.
+- Added Branchset#first with an argument, and a #not mutator.
+
+
+== v1.6.0 [2011-10-06] Michael Granger <ged@FaerieMUD.org>
+
+- Adding workaround for vendored "sysexits" library under MacOX X 10.7
+- Add a log message to Treequel::Model#validate if some validations
+  fail.
+- Added convenience mutator to Treequel::Branchset for selecting
+  operational attributes.
+- De-Yard the API docs
+- Some fixes for JRuby + jruby-ldap
+- Use a modern timezone for the Time tests
+- Add a copy constructor to Treequel::Directory to avoid two directory
+  objects sharing the same connection
+- Adding support for Sun OpenDS schema artifacts (fixes #11)
+  * various workarounds for malformed objectClass and attributeType
+    declarations
+  * Regex encoding fixes for 1.9.2
+  * Treequel::Schema.strict_parse_mode flag for enabling the old
+    (strict) parsing behavior.
+
+
+== v1.5.3 [2011-04-07] Michael Granger <ged@FaerieMUD.org>
+
+- Added signature for changeset 1f396aca7d8b
+
+== v1.5.3 [2011-04-07] Michael Granger <ged@FaerieMUD.org>
+
+* Don't pollute the gemspec with Yard-only options
+* Adding a --no-tls flag to the treequel shell
+* Updated the 'treewhat' schema tool.
+* Show additional details for some schema objects.
+* Adding schema artifacts to the treewhat command
+* Include regular attributes (in addition to operational ones) in the
+  root_dse, as AD stores everything in regular attributes.
+
+== v1.5.2 [2011-03-17] Michael Granger <ged@FaerieMUD.org>
+
+* Manual updates
+* Fixing bad time tests uncovered by the DST switch
+* Adding an ActiveDirectory schema dump for testing
+* Fix for Github issue [ged/treequel GH-1] (closes #7)
+
+
+== v1.5.1 [2011-02-25] Michael Granger <ged@FaerieMUD.org>
+
+* Adding handling of operational attributes to Treequel::Model schema
+  validations, updated the subschema test data to a recent OpenLDAP.
+
+
+== v1.5.0 [2011-02-24] Michael Granger <ged@FaerieMUD.org>
+
+* Make Treequel::Model::ObjectClass Enumerable
+* Add a default directory to Treequel::Model for creating and
+  searching
+* Fix delegation to a method that takes a block for
+  Treequel::Delegation
+* Consistently delete the DN from the entry hash when constructing
+  branches and model objects
+* Fix Treequel::Branch#-
+* Fix Treequel::Branchset#to_hash
+* Make dependencies not so pessimistic.
+
+
+== v1.4.4 [2011-02-10] Michael Granger <ged@FaerieMUD.org>
+
+* Add the .gemtest and Manifest to the manifest, bump patch version.
+* Make Treequel testable via Gem Testers
+* Hack to work around the pointer-mismanagement of LDAP::Mod
+
+
+== v1.4.3 [2011-02-10] Michael Granger <ged@FaerieMUD.org>
+
+* Added gem-testers support
+* Added a monkeypatch to work around a memory-corruption issue in 
+  ruby-ldap.
+
+
+== v1.4.2 [2011-02-07] Michael Granger <ged@FaerieMUD.org>
+
+Fixed missing DEFAULT_EDITOR constant.
+
+
+== v1.4.1 [2011-02-02] Michael Granger <ged@FaerieMUD.org>
+
+More Treequel shell cleanup based on feedback from Michael Hix.
+
+* Fix the signature of the 'quit' command.
+* Consistently verify RDN arguments where they're used.
+
+
+== v1.4.1 [2011-02-02] Michael Granger <ged@FaerieMUD.org>
+
+Bugfix:
+
+* Fixed result error as fatal exception in Treequel shell
+
+== v1.4.0 [2011-01-31] Michael Granger <ged@FaerieMUD.org>
+
+Enhancements:
+
+* Added a new method: Treequel::Directory#connected?
+* Adding reconnect support to the treequel shell
+
+Bugfixes:
+
+* Fixed a bug in Treequel::Branch#copy.
+* Escape filter metacharacters in simple filter components
+
+
+== v1.3.2
+
+Bugfix:
+
+* Ensure the entry hash that's passed to Treequel::Model#apply_applicable_mixins isn't modified; fixes a bug when modifying a new unsaved Model object.
+
+
+== v1.3.1 [2011-01-17] Michael Granger <ged@FaerieMUD.org>
+
+Fixed a bug that caused DN attributes in objects created via Treequel::Model.new_from_entry to be doubled.
+
+
+== v1.3.0 [2011-01-13] Michael Granger <ged@FaerieMUD.org>
+
+Enhancements:
+
+* Made Treequel::Model act more like an ORM -- changes made to the object aren't synced
+  with the directory until #save is called. New methods:
+  - Treequel::Model#save
+  - Treequel::Model#modifications
+  - Treequel::Model#modifications_ldif
+  - Treequel::Model#validate
+  - Treequel::Model#valid?
+  - Treequel::Model#errors
+  - Treequel::Model#revert
+  - Treequel::Model#modified?
+  - Treequel::Model#after_initialize
+  - Treequel::Model#before_validation
+  - Treequel::Model#after_validation
+  - Treequel::Model#before_save
+  - Treequel::Model#before_create
+  - Treequel::Model#before_update
+  - Treequel::Model#after_create
+  - Treequel::Model#after_update
+  - Treequel::Model#after_save
+  - Treequel::Model#before_destroy
+  - Treequel::Model#after_destroy
+  New classes:
+  - Treequel::Model::Errors
+  - Treequel::ValidationFailed
+* Extracted the controls behavior and rewrote the control specs to use it. This is
+  so people who may wish to implement their own controls can ensure that it's
+  compatible with Treequel.
+* Added a directory-introspection tool (treewhat)
+* Added Treequel::Model::ObjectClass.create for easy creation of entries that conform
+  to an objectClass mixin's criteria
+* Treequel::Directory.root_dse now returns Treequel::Branches
+* Added Treequel::Directory#reconnect.
+
+Bugfixes:
+
+* Fixed a bug in Treequel::Branch#merge for values that need conversion
+* Simplified and removed duplication from the logging code
+* Fixed a bug in the proxy method for single-letter attribute names.
+* Monkeypatched Date for LDAP time type conversions
+* Change the return values of unset attributes to distinguish between 
+  SINGLE and non-SINGLE attributes
+* Treequel::Branch
+  - Check for explicit nil DN in .new
+  - Check for nil parent_dn in #parent
+  - Use 'top' instead of :top as objectClass default
+  - Don't cache attempts to fetch invalid attributes
+
+
+== v1.2.2 [2010-12-14] Michael Granger <ged@FaerieMUD.org>
+
+Bugfixes for Treequel::Branch, Treequel::Model.
+
+
+== v1.2.1 [2010-12-13] Michael Granger <ged@FaerieMUD.org>
+
+- Converted to Hoe.
+
+Bugfix:
+
+- objectClasses listed in Treequel::Model::ObjectClass.model_objectclasses
+  can be Strings, too.
+
+== v1.2.0 [2010-11-30] Michael Granger <ged@FaerieMUD.org>
+
+- Added hash-key conversion so Branches can be constructed with
+  Symbol-key hashargs.
+- Adding 'Treequel::Branchset#from' mutator for changing the base DN.
+- Fixed treequel shell's cp to support relative and absolute DNs
+- Converted to RSpec 2.0

File Manifest.txt

+ChangeLog
+History.rdoc
+Manifest.txt
+README.rdoc
+Rakefile
+bin/treeirb
+bin/treequel
+bin/treewhat
+lib/treequel/shell.rb
+= Treequel-Shell
+
+home :: https://bitbucket.org/ged/Treequel-Shell
+code :: http://repo.deveiate.org/Treequel-Shell
+docs :: http://deveiate.org/code/treequel-shell
+github :: http://github.com/ged/treequel-shell
+
+
+== Description
+
+Treequel-Shell is a collection of LDAP tools based on the Treequel LDAP
+toolkit.
+
+It includes:
+
+treequel :: an LDAP shell/editor; treat your LDAP directory like a filesystem!
+treewhat :: an LDAP schema explorer. Dump objectClasses and attribute type info
+            in several convenient formats.
+
+
+== Contributing
+
+You can check out the current development source
+{with Mercurial}[http://repo.deveiate.org/Treequel-Shell], or
+if you prefer Git, via the project's
+{Github mirror}[https://github.com/ged/treequel-shell].
+
+You can submit bug reports, suggestions, and read more about future plans at
+{the project page}[https://bitbucket.org/ged/Treequel-Shell].
+
+
+== License
+
+Copyright (c) 2008-2012, Michael Granger
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+  this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+  this list of conditions and the following disclaimer in the documentation
+  and/or other materials provided with the distribution.
+
+* Neither the name of the author/s, nor the names of the project's
+  contributors may be used to endorse or promote products derived from this
+  software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#!/usr/bin/env rake
+
+begin
+	require 'hoe'
+rescue LoadError
+	abort "This Rakefile requires hoe (gem install hoe)"
+end
+
+require 'rake/clean'
+
+Hoe.plugin :mercurial
+Hoe.plugin :signing
+Hoe.plugin :manualgen
+Hoe.plugin :deveiate
+
+Hoe.plugins.delete :rubyforge
+
+hoespec = Hoe.spec 'treequel' do
+	self.readme_file = 'README.rdoc'
+	self.history_file = 'History.rdoc'
+	self.extra_rdoc_files = Rake::FileList[ '*.rdoc' ]
+	self.spec_extras[:rdoc_options] = ['-f', 'fivefish', '-t', 'Treequel']
+
+	self.need_tar = true
+	self.need_zip = true
+
+	self.developer 'Michael Granger', 'ged@FaerieMUD.org'
+
+	self.dependency 'ruby-ldap', '~> 0.9'
+	self.dependency 'loggability', '~> 0.4'
+	self.dependency 'treequel', '~> 1.10'
+	self.dependency 'highline', '~> 1.6'
+	self.dependency 'trollop', '~> 1.16'
+	self.dependency 'sysexits', '~> 1.0'
+
+	self.dependency 'rspec', '~> 2.8', :developer
+	self.dependency 'sequel', '~> 3.20', :developer
+
+	self.spec_extras[:licenses] = ["BSD"]
+	self.spec_extras[:post_install_message] = [
+		'-' * 72,
+		"NOTE: The Treequel command-line tools are no longer distributed ",
+		"with the Treequel gem; to get the tools, install the 'treequel-shell' ",
+		"gem. Thanks!",
+		'-' * 72
+	  ].join( "\n" )
+
+	self.require_ruby_version( '>=1.8.7' )
+
+	self.hg_sign_tags = true if self.respond_to?( :hg_sign_tags= )
+	self.check_history_on_release = true if self.respond_to?( :check_history_on_release= )
+	self.rdoc_locations << "deveiate:/usr/local/www/public/code/#{remote_rdoc_dir}"
+end
+
+ENV['VERSION'] ||= hoespec.spec.version.to_s
+
+# Ensure the specs pass before checking in
+task 'hg:precheckin' => [ :check_history, :check_manifest ]
+
+
+desc "Build a coverage report"
+task :coverage do
+	ENV["COVERAGE"] = 'yes'
+	Rake::Task[:spec].invoke
+end
+
+if Rake::Task.task_defined?( '.gemtest' )
+	Rake::Task['.gemtest'].clear
+	task '.gemtest' do
+		$stderr.puts "Not including a .gemtest until I'm confident the test suite is idempotent."
+	end
+end
+
+# Add admin app testing directories to the clobber list
+CLOBBER.include( 'ChangeLog' )
+
+

File bin/treequel

 require 'treequel/constants'
 
 
-### Monkeypatch for resetting an OpenStruct's state.
-class OpenStruct
-
-	### Clear all defined fields and values.
-	def clear
-		@table.clear
-	end
-
-end
-
-
-### IRb.start_session, courtesy of Joel VanderWerf in [ruby-talk:42437].
-require 'irb'
-require 'irb/completion'
-
-module IRB # :nodoc:
-	def self.start_session( obj )
-		unless @__initialized
-			args = ARGV
-			ARGV.replace( [] )
-			IRB.setup( nil )
-			ARGV.replace( args )
-			@__initialized = true
-		end
-
-		workspace = WorkSpace.new( obj )
-		irb = Irb.new( workspace )
-
-		@CONF[:IRB_RC].call( irb.context ) if @CONF[:IRB_RC]
-		@CONF[:MAIN_CONTEXT] = irb.context
-
-		begin
-			prevhandler = Signal.trap( 'INT' ) do
-				irb.signal_handle
-			end
-
-			catch( :IRB_EXIT ) do
-				irb.eval_input
-			end
-		ensure
-			Signal.trap( 'INT', prevhandler )
-		end
-
-	end
-end
-
 # The Treequel shell.
 #
 #	TODO:
 #   * Make more commands use the convert_to_branchsets utility function
 #
-class Treequel::Shell
+class Treequel::Command < Treequel::Shell
 	include Readline,
 	        Treequel::Loggable,
 	        Treequel::ANSIColorUtilities,
 			end
 
 			oparser.on( '--no-tls', FalseClass, "Use a plaintext (unencrypted) connection.",
-			 	"If you don't specify a connection URL, this option is ignored." ) do
+				"If you don't specify a connection URL, this option is ignored." ) do
 				plaintext = true
 			end