-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6676b24
commit 0afff78
Showing
9 changed files
with
169 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
if defined?(Rails) && Rails::VERSION::MAJOR >= 3 | ||
|
||
class GraficoAssetsGenerator < Rails::Generators::Base | ||
|
||
include Rails::Generators::Actions | ||
|
||
def create_grafico_file | ||
empty_directory('public/javascripts') | ||
copy_file( | ||
File.join(File.dirname(__FILE__), 'templates', 'raphael-min.js'), | ||
'public/javascripts/raphael.js' | ||
) | ||
copy_file( | ||
File.join(File.dirname(__FILE__), 'templates', 'grafico.min.js'), | ||
'public/javascripts/grafico.js' | ||
) | ||
readme(File.join(File.dirname(__FILE__), 'templates', 'NOTES')) | ||
end | ||
|
||
end | ||
|
||
else | ||
|
||
class GraficoAssetsGenerator < Rails::Generator::Base | ||
|
||
def manifest | ||
record do |m| | ||
m.directory('public/javascripts') | ||
m.file('raphael-min.js', 'public/javascripts/raphael.js') | ||
m.file('grafico.min.js', 'public/javascripts/grafico.js') | ||
m.readme('NOTES') | ||
end | ||
end | ||
|
||
end | ||
|
||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[grafico] Grafico assets have been installed in public/javascripts. | ||
[grafico] Please ensure the following is present your application layout: | ||
|
||
javascript_include_tag :defaults # or, at least, 'prototype' | ||
javascript_include_tag 'raphael', 'grafico' | ||
|
||
[grafico] Thanks. |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module Grafico | ||
require 'grafico/railtie' if defined?(Rails) && Rails::VERSION::MAJOR >= 3 | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
require 'grafico' | ||
require 'rails' | ||
|
||
module Grafico | ||
class Railtie < Rails::Railtie | ||
|
||
GEM_ROOT = File.join(File.dirname(__FILE__), '..', '..') | ||
|
||
initializer 'grafico.initialization' do | ||
require File.join(GEM_ROOT, 'rails', 'init') | ||
end | ||
|
||
generators do | ||
require File.join(GEM_ROOT, 'generators', 'grafico_assets_generator') | ||
end | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
require 'grafico' | ||
require 'grafico/helper' | ||
|
||
ActionView::Base.class_eval do | ||
include Grafico::Helper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,6 @@ | |
|
||
class Test::Unit::TestCase | ||
end | ||
|
||
class TestHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
require 'helper' | ||
|
||
class TestGrafico < Test::Unit::TestCase | ||
def test_something_for_real | ||
flunk "hey buddy, you should probably rename this file and start testing for real" | ||
def setup | ||
@helper = TestHelper.new | ||
end | ||
|
||
def test_setup | ||
assert_instance_of TestHelper, @helper | ||
end | ||
end |