Skip to content

Commit

Permalink
Merge pull request #3 from gabrielg/master
Browse files Browse the repository at this point in the history
Makes mmmenu a gem
  • Loading branch information
snitko committed Feb 27, 2012
2 parents bf54758 + c8e334d commit e37d499
Show file tree
Hide file tree
Showing 17 changed files with 58 additions and 32 deletions.
4 changes: 4 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
require "rubygems"
require "rspec/core/rake_task"

RSpec::Core::RakeTask.new(:default)
3 changes: 0 additions & 3 deletions init.rb

This file was deleted.

9 changes: 0 additions & 9 deletions lib/app_controller_mmmenu_extension.rb

This file was deleted.

12 changes: 6 additions & 6 deletions lib/generators/mmmenu/mmmenu_generator.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
class MmmenuGenerator < Rails::Generators::Base

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

def create_helper
copy_file "../../../../app/helpers/mmmenu_helper.rb", "app/helpers/mmmenu_helper.rb"
copy_file "../../../../app/views/mmmenu/_item.erb", "app/views/mmmenu/_item.erb"
copy_file "../../../../app/views/mmmenu/_current_item.erb", "app/views/mmmenu/_current_item.erb"
copy_file "../../../../app/views/mmmenu/_level_1.erb", "app/views/mmmenu/_level_1.erb"
copy_file "../../../../app/views/mmmenu/_level_2.erb", "app/views/mmmenu/_level_2.erb"
copy_file "helpers/mmmenu_helper.rb", "app/helpers/mmmenu_helper.rb"
copy_file "views/mmmenu/_item.erb", "app/views/mmmenu/_item.erb"
copy_file "views/mmmenu/_current_item.erb", "app/views/mmmenu/_current_item.erb"
copy_file "views/mmmenu/_level_1.erb", "app/views/mmmenu/_level_1.erb"
copy_file "views/mmmenu/_level_2.erb", "app/views/mmmenu/_level_2.erb"
end


Expand Down
12 changes: 0 additions & 12 deletions lib/generators/mmmenu/templates/mmmenu_helper.rb

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions lib/mmmenu.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
require 'mmmenu/level'
require 'mmmenu/engine'

class Mmmenu

attr_accessor :current_item
Expand Down
16 changes: 16 additions & 0 deletions lib/mmmenu/engine.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class Mmmenu::Engine < Rails::Engine

paths["app/helpers"] << File.expand_path("../../generators/templates/helpers", __FILE__)
paths["app/views"] << File.expand_path("../../generators/templates/views", __FILE__)

end if defined?(Rails::Engine)

ActionController::Base.class_eval do

private

def mmmenu(&block)
@menu = Mmmenu.new(:request => request, &block)
end

end if defined?(ActionController::Base)
File renamed without changes.
3 changes: 3 additions & 0 deletions lib/mmmenu/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class Mmmenu
VERSION = '0.1'
end
24 changes: 24 additions & 0 deletions mmmenu.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "mmmenu/version"

Gem::Specification.new do |s|
s.name = "mmmenu"
s.version = Mmmenu::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["Roman Snitko"]
s.email = ["[email protected]"]
s.homepage = "https://github.com/snitko/mmmenu"
s.summary = %q{Flexible menu generator for Rails}
s.description = %q{Flexible menu generator for Rails}

s.rubyforge_project = "mmmenu"

s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]

s.add_development_dependency "rake"
s.add_development_dependency "rspec-core", "~> 2.8.0"
end
2 changes: 1 addition & 1 deletion spec/lib/mmmenu_level_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.expand_path(File.dirname(__FILE__) + '/../../lib/mmmenu_level')
require File.expand_path(File.dirname(__FILE__) + '/../../lib/mmmenu/level')

describe Mmmenu::Level do

Expand Down
2 changes: 1 addition & 1 deletion spec/lib/mmmenu_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.expand_path(File.dirname(__FILE__) + '/../../lib/mmmenu_level')
require File.expand_path(File.dirname(__FILE__) + '/../../lib/mmmenu/level')
require File.expand_path(File.dirname(__FILE__) + '/../../lib/mmmenu')

describe Mmmenu do
Expand Down

0 comments on commit e37d499

Please sign in to comment.