Skip to content

Commit

Permalink
Rails 3
Browse files Browse the repository at this point in the history
  • Loading branch information
alno committed Jan 29, 2011
1 parent 457fb18 commit 1dc78ec
Show file tree
Hide file tree
Showing 61 changed files with 612 additions and 793 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -22,3 +22,4 @@ doc
## PROJECT::SPECIFIC

.yardoc
.rspec
2 changes: 1 addition & 1 deletion MIT-LICENSE
@@ -1,4 +1,4 @@
Copyright (c) 2009 [name of plugin creator]
Copyright (c) 2009 Alexey Noskov

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
18 changes: 9 additions & 9 deletions README.rdoc
Expand Up @@ -8,13 +8,13 @@ Setup gemcutter as gem source:

sudo gem install gemcutter
gem tumble

And install irwi gem (recommended):

sudo gem install irwi

And add to your environment.rb:

config.gem "irwi", :source => "http://gemcutter.org"

Or in your application directory call:
Expand Down Expand Up @@ -58,15 +58,15 @@ Following helpers are defined by default and you may replace them with you own:
Configuration options are acessed via <tt>Irwi.config</tt> object. Currently supported options:
* <tt>user_class_name</tt> - Name of user model class. By default - 'User'
* <tt>formatter</tt> - Formatter instance, which process wiki content before output. It should have method <tt>format</tt>, which gets a string and returns it formatted. By default instance of <tt>Irwi::Formatters::RedCloth</tt> is used (requires RedCloth gem). Other built-in formatter is <tt>Irwi::Formatters::BlueCloth</tt> (requires BlueCloth gem). Option accepts formatter instance, not class, so correct usage is:

Irwi.config.formatter = Irwi::Formatters::BlueCloth.new

* <tt>comparator</tt> - Comparator instance, which builds and renders a set of changes between to texts. By default instance of <tt>Irwi::Comparators::DiffLcs</tt> is used (requires diff-lcs gem).

== Access control

If you want (and it's good idea) to specify which users can see or edit certain pages you should simply override following methods in your controller:
* <tt>show_allowed?</tt> - should return <tt>true</tt> when it's allowed for current user to see current page (@page).
* <tt>show_allowed?</tt> - should return <tt>true</tt> when it's allowed for current user to see current page (@page).
* <tt>history_allowed?</tt> - should return <tt>true</tt> when it's allowed for user to see history of current page (@page) and compare it's versions.
* <tt>edit_allowed?</tt> - should return <tt>true</tt> when it's allowed for current user to modify current page (@page).

Expand All @@ -83,14 +83,14 @@ Irwi allows easy attachment integration in your wiki. There area several simple
== Rails prior to 2.3

If you have Rails prior to 2.3 when you should also call:

script/generate irwi_wiki_views

To generate default wiki views.

== I18n Issues

If you get some weird errors like
If you get some weird errors like

missing interpolation argument in "%{count} %B %Y, %H:%M"

Expand Down
53 changes: 0 additions & 53 deletions Rakefile

This file was deleted.

2 changes: 1 addition & 1 deletion app/views/base_wiki_pages/_wiki_page_info.html.erb
@@ -1,3 +1,3 @@
<div class="wiki_page_info">
<%=wt "Revised on {{time}} by {{user}}", :time => l( page.updated_at, :format => :long ), :user => wiki_user( page.updator ) %>
<%=(wt "Revised on %{time} by %{user}", :time => l( page.updated_at, :format => :long ), :user => wiki_user( page.updator ) ).html_safe %>
</div>
2 changes: 1 addition & 1 deletion app/views/base_wiki_pages/compare.html.erb
@@ -1,6 +1,6 @@
<%= wiki_page_style %>

<h1><%=wt '{{page_title}} - Comparing versions {{old_version}} and {{new_version}}', :page_title => h( @page.title ), :old_version => @old_version.number, :new_version => @new_version.number %></h1>
<h1><%=wt '%{page_title} - Comparing versions %{old_version} and %{new_version}', :page_title => h( @page.title ), :old_version => @old_version.number, :new_version => @new_version.number %></h1>

<%=wt 'Changes list:' %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/base_wiki_pages/history.html.erb
@@ -1,6 +1,6 @@
<%= wiki_page_style %>

<h1><%=wt '{{page_title}} - History', :page_title => @page.title %></h1>
<h1><%=wt '%{page_title} - History', :page_title => @page.title %></h1>

<%= wiki_page_info %>
<%= wiki_page_actions %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/base_wiki_pages/no.html.erb
@@ -1 +1 @@
<%=wt 'There are no such page. Do you want to <a href="{{new_url}}">create it</a>?', :new_url => wiki_page_new_path %>
<%=(wt 'There are no such page. Do you want to <a href="%{new_url}">create it</a>?', :new_url => wiki_page_new_path ).html_safe %>
22 changes: 0 additions & 22 deletions generators/irwi_wiki/irwi_wiki_generator.rb

This file was deleted.

This file was deleted.

19 changes: 0 additions & 19 deletions generators/irwi_wiki_views/irwi_wiki_views_generator.rb

This file was deleted.

142 changes: 28 additions & 114 deletions irwi.gemspec
@@ -1,120 +1,34 @@
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
# -*- encoding: utf-8 -*-
require File.expand_path("../lib/rayo/version", __FILE__)

Gem::Specification.new do |s|
s.name = %q{irwi}
s.version = "0.2.4"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.name = "irwi"
s.version = Irwi::VERSION::STRING
s.platform = Gem::Platform::RUBY
s.authors = ["Alexey Noskov", "Ravi Bhim"]
s.date = %q{2010-09-09}
s.description = %q{Irwi is Ruby on Rails plugin which adds wiki functionality to your application. }
s.email = %q{alexey.noskov@gmail.com ravi.bhim@yahoo.com}
s.extra_rdoc_files = [
"README.rdoc"
]
s.files = [
".document",
".gitignore",
"MIT-LICENSE",
"README.rdoc",
"Rakefile",
"VERSION",
"app/views/base_wiki_pages/_wiki_page_actions.html.erb",
"app/views/base_wiki_pages/_wiki_page_history.html.erb",
"app/views/base_wiki_pages/_wiki_page_info.html.erb",
"app/views/base_wiki_pages/_wiki_page_style.html.erb",
"app/views/base_wiki_pages/all.html.erb",
"app/views/base_wiki_pages/compare.html.erb",
"app/views/base_wiki_pages/edit.html.erb",
"app/views/base_wiki_pages/history.html.erb",
"app/views/base_wiki_pages/new.html.erb",
"app/views/base_wiki_pages/no.html.erb",
"app/views/base_wiki_pages/not_allowed.html.erb",
"app/views/base_wiki_pages/show.html.erb",
"generators/irwi_wiki/irwi_wiki_generator.rb",
"generators/irwi_wiki/templates/controllers/wiki_pages_controller.rb",
"generators/irwi_wiki/templates/helpers/wiki_pages_helper.rb",
"generators/irwi_wiki/templates/migrate/create_wiki_pages.rb",
"generators/irwi_wiki/templates/models/wiki_page.rb",
"generators/irwi_wiki/templates/models/wiki_page_version.rb",
"generators/irwi_wiki_attachments/irwi_wiki_attachments_generator.rb",
"generators/irwi_wiki_attachments/templates/migrate/create_wiki_page_attachments.rb",
"generators/irwi_wiki_attachments/templates/models/wiki_page_attachment.rb",
"generators/irwi_wiki_views/irwi_wiki_views_generator.rb",
"irwi.gemspec",
"lib/irwi.rb",
"lib/irwi/comparators/base.rb",
"lib/irwi/comparators/diff_lcs.rb",
"lib/irwi/comparators/spans/changed_span.rb",
"lib/irwi/comparators/spans/not_changed_span.rb",
"lib/irwi/config.rb",
"lib/irwi/extensions/controllers/wiki_page_attachments.rb",
"lib/irwi/extensions/controllers/wiki_pages.rb",
"lib/irwi/extensions/models/wiki_page.rb",
"lib/irwi/extensions/models/wiki_page_attachment.rb",
"lib/irwi/extensions/models/wiki_page_version.rb",
"lib/irwi/formatters/blue_cloth.rb",
"lib/irwi/formatters/red_cloth.rb",
"lib/irwi/helpers/wiki_page_attachments_helper.rb",
"lib/irwi/helpers/wiki_pages_helper.rb",
"lib/irwi/paginators/none.rb",
"lib/irwi/paginators/will_paginate.rb",
"lib/irwi/support/route_mapper.rb",
"lib/irwi/support/template_finder.rb",
"rails/init.rb",
"spec/comparators/diff_lcs_spec.rb",
"spec/config_spec.rb",
"spec/extensions/controllers/wiki_pages_spec.rb",
"spec/extensions/models/wiki_page_spec.rb",
"spec/formatters/red_cloth_spec.rb",
"spec/helpers/wiki_page_attachments_helper_spec.rb",
"spec/helpers/wiki_pages_helper_spec.rb",
"spec/paginators/none_spec.rb",
"spec/paginators/will_paginate_spec.rb",
"spec/rcov.opts",
"spec/spec.opts",
"spec/spec_helper.rb",
"spec/support/route_mapper_spec.rb",
"spec/support/template_finder_spec.rb",
"tasks/riwiki_tasks.rake"
]
s.homepage = %q{http://github.com/alno/irwi}
s.rdoc_options = ["--charset=UTF-8"]
s.require_paths = ["lib"]
s.rubygems_version = %q{1.3.7}
s.summary = %q{Irwi is Ruby on Rails plugin which adds wiki functionality to your application.}
s.test_files = [
"spec/support/route_mapper_spec.rb",
"spec/support/template_finder_spec.rb",
"spec/spec_helper.rb",
"spec/comparators/diff_lcs_spec.rb",
"spec/extensions/controllers/wiki_pages_spec.rb",
"spec/extensions/models/wiki_page_spec.rb",
"spec/config_spec.rb",
"spec/paginators/will_paginate_spec.rb",
"spec/paginators/none_spec.rb",
"spec/helpers/wiki_pages_helper_spec.rb",
"spec/helpers/wiki_page_attachments_helper_spec.rb",
"spec/formatters/red_cloth_spec.rb"
]
s.email = ["alexey.noskov@gmail.com","ravi.bhim@yahoo.com"]
s.homepage = "http://github.com/alno/irwi"
s.summary = "Irwi is Ruby on Rails plugin which adds wiki functionality to your application."
s.description = "Irwi is Ruby on Rails plugin which adds wiki functionality to your application."

if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 3
s.required_rubygems_version = ">= 1.3.6"

if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<diff-lcs>, [">= 1.1.2"])
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
else
s.add_dependency(%q<diff-lcs>, [">= 1.1.2"])
s.add_dependency(%q<rspec>, [">= 1.2.9"])
end
else
s.add_dependency(%q<diff-lcs>, [">= 1.1.2"])
s.add_dependency(%q<rspec>, [">= 1.2.9"])
end
end
# Gem dependencies
s.add_dependency "diff-lcs", ">= 1.1.2"

s.add_dependency "activerecord", ">= 3.0.0"
s.add_dependency "activesupport", ">= 3.0.0"
s.add_dependency "actionpack", ">= 3.0.0"

# Development dependencies
s.add_development_dependency "rspec", ">=2.0"

# Gem files
s.files = Dir["lib/**/*.rb", "bin/*", "MIT-LICENSE", "README.rdoc"]
s.extra_rdoc_files = [ "README.rdoc", "MIT-LICENSE"]
s.require_path = 'lib'

# Info
s.has_rdoc = true
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Rayo CMS", "--main", "README.rdoc"]

end
29 changes: 29 additions & 0 deletions lib/generators/irwi_wiki/irwi_wiki_generator.rb
@@ -0,0 +1,29 @@
require 'rails/generators/active_record/migration'

class IrwiWikiGenerator < Rails::Generators::Base

include Rails::Generators::Migration
extend ActiveRecord::Generators::Migration

source_root File.expand_path("../templates", __FILE__)

def generate_wiki

# Controllers
copy_file 'controllers/wiki_pages_controller.rb', 'app/controllers/wiki_pages_controller.rb'

# Helpers
copy_file 'helpers/wiki_pages_helper.rb', 'app/helpers/wiki_pages_helper.rb'

# Models
copy_file 'models/wiki_page.rb', 'app/models/wiki_page.rb'
copy_file 'models/wiki_page_version.rb', 'app/models/wiki_page_version.rb'

# Migrations
migration_template 'migrate/create_wiki_pages.rb', 'db/migrate/create_wiki_pages'

# Routes
route "wiki_root '/wiki'"
end

end
@@ -1,5 +1,5 @@
class WikiPagesController < ApplicationController

acts_as_wiki_pages_controller
end

end

0 comments on commit 1dc78ec

Please sign in to comment.