ripl-rails 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gemspec ADDED
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require 'rubygems' unless Object.const_defined?(:Gem)
3
+ require File.dirname(__FILE__) + "/lib/ripl/rails"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "ripl-rails"
7
+ s.version = Ripl::Rails::VERSION
8
+ s.authors = ["Gabriel Horner"]
9
+ s.email = "gabriel.horner@gmail.com"
10
+ s.homepage = "http://github.com/cldwalker/ripl-rails"
11
+ s.summary = "Alternative to script/console using ripl"
12
+ s.description = "This provides an alternative to script/console and a ripl Rails plugin to be reused with app-specific shells. Compatible with Rails 2.3.x and Rails 3.x."
13
+ s.required_rubygems_version = ">= 1.3.6"
14
+ s.rubyforge_project = 'tagaholic'
15
+ s.executables = ['ripl-rails']
16
+ s.add_dependency 'ripl', '>= 0.1.2'
17
+ s.files = Dir.glob(%w[{lib,test}/**/*.rb bin/* [A-Z]*.{txt,rdoc} ext/**/*.{rb,c} **/deps.rip]) + %w{Rakefile .gemspec}
18
+ s.extra_rdoc_files = ["README.rdoc", "LICENSE.txt"]
19
+ s.license = 'MIT'
20
+ end
data/CHANGELOG.rdoc ADDED
@@ -0,0 +1,2 @@
1
+ == 0.1.0
2
+ * Initial plugin and executable for Rails 2.3.x and Rails 3.x
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,23 @@
1
+ == Description
2
+ This provides an alternative to script/console and a ripl Rails plugin to be reused with
3
+ app-specific shells. Compatible with Rails 2.3.x and Rails 3.x.
4
+
5
+ == Install
6
+ Install the gem with:
7
+
8
+ sudo gem install ripl-rails
9
+
10
+ == Executable Usage
11
+
12
+ $ ripl rails
13
+ Loading development environment (Rails 3.0.0)
14
+ >> ...
15
+
16
+ == Plugin Usage
17
+
18
+ The ripl plugin can be used to create Rails app-specific shells:
19
+
20
+ require 'ripl'
21
+ require 'ripl/rails'
22
+ # App specific setup
23
+ Ripl.start
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/bin/ripl-rails ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'ripl'
4
+ require 'ripl/rails'
5
+ Ripl.start
data/deps.rip ADDED
@@ -0,0 +1 @@
1
+ ripl >=0.1.2
data/lib/ripl/rails.rb ADDED
@@ -0,0 +1,29 @@
1
+ module Ripl
2
+ module Rails
3
+ VERSION = '0.1.0'
4
+
5
+ def before_loop
6
+ load_rails
7
+ super
8
+ end
9
+
10
+ def load_rails
11
+ abort "Not in a Rails environment" unless File.exists?("#{Dir.pwd}/config/boot.rb")
12
+ ENV['RAILS_ENV'] = ARGV[0] if ARGV[0]
13
+
14
+ require "#{Dir.pwd}/config/boot"
15
+ require 'rails' unless defined? ::Rails
16
+ if ::Rails.version >= '3.0'
17
+ Object.const_set :APP_PATH, File.expand_path("#{Dir.pwd}/config/application")
18
+ require 'rails/commands/console'
19
+ require APP_PATH
20
+ ::Rails.application.require_environment!
21
+ else
22
+ ["#{Dir.pwd}/config/environment", 'console_app', 'console_with_helpers'].each {|e| require e }
23
+ end
24
+ puts "Loading #{::Rails.env} environment (Rails #{::Rails.version})"
25
+ end
26
+ end
27
+ end
28
+
29
+ Ripl::Shell.send :include, Ripl::Rails if defined? Ripl::Shell
metadata ADDED
@@ -0,0 +1,92 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ripl-rails
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-01 00:00:00 -04: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: 31
30
+ segments:
31
+ - 0
32
+ - 1
33
+ - 2
34
+ version: 0.1.2
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ description: This provides an alternative to script/console and a ripl Rails plugin to be reused with app-specific shells. Compatible with Rails 2.3.x and Rails 3.x.
38
+ email: gabriel.horner@gmail.com
39
+ executables:
40
+ - ripl-rails
41
+ extensions: []
42
+
43
+ extra_rdoc_files:
44
+ - README.rdoc
45
+ - LICENSE.txt
46
+ files:
47
+ - lib/ripl/rails.rb
48
+ - bin/ripl-rails
49
+ - LICENSE.txt
50
+ - CHANGELOG.rdoc
51
+ - README.rdoc
52
+ - deps.rip
53
+ - Rakefile
54
+ - .gemspec
55
+ has_rdoc: true
56
+ homepage: http://github.com/cldwalker/ripl-rails
57
+ licenses:
58
+ - MIT
59
+ post_install_message:
60
+ rdoc_options: []
61
+
62
+ require_paths:
63
+ - lib
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ hash: 3
70
+ segments:
71
+ - 0
72
+ version: "0"
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ hash: 23
79
+ segments:
80
+ - 1
81
+ - 3
82
+ - 6
83
+ version: 1.3.6
84
+ requirements: []
85
+
86
+ rubyforge_project: tagaholic
87
+ rubygems_version: 1.3.7
88
+ signing_key:
89
+ specification_version: 3
90
+ summary: Alternative to script/console using ripl
91
+ test_files: []
92
+