totem 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +18 -3
- data/lib/totem.rb +1 -1
- data/lib/totem/shell.rb +18 -4
- data/lib/totem/shell_cmds/console.rb +8 -0
- data/lib/totem/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1642673b0d6a2651e9c4d5b6b92042d1ff2762da
|
4
|
+
data.tar.gz: 005d524961253413c80a226d6cd7fbb19372886f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 153b35b769aeafb208e237efb13efb6d5b1fed0692a168da4a77f607715c137fa27f28180fb206669f64d857e2d5e52a92b731e994394a4ce6bee1f6041a5b33
|
7
|
+
data.tar.gz: ceac5fb168525595f9062d3a37f7c12100184c0b03fb25fbe3293796639e4bfb1b9349e8a04878964f65a40db82673652e3f916ec67a92b7bc312a2bf9071cf8
|
data/README.md
CHANGED
@@ -9,9 +9,7 @@ Features:
|
|
9
9
|
- Integrated console.
|
10
10
|
- Uses built in Ruby classes and avoids depending on 3rd party gems.
|
11
11
|
- Designed for MRI and JRuby.
|
12
|
-
- Easily extensible through gems or directly in your project.
|
13
|
-
- ActiveRecord (coming soon).
|
14
|
-
- Tribe (coming soon).
|
12
|
+
- Easily extensible through gems or directly in your project (ActiveRecord gem coming soon).
|
15
13
|
- Designed for multi-threaded applications.
|
16
14
|
|
17
15
|
## Installation
|
@@ -28,6 +26,23 @@ Or install it yourself as:
|
|
28
26
|
|
29
27
|
$ gem install totem
|
30
28
|
|
29
|
+
## Usage
|
30
|
+
|
31
|
+
Create a new project called "my_app" in the current directory:
|
32
|
+
|
33
|
+
$ totem new my_app
|
34
|
+
|
35
|
+
You must now setup Bundler (and rvm, rbenv, etc) for your new project:
|
36
|
+
|
37
|
+
$ bundle
|
38
|
+
|
39
|
+
You can now create your custom classes in the "app" directory.
|
40
|
+
You will need to manually "require" your classes in "app/loader.rb" since there isn't an auto-loader.
|
41
|
+
|
42
|
+
Totem comes with an IRB based console similar to Rails:
|
43
|
+
|
44
|
+
$ totem console
|
45
|
+
|
31
46
|
## Contributing
|
32
47
|
|
33
48
|
1. Fork it
|
data/lib/totem.rb
CHANGED
data/lib/totem/shell.rb
CHANGED
@@ -14,9 +14,7 @@ module Totem
|
|
14
14
|
|
15
15
|
def run
|
16
16
|
if @args[0].nil?
|
17
|
-
|
18
|
-
puts
|
19
|
-
puts "Commands:\n #{self.class.cmds.keys.join(', ')}"
|
17
|
+
puts_usage
|
20
18
|
return
|
21
19
|
end
|
22
20
|
|
@@ -30,7 +28,23 @@ module Totem
|
|
30
28
|
end
|
31
29
|
|
32
30
|
def cmd_to_class(cmd)
|
33
|
-
|
31
|
+
if result = self.class.cmds[cmd.to_sym]
|
32
|
+
return result
|
33
|
+
end
|
34
|
+
|
35
|
+
puts "ERROR: Unknown command: #{cmd}"
|
36
|
+
puts
|
37
|
+
puts_usage
|
38
|
+
|
39
|
+
exit
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def puts_usage
|
45
|
+
puts "Usage:\n totem <command>"
|
46
|
+
puts
|
47
|
+
puts "Commands:\n #{self.class.cmds.keys.join(', ')}"
|
34
48
|
end
|
35
49
|
end
|
36
50
|
end
|
@@ -4,6 +4,14 @@ module Totem
|
|
4
4
|
module ShellCmds
|
5
5
|
class Console < Totem::ShellCmds::Base
|
6
6
|
def run
|
7
|
+
env_path = 'config/environment.rb'
|
8
|
+
if File.exists?(env_path)
|
9
|
+
load(env_path)
|
10
|
+
else
|
11
|
+
puts "Unable to find #{env_path}. You must run this command from your project root directory."
|
12
|
+
exit
|
13
|
+
end
|
14
|
+
|
7
15
|
ARGV.clear
|
8
16
|
IRB.start
|
9
17
|
end
|
data/lib/totem/version.rb
CHANGED