ripl-after_rc 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (7) hide show
  1. data/.gemspec +19 -0
  2. data/LICENSE.txt +22 -0
  3. data/README.rdoc +28 -0
  4. data/Rakefile +35 -0
  5. data/deps.rip +1 -0
  6. data/lib/ripl/after_rc.rb +26 -0
  7. metadata +90 -0
data/.gemspec ADDED
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require 'rubygems' unless Object.const_defined?(:Gem)
3
+ require File.dirname(__FILE__) + "/lib/ripl/after_rc"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "ripl-after_rc"
7
+ s.version = Ripl::AfterRc::VERSION
8
+ s.authors = ["Gabriel Horner"]
9
+ s.email = "gabriel.horner@gmail.com"
10
+ s.homepage = "http://github.com/cldwalker/ripl-after_rc"
11
+ s.summary = "A ripl plugin that defines blocks to run after ~/.irbrc"
12
+ s.description = "This ripl plugin provides a simple way to define blocks which are run after ~/.irbrc is loaded. A more useful version of IRB.conf[:IRB_RC]."
13
+ s.required_rubygems_version = ">= 1.3.6"
14
+ s.rubyforge_project = 'tagaholic'
15
+ s.add_dependency 'ripl', '>= 0.2.0'
16
+ s.files = Dir.glob(%w[{lib,test}/**/*.rb bin/* [A-Z]*.{txt,rdoc} ext/**/*.{rb,c} **/deps.rip]) + %w{Rakefile .gemspec}
17
+ s.extra_rdoc_files = ["README.rdoc", "LICENSE.txt"]
18
+ s.license = 'MIT'
19
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ The MIT LICENSE
2
+
3
+ Copyright (c) 2010 Gabriel Horner
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,28 @@
1
+ == Description
2
+ This ripl plugin provides a simple way to define blocks which are
3
+ run after ~/.irbrc is loaded. A more useful version of IRB.conf[:IRB_RC].
4
+
5
+ == Install
6
+ Install the gem with:
7
+
8
+ sudo gem install ripl-after_rc
9
+
10
+ == Usage
11
+
12
+ Add to your ~/.riplrc
13
+
14
+ require 'ripl/after_rc'
15
+
16
+ Anywhere in your ~/.irbrc
17
+
18
+ Ripl.after_rc do
19
+ # some code to run after ~/.irbrc
20
+ end
21
+
22
+ You can call Ripl.after_rc as many times as you'd like and the blocks
23
+ will be called later in the order they were defined.
24
+
25
+ == Motivation
26
+ So why use this at all? Say you have some Rails helpers to define but Rails doesn't get loaded until
27
+ later in the irbrc or after irbrc. Simply pass Ripl.after_rc a block and it will be called later
28
+ when Rails is available.
data/Rakefile ADDED
@@ -0,0 +1,35 @@
1
+ require 'rake'
2
+ require 'fileutils'
3
+
4
+ def gemspec
5
+ @gemspec ||= eval(File.read('.gemspec'), binding, '.gemspec')
6
+ end
7
+
8
+ desc "Build the gem"
9
+ task :gem=>:gemspec do
10
+ sh "gem build .gemspec"
11
+ FileUtils.mkdir_p 'pkg'
12
+ FileUtils.mv "#{gemspec.name}-#{gemspec.version}.gem", 'pkg'
13
+ end
14
+
15
+ desc "Install the gem locally"
16
+ task :install => :gem do
17
+ sh %{gem install pkg/#{gemspec.name}-#{gemspec.version}}
18
+ end
19
+
20
+ desc "Generate the gemspec"
21
+ task :generate do
22
+ puts gemspec.to_ruby
23
+ end
24
+
25
+ desc "Validate the gemspec"
26
+ task :gemspec do
27
+ gemspec.validate
28
+ end
29
+
30
+ desc 'Run tests'
31
+ task :test do |t|
32
+ sh 'bacon -q -Ilib -I. test/*_test.rb'
33
+ end
34
+
35
+ task :default => :test
data/deps.rip ADDED
@@ -0,0 +1 @@
1
+ ripl >=0.2.0
@@ -0,0 +1,26 @@
1
+ module Ripl
2
+ module AfterRc
3
+ VERSION = '0.1.0'
4
+
5
+ def self.included(mod)
6
+ Ripl.extend ClassMethods
7
+ end
8
+
9
+ def before_loop
10
+ super
11
+ Ripl.after_rcs.each {|e| e.call }
12
+ end
13
+
14
+ module ClassMethods
15
+ def after_rcs
16
+ @after_rcs ||= []
17
+ end
18
+
19
+ def after_rc(&block)
20
+ after_rcs << block
21
+ end
22
+ end
23
+ end
24
+ end
25
+
26
+ Ripl::Shell.send :include, Ripl::AfterRc if defined? Ripl::Shell
metadata ADDED
@@ -0,0 +1,90 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ripl-after_rc
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Gabriel Horner
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-11-09 00:00:00 -05:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: ripl
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 23
30
+ segments:
31
+ - 0
32
+ - 2
33
+ - 0
34
+ version: 0.2.0
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ description: This ripl plugin provides a simple way to define blocks which are run after ~/.irbrc is loaded. A more useful version of IRB.conf[:IRB_RC].
38
+ email: gabriel.horner@gmail.com
39
+ executables: []
40
+
41
+ extensions: []
42
+
43
+ extra_rdoc_files:
44
+ - README.rdoc
45
+ - LICENSE.txt
46
+ files:
47
+ - lib/ripl/after_rc.rb
48
+ - LICENSE.txt
49
+ - README.rdoc
50
+ - deps.rip
51
+ - Rakefile
52
+ - .gemspec
53
+ has_rdoc: true
54
+ homepage: http://github.com/cldwalker/ripl-after_rc
55
+ licenses:
56
+ - MIT
57
+ post_install_message:
58
+ rdoc_options: []
59
+
60
+ require_paths:
61
+ - lib
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ hash: 3
68
+ segments:
69
+ - 0
70
+ version: "0"
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ hash: 23
77
+ segments:
78
+ - 1
79
+ - 3
80
+ - 6
81
+ version: 1.3.6
82
+ requirements: []
83
+
84
+ rubyforge_project: tagaholic
85
+ rubygems_version: 1.3.7
86
+ signing_key:
87
+ specification_version: 3
88
+ summary: A ripl plugin that defines blocks to run after ~/.irbrc
89
+ test_files: []
90
+