midas-flash_growler 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt ADDED
@@ -0,0 +1,4 @@
1
+ == 0.0.1 2009-03-07
2
+
3
+ * 1 major enhancement:
4
+ * Initial release
data/Manifest.txt ADDED
@@ -0,0 +1,23 @@
1
+ History.txt
2
+ Manifest.txt
3
+ PostInstall.txt
4
+ README.rdoc
5
+ Rakefile
6
+ flash_growler.gemspec
7
+ lib/flash_growler.rb
8
+ lib/flash_growler/view_helpers.rb
9
+ rails_generators/flash_growler_assets/flash_growler_assets_generator.rb
10
+ rails_generators/flash_growler_assets/templates/alert.png
11
+ rails_generators/flash_growler_assets/templates/bg.png
12
+ rails_generators/flash_growler_assets/templates/default.css
13
+ rails_generators/flash_growler_assets/templates/error.png
14
+ rails_generators/flash_growler_assets/templates/guilded.flash_growler.js
15
+ rails_generators/flash_growler_assets/templates/info.png
16
+ rails_generators/flash_growler_assets/templates/jquery-growler-0.1.js
17
+ script/console
18
+ script/destroy
19
+ script/generate
20
+ spec/flash_growler_spec.rb
21
+ spec/spec.opts
22
+ spec/spec_helper.rb
23
+ tasks/rspec.rake
data/PostInstall.txt ADDED
@@ -0,0 +1,7 @@
1
+
2
+ For more information on flash_growler, see http://flash_growler.rubyforge.org
3
+
4
+ NOTE: Change this information in PostInstall.txt
5
+ You can also delete it if you don't want it.
6
+
7
+
data/README.rdoc ADDED
@@ -0,0 +1,48 @@
1
+ = flash_growler
2
+
3
+ * http://github.com/midas/flash_growler/tree/master
4
+
5
+ == DESCRIPTION:
6
+
7
+ A Guilded component that displays Rails flash messages in an interface similar to OS/X's growler.
8
+
9
+ == FEATURES/PROBLEMS:
10
+
11
+
12
+
13
+ == SYNOPSIS:
14
+
15
+
16
+
17
+ == REQUIREMENTS:
18
+
19
+ * guilded
20
+
21
+ == INSTALL:
22
+
23
+
24
+
25
+ == LICENSE:
26
+
27
+ (The MIT License)
28
+
29
+ Copyright (c) 2009 FIXME full name
30
+
31
+ Permission is hereby granted, free of charge, to any person obtaining
32
+ a copy of this software and associated documentation files (the
33
+ 'Software'), to deal in the Software without restriction, including
34
+ without limitation the rights to use, copy, modify, merge, publish,
35
+ distribute, sublicense, and/or sell copies of the Software, and to
36
+ permit persons to whom the Software is furnished to do so, subject to
37
+ the following conditions:
38
+
39
+ The above copyright notice and this permission notice shall be
40
+ included in all copies or substantial portions of the Software.
41
+
42
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
43
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
44
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
45
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
46
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
47
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
48
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,29 @@
1
+ %w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f }
2
+ require File.dirname(__FILE__) + '/lib/flash_growler'
3
+
4
+ # Generate all the Rake tasks
5
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
6
+ $hoe = Hoe.new('flash_growler', FlashGrowler::VERSION) do |p|
7
+ p.developer('midas', 'jason@lookforwardenterprises.com')
8
+ p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
9
+ p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
10
+ p.rubyforge_name = p.name # TODO this is default value
11
+ # p.extra_deps = [
12
+ # ['activesupport','>= 2.0.2'],
13
+ # ]
14
+ p.extra_dev_deps = [
15
+ ['newgem', ">= #{::Newgem::VERSION}"],
16
+ ['midas-guilded', ">=0.0.5"]
17
+ ]
18
+
19
+ p.clean_globs |= %w[**/.DS_Store tmp *.log]
20
+ path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
21
+ p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
22
+ p.rsync_args = '-av --delete --ignore-errors'
23
+ end
24
+
25
+ require 'newgem/tasks' # load /tasks/*.rake
26
+ Dir['tasks/**/*.rake'].each { |t| load t }
27
+
28
+ # TODO - want other tests/tasks run by default? Add them to the list
29
+ # task :default => [:spec, :features]
@@ -0,0 +1,41 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{flash_growler}
5
+ s.version = "1.0.1"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["midas"]
9
+ s.date = %q{2009-03-07}
10
+ s.description = %q{A Guilded component that displays Rails flash messages in an interface similar to OS/X's growler.}
11
+ s.email = ["jason@lookforwardenterprises.com"]
12
+ s.extra_rdoc_files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc"]
13
+ s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "flash_growler.gemspec", "lib/flash_growler.rb", "lib/flash_growler/view_helpers.rb", "rails_generators/flash_growler_assets/flash_growler_assets_generator.rb", "rails_generators/flash_growler_assets/templates/alert.png", "rails_generators/flash_growler_assets/templates/bg.png", "rails_generators/flash_growler_assets/templates/default.css", "rails_generators/flash_growler_assets/templates/error.png", "rails_generators/flash_growler_assets/templates/guilded.flash_growler.js", "rails_generators/flash_growler_assets/templates/info.png", "rails_generators/flash_growler_assets/templates/jquery-growler-0.1.js", "script/console", "script/destroy", "script/generate", "spec/flash_growler_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/rspec.rake"]
14
+ s.has_rdoc = true
15
+ s.homepage = %q{http://github.com/midas/flash_growler/tree/master}
16
+ s.post_install_message = %q{PostInstall.txt}
17
+ s.rdoc_options = ["--main", "README.rdoc"]
18
+ s.require_paths = ["lib"]
19
+ s.rubyforge_project = %q{flash_growler}
20
+ s.rubygems_version = %q{1.3.1}
21
+ s.summary = %q{A Guilded component that displays Rails flash messages in an interface similar to OS/X's growler.}
22
+
23
+ if s.respond_to? :specification_version then
24
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
25
+ s.specification_version = 2
26
+
27
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
28
+ s.add_development_dependency(%q<newgem>, [">= 1.2.3"])
29
+ s.add_development_dependency(%q<midas-guilded>, [">= 0.0.5"])
30
+ s.add_development_dependency(%q<hoe>, [">= 1.8.0"])
31
+ else
32
+ s.add_dependency(%q<newgem>, [">= 1.2.3"])
33
+ s.add_dependency(%q<midas-guilded>, [">= 0.0.4"])
34
+ s.add_dependency(%q<hoe>, [">= 1.8.0"])
35
+ end
36
+ else
37
+ s.add_dependency(%q<newgem>, [">= 1.2.3"])
38
+ s.add_dependency(%q<midas-guilded>, [">= 0.0.4"])
39
+ s.add_dependency(%q<hoe>, [">= 1.8.0"])
40
+ end
41
+ end
@@ -0,0 +1,28 @@
1
+ module FlashGrowler
2
+ module ViewHelpers
3
+
4
+ def g_flash_growler( *args )
5
+ return '' if flash.nil? || flash.empty?
6
+ options = args.extract_options!
7
+ #raise ArgumentError, "'cols' option required" unless options.include?( :cols )
8
+
9
+ position_cls = ''
10
+ if options[:position] == 'top'
11
+ position_cls = 'growl-top'
12
+ else
13
+ position_cls = 'growl-bottom'
14
+ end
15
+
16
+ Guilded::Guilder.instance.add( :flash_growler, options, [ 'jquery/jquery-growler-0.1.js' ] )
17
+
18
+ if flash[:error]
19
+ return "<div class=\"growl flash error #{position_cls}\" id=\"#{options[:id]}\"><div id=\"growl-icon-error\"></div><h3>Error</h3><p>#{flash[:error]}</p></div>"
20
+ elsif flash[:warning]
21
+ return "<div class=\"growl flash warning #{position_cls}\" id=\"#{options[:id]}\"><div id=\"growl-icon-alert\"></div><h3>Warning</h3><p>#{flash[:warning]}</p></div>"
22
+ elsif flash[:notice]
23
+ return "<div class=\"growl flash notice #{position_cls}\" id=\"#{options[:id]}\"><div id=\"growl-icon-msg\"></div><h3>Info</h3><p>#{flash[:notice]}</p></div>"
24
+ end
25
+ end
26
+
27
+ end
28
+ end
@@ -0,0 +1,10 @@
1
+ $:.unshift(File.dirname(__FILE__)) unless
2
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
+
4
+ require 'flash_growler/view_helpers'
5
+
6
+ module FlashGrowler
7
+ VERSION = '1.0.1'
8
+ end
9
+
10
+ ActionView::Base.send( :include, FlashGrowler::ViewHelpers ) if defined?( ActionView )
@@ -0,0 +1,21 @@
1
+ class FlashGrowlerAssetsGenerator < Rails::Generator::Base
2
+ def initialize(runtime_args, runtime_options = {})
3
+ super
4
+ end
5
+
6
+ def manifest
7
+ record do |m|
8
+ m.file "guilded.flash_growler.js", "public/javascripts/guilded.flash_growler.js"
9
+ m.directory "public/javascripts/jquery"
10
+ m.file 'jquery-growler-0.1.js', 'public/javascripts/jquery/jquery-growler-0.1.js'
11
+ m.directory "public/stylesheets/guilded"
12
+ m.directory "public/stylesheets/guilded/flash_growler"
13
+ m.directory "public/stylesheets/guilded/flash_growler/default"
14
+ m.file "default.css", "public/stylesheets/guilded/flash_growler/default.css"
15
+ m.file "alert.png", "public/stylesheets/guilded/flash_growler/default/alert.png"
16
+ m.file "bg.png", "public/stylesheets/guilded/flash_growler/default/bg.png"
17
+ m.file "error.png", "public/stylesheets/guilded/flash_growler/default/error.png"
18
+ m.file "info.png", "public/stylesheets/guilded/flash_growler/default/info.png"
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,22 @@
1
+ .growl {
2
+ position:absolute; z-index:999;
3
+ background:transparent url(/stylesheets/guilded/flash_growler/default/bg.png) repeat-x;
4
+ height:100px; width:100%; color:#FFF; font-family:Verdana;
5
+ opacity:0.85;
6
+ }
7
+ #growl-icon-msg {
8
+ background:transparent url(/stylesheets/guilded/flash_growler/default/info.png) no-repeat;
9
+ width:64px; height:64px; float:left; margin:19px 0 0 20px;
10
+ }
11
+ #growl-icon-alert {
12
+ background:transparent url(/stylesheets/guilded/flash_growler/default/alert.png) no-repeat;
13
+ width:64px; height:64px; float:left; margin:19px 0 0 20px;
14
+ }
15
+ #growl-icon-error {
16
+ background:transparent url(/stylesheets/guilded/flash_growler/default/error.png) no-repeat;
17
+ width:64px; height:64px; float:left; margin:19px 0 0 20px;
18
+ }
19
+ .growl-top { top:0; }
20
+ .growl-bottom { bottom:0; }
21
+ .growl h3 { font-size:15px; font-weight:normal; margin:12px 0 0 100px; }
22
+ .growl p { font-size:11px; font-weight:normal; margin:12px 0 0 100px; }
@@ -0,0 +1,4 @@
1
+ g.flashGrowlerInit = function( options )
2
+ {
3
+ $j( '#' + options.id ).growl( options );
4
+ };
@@ -0,0 +1,18 @@
1
+ (function($){
2
+
3
+ jQuery.fn.growl = function( opts )
4
+ {
5
+ // defaults
6
+ options = $.extend({
7
+ delay:4000,
8
+ speed:1000
9
+ }, opts);
10
+
11
+ window.setTimeout( function(){
12
+ $j( '#' + options.id ).slideToggle( options.speed );
13
+ }, options.delay );
14
+
15
+ return jQuery;
16
+ }
17
+
18
+ })(jQuery);
data/script/console ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # File: script/console
3
+ irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
+
5
+ libs = " -r irb/completion"
6
+ # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
+ # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
+ libs << " -r #{File.dirname(__FILE__) + '/../lib/flash_growler.rb'}"
9
+ puts "Loading flash_growler gem"
10
+ exec "#{irb} #{libs} --simple-prompt"
data/script/destroy ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/destroy'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Destroy.new.run(ARGV)
data/script/generate ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/generate'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Generate.new.run(ARGV)
@@ -0,0 +1,11 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ # Time to add your specs!
4
+ # http://rspec.info/
5
+ describe "Place your specs here" do
6
+
7
+ it "find this spec in spec directory" do
8
+ violated "Be sure to write your specs"
9
+ end
10
+
11
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1 @@
1
+ --colour
@@ -0,0 +1,10 @@
1
+ begin
2
+ require 'spec'
3
+ rescue LoadError
4
+ require 'rubygems'
5
+ gem 'rspec'
6
+ require 'spec'
7
+ end
8
+
9
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
10
+ require 'flash_growler'
data/tasks/rspec.rake ADDED
@@ -0,0 +1,21 @@
1
+ begin
2
+ require 'spec'
3
+ rescue LoadError
4
+ require 'rubygems'
5
+ require 'spec'
6
+ end
7
+ begin
8
+ require 'spec/rake/spectask'
9
+ rescue LoadError
10
+ puts <<-EOS
11
+ To use rspec for testing you must install rspec gem:
12
+ gem install rspec
13
+ EOS
14
+ exit(0)
15
+ end
16
+
17
+ desc "Run the specs under spec/models"
18
+ Spec::Rake::SpecTask.new do |t|
19
+ t.spec_opts = ['--options', "spec/spec.opts"]
20
+ t.spec_files = FileList['spec/**/*_spec.rb']
21
+ end
metadata ADDED
@@ -0,0 +1,109 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: midas-flash_growler
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - midas
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-03-07 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: newgem
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.2.3
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: midas-guilded
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.0.5
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: hoe
37
+ type: :development
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 1.8.0
44
+ version:
45
+ description: A Guilded component that displays Rails flash messages in an interface similar to OS/X's growler.
46
+ email:
47
+ - jason@lookforwardenterprises.com
48
+ executables: []
49
+
50
+ extensions: []
51
+
52
+ extra_rdoc_files:
53
+ - History.txt
54
+ - Manifest.txt
55
+ - PostInstall.txt
56
+ - README.rdoc
57
+ files:
58
+ - History.txt
59
+ - Manifest.txt
60
+ - PostInstall.txt
61
+ - README.rdoc
62
+ - Rakefile
63
+ - flash_growler.gemspec
64
+ - lib/flash_growler.rb
65
+ - lib/flash_growler/view_helpers.rb
66
+ - rails_generators/flash_growler_assets/flash_growler_assets_generator.rb
67
+ - rails_generators/flash_growler_assets/templates/alert.png
68
+ - rails_generators/flash_growler_assets/templates/bg.png
69
+ - rails_generators/flash_growler_assets/templates/default.css
70
+ - rails_generators/flash_growler_assets/templates/error.png
71
+ - rails_generators/flash_growler_assets/templates/guilded.flash_growler.js
72
+ - rails_generators/flash_growler_assets/templates/info.png
73
+ - rails_generators/flash_growler_assets/templates/jquery-growler-0.1.js
74
+ - script/console
75
+ - script/destroy
76
+ - script/generate
77
+ - spec/flash_growler_spec.rb
78
+ - spec/spec.opts
79
+ - spec/spec_helper.rb
80
+ - tasks/rspec.rake
81
+ has_rdoc: true
82
+ homepage: http://github.com/midas/flash_growler/tree/master
83
+ post_install_message: PostInstall.txt
84
+ rdoc_options:
85
+ - --main
86
+ - README.rdoc
87
+ require_paths:
88
+ - lib
89
+ required_ruby_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: "0"
94
+ version:
95
+ required_rubygems_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: "0"
100
+ version:
101
+ requirements: []
102
+
103
+ rubyforge_project: flash_growler
104
+ rubygems_version: 1.2.0
105
+ signing_key:
106
+ specification_version: 2
107
+ summary: A Guilded component that displays Rails flash messages in an interface similar to OS/X's growler.
108
+ test_files: []
109
+