Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

make-go.rb: share nuke warning. yaml update. elephant.

go/hobix-install.rb: ditto.
lib/hobix/base.rb: yaml for ruby 1.8.3 update.
lib/hobix/commandline.rb: disable search.
lib/hobix/storage/filesys.rb: ditto.  better, flexible index rebuilding.
share/default-blog-modes.yaml: removed publisher from the patch list.
  • Loading branch information...
commit e3742c96ef8310d0c1b29697237afb11d8a8554e 1 parent f4bb286
_why authored
View
8 go/hobix-install.rb
@@ -115,7 +115,7 @@ def ri_install( sucmd, libdir )
end
# Web root
-GO_HOBIX = 'http://go.hobix.com/0.3b/'
+GO_HOBIX = 'http://go.hobix.com/0.4/'
# Tempdir
TMPDIR = File.join( ENV['TMPDIR']||ENV['TMP']||ENV['TEMP']||'/tmp', Time.now.strftime( 'hobix_%Y-%m-%d_%H-%M-%S' ) )
@@ -153,6 +153,12 @@ def ri_install( sucmd, libdir )
case action
when 'sitelibdir'
check_hobix_version( conf[action], den['version'] )
+ when 'sharedir'
+ puts "Directory `#{ conf['sharedir'] }' will be deleted and filled with the latest"
+ print "hobix ingredients, okay + [y/N] ?"
+ unless gets.strip.downcase == 'y'
+ redo
+ end
when 'installing'
puts
require 'ftools'
View
4 lib/hobix/base.rb
@@ -376,8 +376,8 @@ def canonical_tags( path=nil )
def tags;( canonical_tags + Array( @tags ) ).uniq; end
def self.yaml_type( tag )
- if self.respond_to? :tag_as
- tag_as tag
+ if self.respond_to? :yaml_as
+ yaml_as tag
else
if tag =~ /^tag:([^:]+):(.+)$/
define_method( :to_yaml_type ) { "!#$1/#$2" }
View
22 lib/hobix/commandline.rb
@@ -309,17 +309,17 @@ def list_action( weblog, inpath = '' )
end
end
- # List entries
- def search_action_explain; "Search for words within posts of a given path."; end
- def search_action_args; ['weblog-name', 'word1,word2', 'search/path']; end
- def search_action( weblog, words, inpath = '' )
- entries = weblog.storage.find( :all => true, :inpath => inpath, :search => words.split( ',' ) )
- if entries.empty?
- puts "** No posts found in the weblog for path '#{inpath}'."
- else
- tabular_entries( entries )
- end
- end
+ # Search (disabled in 0.4)
+ # def search_action_explain; "Search for words within posts of a given path."; end
+ # def search_action_args; ['weblog-name', 'word1,word2', 'search/path']; end
+ # def search_action( weblog, words, inpath = '' )
+ # entries = weblog.storage.find( :all => true, :inpath => inpath, :search => words.split( ',' ) )
+ # if entries.empty?
+ # puts "** No posts found in the weblog for path '#{inpath}'."
+ # else
+ # tabular_entries( entries )
+ # end
+ # end
# Post a new entry
def post_action_explain; "Add or edit a post with identifier 'shortName'.\n" +
View
84 lib/hobix/facets/publisher.rb
@@ -97,6 +97,28 @@ def make_form( form )
}
-->
</style>
+ <script type="text/javascript" language="javascript">
+ // <![CDATA[
+ function sortable_to_csv(element) {
+ var element = $(element);
+ var options = {
+ tag: element.sortable.tag,
+ only: element.sortable.only,
+ name: element.id
+ }.extend(arguments[1] || {});
+
+ var items = $(element).childNodes;
+ var queryComponents = new Array();
+
+ for(var i=0; i<items.length; i++)
+ if(items[i].tagName && items[i].tagName==options.tag.toUpperCase() &&
+ (!options.only || (Element.Class.has(items[i], options.only))))
+ queryComponents.push(items[i].id.replace(element.id+'_',''));
+
+ return queryComponents;
+ }
+ // ]]>
+ </script>
<h2><%= form[:full_title] %></h2>
<form id="publisher_form" method="post" enctype="multipart/form-data">
<p><%= RedCloth.new( form[:intro] ).to_html %></p>
@@ -126,38 +148,43 @@ def make_form( form )
% when :textarea
<textarea name="<%= name %>" id="<%= name %>" rows="<%= opts[:edit_rows] || 4 %>" cols="<%= opts[:edit_cols] || 36 %>" tabindex=""><%= val %></textarea>
% when :omap
- <ol id="<%= name %>" class="edit_as_omap">
-% val.each_with_index do |(vkey, vval), i|
+ <ol id="<%= name %>sort" class="edit_as_omap">
+% val.each do |vkey, vval|
% vkey = vkey.keys.first if vkey.is_a? Hash
- <li id="<%= name %>_<%= i %>" name="<%= vkey %>">
+ <li id="<%= name %>sort_<%= vkey %>" class="sorty" name="<%= vkey %>">
<span class="handle">&raquo;</span>
<%= vkey %>
- <a href="<%= form[:app].absuri( :path_info => "/publisher/#{ @title }/edit/#{ name }/#{ i }" ) %>">edit</a>
- <a href="<%= form[:app].absuri( :path_info => "/publisher/#{ @title }/del/#{ name }/#{ i }" ) %>">remove</a>
+ <a href="<%= form[:app].absuri( :path_info => "/publisher/#{ @title }/edit/#{ name }/#{ vkey }" ) %>">edit</a>
+ <a href="<%= form[:app].absuri( :path_info => "/publisher/#{ @title }/del/#{ name }/#{ vkey }" ) %>">remove</a>
</li>
% end if val
- <li id="<%= name %>_new">
+ <li class="new_item">
<span>&raquo;</span>
+ <input type="text" name="<%= name %>_new" id="<%= name %>_new" style="width:150px"
+ class="inputText" tabindex="" maxlength="255" value="" />
<a href="<%= form[:app].absuri( :path_info => "/publisher/#{ @title }/add/#{ name }" ) %>">add</a>
</li>
</ul>
+ <input type="hidden" name="<%= name %>" id="<%= name %>" value="" />
<script type="text/javascript" language="javascript">
// <![CDATA[
- Sortable.create("<%= name %>", {handle:'handle', onUpdate:function () {
- alert(Sortable.serialize(this.element));
+ Sortable.create("<%= name %>sort", {handle:'handle', only: 'sorty', onUpdate:function () {
+ $("<%= name %>").value = sortable_to_csv(this.element).join(' ');
}});
// ]]>
</script>
% when :map
<ul id="<%= name %>_order" class="edit_as_map">
-% val.each_with_index do |(vkey, vval), i|
- <li id="<%= name %>_<%= i %>">
+% val.each do |vkey, vval|
+ <li id="<%= name %>_<%= vkey %>">
<%= vkey %>
<a href="<%= form[:app].absuri( :path_info => "/publisher/#{ @title }/edit/#{ name }/#{ vkey }" ) %>">edit</a>
<a href="<%= form[:app].absuri( :path_info => "/publisher/#{ @title }/del/#{ name }/#{ vkey }" ) %>">remove</a>
</li>
% end if val
- <li id="<%= name %>_new">
+ <li id="new_item">
+ <input type="text" name="<%= name %>_new" id="<%= name %>_new" style="width:150px"
+ class="inputText" tabindex="" maxlength="255" value="" />
<a href="<%= form[:app].absuri( :path_info => "/publisher/#{ @title }/add/#{ name }" ) %>">add</a>
</li>
</ul>
@@ -207,7 +234,15 @@ def save_form( obj, app )
case opts[:edit_as]
when :omap
+ omap = obj.instance_variable_get( "@#{name}" )
+ sorted = val.to_s.split(/\s+/)
+ sorted.each { |item| omap << [item] unless omap.assoc(item) }
+ omap.sort_by { |item, val| sorted.index(item) || sorted.length }
when :map
+ map = obj.instance_variable_get( "@#{name}" )
+ val.to_s.split(/\s+/).each do |item|
+ map[item] ||= nil
+ end
else
obj.instance_variable_set( "@#{name}", val )
end
@@ -236,19 +271,20 @@ def get_config( app )
show_weblog_form( @weblog, app )
when "POST"
weblog, missing = save_form( @weblog, app )
- if missing.empty?
- weblog.save( weblog.hobix_yaml + ".edit" )
- red %{
- *Your configuraton has been saved.*
-
- Please note that this development version of Hobix isn't
- yet equipped to deal with re-sorting of the requires. I'm not that great with Prototype
- yet and I also want to write some code to sandbox the configuration, to check that the
- requires will load right before saving it.
- }
- else
- show_weblog_form( weblog, app )
- end
+ # if missing.empty?
+ # weblog.save( weblog.hobix_yaml + ".edit" )
+ # red %{
+ # *Your configuraton has been saved.*
+ #
+ # Please note that this development version of Hobix isn't
+ # yet equipped to deal with re-sorting of the requires. I'm not that great with Prototype
+ # yet and I also want to write some code to sandbox the configuration, to check that the
+ # requires will load right before saving it.
+ # }
+ # else
+ # show_weblog_form( weblog, app )
+ # end
+ [weblog, missing].to_yaml
end
end
View
44 lib/hobix/storage/filesys.rb
@@ -16,7 +16,7 @@
require 'find'
require 'yaml'
require 'fileutils'
-require 'hobix/search/simple'
+# require 'hobix/search/simple'
module Hobix
@@ -108,7 +108,7 @@ def save_entry( id, e, create_category=false )
i.modified = e.modified
end
@modified[id] = e.modified
- catalog_search_entry( e )
+ # catalog_search_entry( e )
sort_index( true )
e
end
@@ -136,19 +136,19 @@ def load_entry( id )
end
# Loads the search engine database. The database will be cleansed and re-scanned if +wash+ is true.
- def load_search_index( wash )
- @search_index = Hobix::Search::Simple::Searcher.load( File.join( @basepath, 'index.search' ), wash )
- end
+ # def load_search_index( wash )
+ # @search_index = Hobix::Search::Simple::Searcher.load( File.join( @basepath, 'index.search' ), wash )
+ # end
# Catalogs an entry object +e+ in the search engine.
- def catalog_search_entry( e )
- @search_index.catalog( Hobix::Search::Simple::Content.new( e.to_search, e.id, e.modified, e.content_ratings ) )
- end
+ # def catalog_search_entry( e )
+ # @search_index.catalog( Hobix::Search::Simple::Content.new( e.to_search, e.id, e.modified, e.content_ratings ) )
+ # end
# Determines if the search engine has already scanned an entry represented by IndexEntry +ie+.
- def search_needs_update? ie
- not @search_index.has_entry? ie.id, ie.modified
- end
+ # def search_needs_update? ie
+ # not @search_index.has_entry? ie.id, ie.modified
+ # end
# Load the internal index (saved at @entry_path/index.hobix) and refresh any timestamps
# which may be stale.
@@ -161,7 +161,7 @@ def load_index
YAML::Omap::new
end
@index = YAML::Omap::new
- load_search_index( index.length == 0 )
+ # load_search_index( index.length == 0 )
modified = false
index_fields = @weblog.index_class.properties.keys
@@ -182,10 +182,10 @@ def load_index
index_entry = index[entry_id]
end
## we will (re)load the entry if:
- if index_entry.nil? or # it's new
+ if not index_entry.respond_to?( :modified ) or # it's new
( index_entry.modified != @modified[entry_id] ) or # it's changed
- index_fields.detect { |f| index_entry.send( f ).nil? } or # index fields have been added
- search_needs_update? index_entry # entry is old or not available in search db
+ index_fields.detect { |f| index_entry.send( f ).nil? } # index fields have been added
+ # or search_needs_update? index_entry # entry is old or not available in search db
efile = entry_path( entry_id )
e = Hobix::Entry::load( efile )
@@ -193,7 +193,7 @@ def load_index
index_entry = @weblog.index_class.new( e, index_fields ) do |i|
i.modified = @modified[entry_id]
end
- catalog_search_entry( e )
+ # catalog_search_entry( e )
modified = true
end
@index[index_entry.id] = index_entry
@@ -212,7 +212,7 @@ def sort_index( modified )
File.open( index_path, 'w' ) do |f|
YAML::dump( @index, f )
end
- @search_index.dump
+ # @search_index.dump
end
end
@@ -262,9 +262,9 @@ def find( search = {} )
@modified[e.id] = e.modified
_index = {e.id => @weblog.index_class.new(e)}
end
- if search[:search]
- sr = @search_index.find_words( search[:search] )
- end
+ # if search[:search]
+ # sr = @search_index.find_words( search[:search] )
+ # end
unless search[:all]
ignore_test = nil
ignored = @weblog.sections_ignored
@@ -288,8 +288,8 @@ def find( search = {} )
entry.id.index( sval ) != 0
when :match
not entry.id.match sval
- when :search
- not sr.results[entry.id]
+ # when :search
+ # not sr.results[entry.id]
else
false
end
View
23 make-go.rb
@@ -23,23 +23,27 @@ def dir_to_base64( *dirs )
end
attached
end
-attached = dir_to_base64( '../redcloth/lib/**/*.rb', 'lib/**/*.rb', 'bin/**/*', 'share/**/*' )
+attached = dir_to_base64( '../RedCloth-3.0.3/lib/redcloth.rb', 'lib/**/*.rb', 'bin/**/*', 'share/**/*' )
hobix_install_yaml =<<EOY
version: #{ check_hobix_version( 'lib', 'hobix.rb' ) }
setup:
- - welcome
- |-
#
+ _
+ . ()_'() ``,``-`-`. (*`
+ * ( ) , \\` .
+ __ _. ( ^ ^ ) `' .` _ __ __
+ / ^ ^ ) ( .,___, ,;/ ^ `'
+ ````````` U| |U . | |. |^`````````
+ >_` -| |^ | |^ |
+ `---' ^^^' ^^^'
- () ()
- () ()
- o --- (--= _--_ / \\
- o( -- (---= ~/ / ^ ^/
- o. (___ (_(__-= // ///\\/\\/
+ you slow elephant.
- you speedy little goat!!
- you got.. you got..
- ahee!! hobix!!
+ but you got hobix.
+
+ ahee.
# halloo!! ready to install the very latest hobix??
# DON'T BE 'FRAIDY!! nothing scary AT ALL!! (hobix is
@@ -109,6 +113,7 @@ def dir_to_base64( *dirs )
# when you have your blog up, let everybody know at let.us.all.hobix.com,
# okay?? great, thanks.
+---
EOY
hobix_install_yaml += attached.to_yaml( :UseBlock => true, :UseFold => false )
View
8 share/default-blog-modes.yaml
@@ -1,7 +1,7 @@
apache1-ssi: [apache-ssi]
apache2-ssi: [apache-ssi, apache2-ssi]
apache-comments: [cgi, apache-cgi, prototype, comments]
-apache-publisher: [cgi, apache-cgi, prototype, publisher]
-apache-wiki: [cgi, apache-cgi, wiki]
-apache1-all: [apache-ssi, cgi, apache-cgi, prototype, comments, publisher]
-apache2-all: [apache-ssi, apache2-ssi, cgi, apache-cgi, prototype, comments, publisher]
+# apache-wiki: [cgi, apache-cgi, wiki]
+# apache-publisher: [cgi, apache-cgi, prototype, publisher]
+apache1-all: [apache-ssi, cgi, apache-cgi, prototype, comments]
+apache2-all: [apache-ssi, apache2-ssi, cgi, apache-cgi, prototype, comments]
Please sign in to comment.
Something went wrong with that request. Please try again.