extlib-present 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 YOUR NAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README ADDED
@@ -0,0 +1,10 @@
1
+ extlib-present
2
+ ==============
3
+
4
+ A plugin for the Merb framework that provides Object#present?
5
+
6
+ This plugin depends on extlib.
7
+
8
+ USAGE:
9
+
10
+ object.present? #=> !object.blank?
@@ -0,0 +1,85 @@
1
+ require 'rubygems'
2
+ require 'rake/gempackagetask'
3
+
4
+ require 'merb-core'
5
+ require 'merb-core/tasks/merb'
6
+
7
+ GEM_NAME = "extlib-present"
8
+ GEM_VERSION = "0.0.2"
9
+ AUTHOR = "Genki Takiuchi"
10
+ EMAIL = "genki@s21g.com"
11
+ HOMEPAGE = "http://blog.s21g.com/genki"
12
+ RUBYFORGE_PROJECT = 'asakusarb'
13
+ SUMMARY = "Merb plugin that provides :present? method to Object"
14
+
15
+ spec = Gem::Specification.new do |s|
16
+ s.rubyforge_project = 'merb'
17
+ s.name = GEM_NAME
18
+ s.version = GEM_VERSION
19
+ s.platform = Gem::Platform::RUBY
20
+ s.has_rdoc = true
21
+ s.extra_rdoc_files = ["README", "LICENSE", 'TODO']
22
+ s.summary = SUMMARY
23
+ s.description = s.summary
24
+ s.author = AUTHOR
25
+ s.email = EMAIL
26
+ s.homepage = HOMEPAGE
27
+ s.add_dependency('extlib', '>= 0.9.9')
28
+ s.require_path = 'lib'
29
+ s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib,spec}/**/*")
30
+ end
31
+
32
+ Rake::GemPackageTask.new(spec) do |pkg|
33
+ pkg.need_tar = true
34
+ pkg.gem_spec = spec
35
+ end
36
+
37
+ desc "install the plugin as a gem"
38
+ task :install do
39
+ Merb::RakeHelper.install(GEM_NAME, :version => GEM_VERSION)
40
+ end
41
+
42
+ desc "Uninstall the gem"
43
+ task :uninstall do
44
+ Merb::RakeHelper.uninstall(GEM_NAME, :version => GEM_VERSION)
45
+ end
46
+
47
+ desc "Create a gemspec file"
48
+ task :gemspec do
49
+ File.open("#{GEM_NAME}.gemspec", "w") do |file|
50
+ file.puts spec.to_ruby
51
+ end
52
+ end
53
+
54
+ desc "Run specs"
55
+ task :spec do
56
+ sh "spec spec --color"
57
+ end
58
+
59
+ desc 'Package and upload the release to rubyforge.'
60
+ task :release => :package do |t|
61
+ require 'rubyforge'
62
+ v = ENV["VERSION"] or abort "Must supply VERSION=x.y.z"
63
+ abort "Versions don't match #{v} vs #{GEM_VERSION}" unless v == GEM_VERSION
64
+ pkg = "pkg/#{GEM_NAME}-#{GEM_VERSION}"
65
+
66
+ require 'rubyforge'
67
+ rf = RubyForge.new.configure
68
+ puts "Logging in"
69
+ rf.login
70
+
71
+ c = rf.userconfig
72
+ # c["release_notes"] = description if description
73
+ # c["release_changes"] = changes if changes
74
+ c["preformatted"] = true
75
+
76
+ files = [
77
+ "#{pkg}.tgz",
78
+ "#{pkg}.gem"
79
+ ].compact
80
+
81
+ puts "Releasing #{GEM_NAME} v. #{GEM_VERSION}"
82
+ rf.add_release RUBYFORGE_PROJECT, GEM_NAME, GEM_VERSION, *files
83
+ end
84
+
85
+ task :default => :spec
data/TODO ADDED
@@ -0,0 +1,5 @@
1
+ TODO:
2
+ Fix LICENSE with your name
3
+ Fix Rakefile with your name and contact info
4
+ Add your code to lib/extlib-present.rb
5
+ Add your Merb rake tasks to lib/extlib-present/merbtasks.rb
@@ -0,0 +1,18 @@
1
+ # make sure we're running inside Merb
2
+ if defined?(Merb::Plugins)
3
+
4
+ # Merb gives you a Merb::Plugins.config hash...feel free to put your stuff in your piece of it
5
+ Merb::Plugins.config[:extlib_present] = {
6
+ }
7
+
8
+ Merb::BootLoader.before_app_loads do
9
+ # require code that must be loaded before the application
10
+ require 'extlib-present/present.rb'
11
+ end
12
+
13
+ Merb::BootLoader.after_app_loads do
14
+ # code that can be required after the application loads
15
+ end
16
+
17
+ Merb::Plugins.add_rakefiles "extlib-present/merbtasks"
18
+ end
@@ -0,0 +1,6 @@
1
+ namespace :extlib_present do
2
+ desc "Do something for extlib-present"
3
+ task :default do
4
+ puts "extlib-present doesn't do anything"
5
+ end
6
+ end
@@ -0,0 +1,7 @@
1
+ require 'extlib'
2
+
3
+ class Object
4
+ def present?
5
+ !blank?
6
+ end
7
+ end
@@ -0,0 +1,24 @@
1
+ require File.dirname(__FILE__) + '/spec_helper'
2
+ require 'extlib-present/present'
3
+
4
+ describe "extlib-present" do
5
+ describe "extended object" do
6
+ it "should respond to :present?" do
7
+ nil.should be_respond_to(:present?)
8
+ end
9
+
10
+ it "blank object should return false" do
11
+ nil.should_not be_present
12
+ "".should_not be_present
13
+ [].should_not be_present
14
+ {}.should_not be_present
15
+ end
16
+
17
+ it "should return true if it is not blank" do
18
+ 1.should be_present
19
+ "a".should be_present
20
+ [1].should be_present
21
+ {:a => 1}.should be_present
22
+ end
23
+ end
24
+ end
@@ -0,0 +1 @@
1
+ $:.push File.join(File.dirname(__FILE__), '..', 'lib')
metadata ADDED
@@ -0,0 +1,73 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: extlib-present
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Genki Takiuchi
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-03-27 00:00:00 +09:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: extlib
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.9.9
24
+ version:
25
+ description: Merb plugin that provides :present? method to Object
26
+ email: genki@s21g.com
27
+ executables: []
28
+
29
+ extensions: []
30
+
31
+ extra_rdoc_files:
32
+ - README
33
+ - LICENSE
34
+ - TODO
35
+ files:
36
+ - LICENSE
37
+ - README
38
+ - Rakefile
39
+ - TODO
40
+ - lib/extlib-present
41
+ - lib/extlib-present/merbtasks.rb
42
+ - lib/extlib-present/present.rb
43
+ - lib/extlib-present.rb
44
+ - spec/extlib-present_spec.rb
45
+ - spec/spec_helper.rb
46
+ has_rdoc: true
47
+ homepage: http://blog.s21g.com/genki
48
+ post_install_message:
49
+ rdoc_options: []
50
+
51
+ require_paths:
52
+ - lib
53
+ required_ruby_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: "0"
58
+ version:
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: "0"
64
+ version:
65
+ requirements: []
66
+
67
+ rubyforge_project: merb
68
+ rubygems_version: 1.3.1
69
+ signing_key:
70
+ specification_version: 2
71
+ summary: Merb plugin that provides :present? method to Object
72
+ test_files: []
73
+