Skip to content

Commit

Permalink
Update gem structure for new sunrise-cms
Browse files Browse the repository at this point in the history
  • Loading branch information
galetahub committed Sep 18, 2012
1 parent 8b6849c commit 1704b5b
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 117 deletions.
20 changes: 20 additions & 0 deletions MIT-LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright 2012 Fodojo http://fodojo.com/

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10 changes: 9 additions & 1 deletion README.rdoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
= Sunrise Comments

Comments system module for sunrise-cms

== Install

gem "sunrise-comments"

bundle install

rake sunrise_comments_engine:install:migrations

rails generate sunrise:comments:install

In generated migration add "comments_count" column for counter cache:
Expand All @@ -20,4 +28,4 @@ In generated migration add "comments_count" column for counter cache:
include Sunrise::Comments::Author
end

Copyright (c) 2011 Aimbulance, released under the MIT license
Copyright (c) 2011-2012 Fodojo, released under the MIT license
21 changes: 0 additions & 21 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,3 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_files.include('README')
rdoc.rdoc_files.include('lib/**/*.rb')
end

begin
require 'jeweler'
Jeweler::Tasks.new do |s|
s.name = "sunrise-comments"
s.version = Sunrise::Comments::VERSION.dup
s.summary = "Rails CMS"
s.description = "Sunrise is a Aimbulance CMS"
s.email = "galeta.igor@gmail.com"
s.homepage = "https://github.com/galetahub/sunrise-comments"
s.authors = ["Igor Galeta", "Pavlo Galeta"]
s.files = FileList["[A-Z]*", "{app,config,lib}/**/*"]
s.extra_rdoc_files = FileList["[A-Z]*"] - %w(Gemfile Rakefile)

s.add_dependency('sunrise-cms')
end

Jeweler::GemcutterTasks.new
rescue LoadError
puts "Jeweler not available. Install it with: gem install jeweler"
end
6 changes: 1 addition & 5 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
Rails.application.routes.draw do
resources :comments, :only => [:new, :create, :edit, :update, :destroy]

namespace :manage do
resources :comments
end
resources :comments, :only => [:new, :create, :edit, :update, :destroy]
end
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class SunriseCreateComments < ActiveRecord::Migration
class CreateComments < ActiveRecord::Migration
def self.up
create_table :comments do |t|
t.string :user_name, :limit => 50
Expand Down
22 changes: 1 addition & 21 deletions lib/generators/sunrise/comments/install_generator.rb
Original file line number Diff line number Diff line change
@@ -1,34 +1,14 @@
require 'rails/generators'
require 'rails/generators/migration'

module Sunrise
module Comments
class InstallGenerator < Rails::Generators::Base
include Rails::Generators::Migration

source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
class_option :migrations, :type => :boolean, :default => true, :description => "Generate migrations files"
desc "Generates comment model"

desc "Generates comment migration and model"

def self.current_time
@current_time ||= Time.now
@current_time += 1.minute
end

def self.next_migration_number(dirname)
current_time.strftime("%Y%m%d%H%M%S")
end

def create_model
copy_file('comment.rb', 'app/models/comment.rb')
end

def create_migration
if options.migrations
migration_template "create_comments.rb", File.join('db/migrate', "sunrise_create_comments.rb")
end
end
end
end
end
2 changes: 1 addition & 1 deletion lib/generators/sunrise/comments/templates/comment.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Comment < ActiveRecord::Base
include Sunrise::Models::Comment
include Sunrise::Comments::Commentable

attr_accessible :user_name, :user_email, :content, :is_follow

Expand Down
1 change: 1 addition & 0 deletions lib/sunrise/comments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module Sunrise
module Comments
autoload :Base, 'sunrise/comments/base'
autoload :Author, 'sunrise/comments/author'
autoload :Commentable, 'sunrise/comments/commentable'

# Default way to setup Sunrise.
def self.setup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# encoding: utf-8
module Sunrise
module Models
module Comment
module Comments
module Commentable
def self.included(base)
base.send :include, InstanceMethods
base.send :extend, ClassMethods
Expand Down
10 changes: 1 addition & 9 deletions lib/sunrise/comments/engine.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
require 'rails'
require 'sunrise-cms'
require 'sunrise-comments'

module Sunrise
module Comments
class Engine < ::Rails::Engine
config.before_initialize do
Sunrise::Plugin.register :comments do |plugin|
plugin.model = 'sunrise/models/comment'
plugin.menu = false
plugin.version = Sunrise::Comments::VERSION.dup
end

Sunrise::Plugins.activate(:comments)
end
end
end
end
2 changes: 1 addition & 1 deletion lib/sunrise/comments/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Sunrise
module Comments
VERSION = "0.1.2".freeze
VERSION = "0.2.0".freeze
end
end
73 changes: 18 additions & 55 deletions sunrise-comments.gemspec
Original file line number Diff line number Diff line change
@@ -1,60 +1,23 @@
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "sunrise/comments/version"

Gem::Specification.new do |s|
s.name = %q{sunrise-comments}
s.version = "0.1.2"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.name = "sunrise-comments"
s.version = Sunrise::Comments::VERSION.dup
s.platform = Gem::Platform::RUBY
s.summary = "Comments for sunrise-cms"
s.description = "Comments module for sunrise-cms"
s.authors = ["Igor Galeta", "Pavlo Galeta"]
s.date = %q{2011-08-16}
s.description = %q{Sunrise is a Aimbulance CMS}
s.email = %q{galeta.igor@gmail.com}
s.extra_rdoc_files = [
"README.rdoc"
]
s.files = [
"README.rdoc",
"Rakefile",
"app/controllers/comments_controller.rb",
"app/sweepers/comment_sweeper.rb",
"app/views/comments/_block.html.erb",
"app/views/comments/_comment.html.erb",
"app/views/comments/_form.html.erb",
"app/views/comments/create.js.erb",
"app/views/comments/destroy.js.erb",
"config/locales/ru.yml",
"config/locales/uk.yml",
"config/routes.rb",
"lib/generators/sunrise/comments/USAGE",
"lib/generators/sunrise/comments/install_generator.rb",
"lib/generators/sunrise/comments/templates/comment.rb",
"lib/generators/sunrise/comments/templates/create_comments.rb",
"lib/sunrise-comments.rb",
"lib/sunrise/comments.rb",
"lib/sunrise/comments/author.rb",
"lib/sunrise/comments/base.rb",
"lib/sunrise/comments/engine.rb",
"lib/sunrise/comments/version.rb",
"lib/sunrise/models/comment.rb"
]
s.homepage = %q{https://github.com/galetahub/sunrise-comments}
s.email = "galeta.igor@gmail.com"
s.rubyforge_project = "sunrise-comments"
s.homepage = "https://github.com/galetahub/sunrise-comments"

s.files = Dir["{app,lib,config,db,vendor}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
s.test_files = Dir["{spec}/**/*"]
s.extra_rdoc_files = ["README.rdoc"]
s.require_paths = ["lib"]
s.rubygems_version = %q{1.6.2}
s.summary = %q{Rails CMS}

if s.respond_to? :specification_version then
s.specification_version = 3

if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<sunrise-cms>, [">= 0"])
else
s.add_dependency(%q<sunrise-cms>, [">= 0"])
end
else
s.add_dependency(%q<sunrise-cms>, [">= 0"])
end
end


s.add_dependency "sunrise-cms"
s.add_dependency "auto_html"
end

0 comments on commit 1704b5b

Please sign in to comment.