cinatra 0.4.2 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,6 +3,7 @@ Cinatra
3
3
 
4
4
  Cinatra is a library for command based console application.
5
5
  It is like Sinatra.
6
+ シーナトラ.
6
7
 
7
8
  Feature
8
9
  -----
@@ -15,20 +16,24 @@ Feature
15
16
  Usage
16
17
  -----
17
18
 
18
- require 'cinatra'
19
-
20
19
  command 'todos' do |arg|
21
20
  show_todos
22
21
  end
23
22
 
24
23
  sub command:
25
24
 
26
- require 'cinatra'
27
-
28
25
  command 'todo add' do |arg|
29
26
  TODOS << arg
30
27
  end
31
28
 
29
+ write help:
30
+
31
+ command 'todos', <<HELP do |arg|
32
+ list todos
33
+ HELP
34
+ ...
35
+ end
36
+
32
37
  Run
33
38
  -----
34
39
 
@@ -52,7 +57,7 @@ exit:
52
57
  Installation
53
58
  -----
54
59
 
55
- gem install cinatra
60
+ % gem install cinatra
56
61
 
57
62
  Copyright
58
63
  -----
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.2
1
+ 0.5.0
@@ -0,0 +1,6 @@
1
+ require 'cinatra'
2
+
3
+ command 'hello' do
4
+ puts "Hello World"
5
+ end
6
+
@@ -7,6 +7,12 @@ class Cinatra
7
7
 
8
8
  attr_accessor :exiting
9
9
 
10
+ def initialize
11
+ Readline.basic_word_break_characters= "\t\n\"\\'`><=;|&{("
12
+ Readline.completion_proc = lambda {|text| completion(text) }
13
+ trap("INT") { exit }
14
+ end
15
+
10
16
  def add_command(name, desc = '', &block)
11
17
  name = normalize_as_command_name(name)
12
18
  if commands.key?(name)
@@ -51,9 +57,6 @@ class Cinatra
51
57
  end
52
58
 
53
59
  def start
54
- Readline.basic_word_break_characters= "\t\n\"\\'`><=;|&{("
55
- Readline.completion_proc = lambda {|text| completion(text) }
56
-
57
60
  while !exiting && buf = Readline.readline('> ', true)
58
61
  call(buf)
59
62
  end
@@ -128,5 +131,5 @@ command 'help', 'Show help'do |arg|
128
131
  end
129
132
 
130
133
  at_exit do
131
- Cinatra.start
134
+ Cinatra.start if $!.nil?
132
135
  end
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cinatra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ hash: 11
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 5
9
+ - 0
10
+ version: 0.5.0
5
11
  platform: ruby
6
12
  authors:
7
13
  - jugyo
@@ -9,29 +15,37 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2010-01-02 00:00:00 +09:00
18
+ date: 2010-08-18 00:00:00 +09:00
13
19
  default_executable:
14
20
  dependencies:
15
21
  - !ruby/object:Gem::Dependency
16
22
  name: shoulda
17
- type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
20
26
  requirements:
21
27
  - - ">="
22
28
  - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
23
32
  version: "0"
24
- version:
33
+ type: :development
34
+ version_requirements: *id001
25
35
  - !ruby/object:Gem::Dependency
26
36
  name: rr
27
- type: :development
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
30
40
  requirements:
31
41
  - - ">="
32
42
  - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
33
46
  version: "0"
34
- version:
47
+ type: :development
48
+ version_requirements: *id002
35
49
  description: Cinatra is a library for command based console application. It is like Sinatra. :)
36
50
  email: jugyo.org@gmail.com
37
51
  executables: []
@@ -47,6 +61,7 @@ files:
47
61
  - README.markdown
48
62
  - Rakefile
49
63
  - VERSION
64
+ - examples/hellow.rb
50
65
  - examples/sleep.rb
51
66
  - examples/todo.rb
52
67
  - lib/cinatra.rb
@@ -63,26 +78,33 @@ rdoc_options:
63
78
  require_paths:
64
79
  - lib
65
80
  required_ruby_version: !ruby/object:Gem::Requirement
81
+ none: false
66
82
  requirements:
67
83
  - - ">="
68
84
  - !ruby/object:Gem::Version
85
+ hash: 3
86
+ segments:
87
+ - 0
69
88
  version: "0"
70
- version:
71
89
  required_rubygems_version: !ruby/object:Gem::Requirement
90
+ none: false
72
91
  requirements:
73
92
  - - ">="
74
93
  - !ruby/object:Gem::Version
94
+ hash: 3
95
+ segments:
96
+ - 0
75
97
  version: "0"
76
- version:
77
98
  requirements: []
78
99
 
79
100
  rubyforge_project:
80
- rubygems_version: 1.3.5
101
+ rubygems_version: 1.3.7
81
102
  signing_key:
82
103
  specification_version: 3
83
104
  summary: Cinatra is a library for command based console application.
84
105
  test_files:
85
106
  - test/helper.rb
86
107
  - test/test_cinatra.rb
108
+ - examples/hellow.rb
87
109
  - examples/sleep.rb
88
110
  - examples/todo.rb