ritalin 0.0.1
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/.gitignore +9 -0
- data/README.rdoc +18 -0
- data/Rakefile +26 -0
- data/VERSION +1 -0
- data/bin/ritalin +6 -0
- data/lib/ritalin.rb +65 -0
- data/pkg/ritalin-0.0.1.gem +0 -0
- data/ritalin.gemspec +46 -0
- metadata +62 -0
data/.gitignore
ADDED
data/README.rdoc
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
= ritalin
|
2
|
+
|
3
|
+
irb profile management
|
4
|
+
|
5
|
+
= installation
|
6
|
+
|
7
|
+
The ritalin gem is hosted on gemcutter.org:
|
8
|
+
|
9
|
+
* gem install ritalin
|
10
|
+
|
11
|
+
|
12
|
+
= usage
|
13
|
+
|
14
|
+
# add an irb profile
|
15
|
+
$ ritalin -a mongo mongo_mapper taggable grip
|
16
|
+
|
17
|
+
# use that profile
|
18
|
+
$ ritalin mongo
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'rake/testtask'
|
4
|
+
require 'rake/rdoctask'
|
5
|
+
|
6
|
+
begin
|
7
|
+
require 'jeweler'
|
8
|
+
Jeweler::Tasks.new do |g|
|
9
|
+
g.name = 'ritalin'
|
10
|
+
g.summary = %(Keep track of you irb profiles)
|
11
|
+
g.description = %(Ritalin is a irb profile manager. Automatically load the libs you need through a single command.)
|
12
|
+
g.email = 'signalstatic@gmail.com'
|
13
|
+
g.homepage = 'http://github.com/twoism/ritalin'
|
14
|
+
g.authors = %w(twoism)
|
15
|
+
end
|
16
|
+
Jeweler::GemcutterTasks.new
|
17
|
+
rescue LoadError
|
18
|
+
puts 'Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com'
|
19
|
+
end
|
20
|
+
|
21
|
+
Rake::TestTask.new do |t|
|
22
|
+
t.libs = %w(test)
|
23
|
+
t.pattern = 'test/**/*_test.rb'
|
24
|
+
end
|
25
|
+
|
26
|
+
#task :default => :test
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
data/bin/ritalin
ADDED
data/lib/ritalin.rb
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
|
4
|
+
cmd_opts = {:irb => irb}
|
5
|
+
|
6
|
+
module Ritalin
|
7
|
+
PATH_TO_FILE = `echo $HOME`.strip + "/.ritalinrc"
|
8
|
+
|
9
|
+
class Profile
|
10
|
+
attr_accessor :libs, :name
|
11
|
+
|
12
|
+
def initialize name,libs=[]
|
13
|
+
self.name,self.libs = name,libs
|
14
|
+
end
|
15
|
+
|
16
|
+
def add_to_file
|
17
|
+
File.open(PATH_TO_FILE,'a') {|f| f.puts self.to_yaml.gsub("---","\n") }
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.list
|
21
|
+
YAML::load File.read(PATH_TO_FILE)
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.output_list
|
25
|
+
self.list.each do |p,libs|
|
26
|
+
puts "name: #{p}"
|
27
|
+
puts "libs: #{libs.join(", ")}"
|
28
|
+
puts "-------------------------"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.find name
|
33
|
+
raise "Invaid Profile" unless list.keys.include?(name.to_sym)
|
34
|
+
new name,list[name.to_sym]
|
35
|
+
end
|
36
|
+
|
37
|
+
def irb_cmd
|
38
|
+
"irb -r #{self.libs.join(" -r")}"
|
39
|
+
end
|
40
|
+
|
41
|
+
def to_yaml
|
42
|
+
{name.to_sym => self.libs}.to_yaml
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
class CmdParser
|
48
|
+
|
49
|
+
def initialize args
|
50
|
+
action_for_cmd args
|
51
|
+
end
|
52
|
+
|
53
|
+
def action_for_cmd args
|
54
|
+
case
|
55
|
+
when args.include?("-a")
|
56
|
+
profile_name, *libs = args - ["-a"]
|
57
|
+
Profile.new(profile_name,libs).add_to_file
|
58
|
+
when args.include?("-l")
|
59
|
+
Profile.output_list
|
60
|
+
else
|
61
|
+
system Profile.find(args.first).irb_cmd
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
Binary file
|
data/ritalin.gemspec
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{ritalin}
|
8
|
+
s.version = "0.0.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["twoism"]
|
12
|
+
s.date = %q{2009-12-28}
|
13
|
+
s.default_executable = %q{ritalin}
|
14
|
+
s.description = %q{Ritalin is a irb profile manager. Automatically load the libs you need through a single command.}
|
15
|
+
s.email = %q{signalstatic@gmail.com}
|
16
|
+
s.executables = ["ritalin"]
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"README.rdoc"
|
19
|
+
]
|
20
|
+
s.files = [
|
21
|
+
".gitignore",
|
22
|
+
"README.rdoc",
|
23
|
+
"Rakefile",
|
24
|
+
"VERSION",
|
25
|
+
"bin/ritalin",
|
26
|
+
"lib/ritalin.rb",
|
27
|
+
"pkg/ritalin-0.0.1.gem",
|
28
|
+
"ritalin.gemspec"
|
29
|
+
]
|
30
|
+
s.homepage = %q{http://github.com/twoism/ritalin}
|
31
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
32
|
+
s.require_paths = ["lib"]
|
33
|
+
s.rubygems_version = %q{1.3.5}
|
34
|
+
s.summary = %q{Keep track of you irb profiles}
|
35
|
+
|
36
|
+
if s.respond_to? :specification_version then
|
37
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
38
|
+
s.specification_version = 3
|
39
|
+
|
40
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
41
|
+
else
|
42
|
+
end
|
43
|
+
else
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
metadata
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ritalin
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- twoism
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-12-28 00:00:00 -05:00
|
13
|
+
default_executable: ritalin
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Ritalin is a irb profile manager. Automatically load the libs you need through a single command.
|
17
|
+
email: signalstatic@gmail.com
|
18
|
+
executables:
|
19
|
+
- ritalin
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README.rdoc
|
24
|
+
files:
|
25
|
+
- .gitignore
|
26
|
+
- README.rdoc
|
27
|
+
- Rakefile
|
28
|
+
- VERSION
|
29
|
+
- bin/ritalin
|
30
|
+
- lib/ritalin.rb
|
31
|
+
- pkg/ritalin-0.0.1.gem
|
32
|
+
- ritalin.gemspec
|
33
|
+
has_rdoc: true
|
34
|
+
homepage: http://github.com/twoism/ritalin
|
35
|
+
licenses: []
|
36
|
+
|
37
|
+
post_install_message:
|
38
|
+
rdoc_options:
|
39
|
+
- --charset=UTF-8
|
40
|
+
require_paths:
|
41
|
+
- lib
|
42
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: "0"
|
47
|
+
version:
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: "0"
|
53
|
+
version:
|
54
|
+
requirements: []
|
55
|
+
|
56
|
+
rubyforge_project:
|
57
|
+
rubygems_version: 1.3.5
|
58
|
+
signing_key:
|
59
|
+
specification_version: 3
|
60
|
+
summary: Keep track of you irb profiles
|
61
|
+
test_files: []
|
62
|
+
|