rubysl-readline 0.0.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +0 -1
  3. data/.travis.yml +8 -0
  4. data/README.md +2 -2
  5. data/Rakefile +0 -1
  6. data/ext/rubysl/readline/extconf.rb +64 -0
  7. data/ext/rubysl/readline/readline.c +537 -0
  8. data/lib/readline.rb +1 -0
  9. data/lib/rubysl/readline.rb +2 -0
  10. data/lib/{rubysl-readline → rubysl/readline}/version.rb +1 -1
  11. data/rubysl-readline.gemspec +20 -18
  12. data/spec/basic_quote_characters_spec.rb +18 -0
  13. data/spec/basic_word_break_characters_spec.rb +18 -0
  14. data/spec/completer_quote_characters_spec.rb +18 -0
  15. data/spec/completer_word_break_characters_spec.rb +18 -0
  16. data/spec/completion_append_character_spec.rb +18 -0
  17. data/spec/completion_case_fold_spec.rb +20 -0
  18. data/spec/completion_proc_spec.rb +24 -0
  19. data/spec/constants_spec.rb +20 -0
  20. data/spec/emacs_editing_mode_spec.rb +11 -0
  21. data/spec/filename_quote_characters_spec.rb +18 -0
  22. data/spec/history/append_spec.rb +30 -0
  23. data/spec/history/delete_at_spec.rb +47 -0
  24. data/spec/history/each_spec.rb +31 -0
  25. data/spec/history/element_reference_spec.rb +42 -0
  26. data/spec/history/element_set_spec.rb +37 -0
  27. data/spec/history/empty_spec.rb +15 -0
  28. data/spec/history/history_spec.rb +11 -0
  29. data/spec/history/length_spec.rb +10 -0
  30. data/spec/history/pop_spec.rb +32 -0
  31. data/spec/history/push_spec.rb +28 -0
  32. data/spec/history/shared/size.rb +14 -0
  33. data/spec/history/shift_spec.rb +32 -0
  34. data/spec/history/size_spec.rb +10 -0
  35. data/spec/history/to_s_spec.rb +11 -0
  36. data/spec/readline_spec.rb +32 -0
  37. data/spec/vi_editing_mode_spec.rb +11 -0
  38. metadata +135 -87
  39. data/lib/rubysl-readline.rb +0 -7
@@ -0,0 +1,15 @@
1
+ process_is_foreground do
2
+ with_feature :readline do
3
+ require 'readline'
4
+
5
+ describe "Readline::HISTORY.empty?" do
6
+ it "returns true when the history is empty" do
7
+ Readline::HISTORY.should be_empty
8
+ Readline::HISTORY.push("test")
9
+ Readline::HISTORY.should_not be_empty
10
+ Readline::HISTORY.pop
11
+ Readline::HISTORY.should be_empty
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,11 @@
1
+ process_is_foreground do
2
+ with_feature :readline do
3
+ require 'readline'
4
+
5
+ describe "Readline::HISTORY" do
6
+ it "is extended with the Enumerable module" do
7
+ Readline::HISTORY.should be_kind_of(Enumerable)
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,10 @@
1
+ process_is_foreground do
2
+ with_feature :readline do
3
+ require 'readline'
4
+ require File.expand_path('../shared/size', __FILE__)
5
+
6
+ describe "Readline::HISTORY.length" do
7
+ it_behaves_like :readline_history_size, :length
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,32 @@
1
+ process_is_foreground do
2
+ with_feature :readline do
3
+ require 'readline'
4
+
5
+ describe "Readline::HISTORY.pop" do
6
+ it "returns nil when the history is empty" do
7
+ Readline::HISTORY.pop.should be_nil
8
+ end
9
+
10
+ it "returns and removes the last item from the history" do
11
+ Readline::HISTORY.push("1", "2", "3")
12
+ Readline::HISTORY.size.should == 3
13
+
14
+ Readline::HISTORY.pop.should == "3"
15
+ Readline::HISTORY.size.should == 2
16
+
17
+ Readline::HISTORY.pop.should == "2"
18
+ Readline::HISTORY.size.should == 1
19
+
20
+ Readline::HISTORY.pop.should == "1"
21
+ Readline::HISTORY.size.should == 0
22
+ end
23
+
24
+ it "taints the returned strings" do
25
+ Readline::HISTORY.push("1", "2", "3")
26
+ Readline::HISTORY.pop.tainted?.should be_true
27
+ Readline::HISTORY.pop.tainted?.should be_true
28
+ Readline::HISTORY.pop.tainted?.should be_true
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,28 @@
1
+ process_is_foreground do
2
+ with_feature :readline do
3
+ require 'readline'
4
+
5
+ describe "Readline::HISTORY.push" do
6
+ it "pushes all passed Objects into the history" do
7
+ Readline::HISTORY.push("1", "2", "3")
8
+ Readline::HISTORY.size.should == 3
9
+
10
+ Readline::HISTORY.pop.should == "3"
11
+ Readline::HISTORY.pop.should == "2"
12
+ Readline::HISTORY.pop.should == "1"
13
+ end
14
+
15
+ it "tries to convert the passed Object to a String using #to_str" do
16
+ obj = mock("Converted to String")
17
+ obj.should_receive(:to_str).and_return("converted")
18
+
19
+ Readline::HISTORY.push(obj)
20
+ Readline::HISTORY.pop.should == "converted"
21
+ end
22
+
23
+ it "raises a TypeError when the passed Object can't be converted to a String" do
24
+ lambda { Readline::HISTORY.push(mock("Object")) }.should raise_error(TypeError)
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,14 @@
1
+ describe :readline_history_size, :shared => true do
2
+ it "returns the size of the history" do
3
+ Readline::HISTORY.send(@method).should == 0
4
+ Readline::HISTORY.push("1", "2", "")
5
+ Readline::HISTORY.send(@method).should == 3
6
+
7
+ Readline::HISTORY.pop
8
+ Readline::HISTORY.send(@method).should == 2
9
+
10
+ Readline::HISTORY.pop
11
+ Readline::HISTORY.pop
12
+ Readline::HISTORY.send(@method).should == 0
13
+ end
14
+ end
@@ -0,0 +1,32 @@
1
+ process_is_foreground do
2
+ with_feature :readline do
3
+ require 'readline'
4
+
5
+ describe "Readline::HISTORY.shift" do
6
+ it "returns nil when the history is empty" do
7
+ Readline::HISTORY.shift.should be_nil
8
+ end
9
+
10
+ it "returns and removes the first item from the history" do
11
+ Readline::HISTORY.push("1", "2", "3")
12
+ Readline::HISTORY.size.should == 3
13
+
14
+ Readline::HISTORY.shift.should == "1"
15
+ Readline::HISTORY.size.should == 2
16
+
17
+ Readline::HISTORY.shift.should == "2"
18
+ Readline::HISTORY.size.should == 1
19
+
20
+ Readline::HISTORY.shift.should == "3"
21
+ Readline::HISTORY.size.should == 0
22
+ end
23
+
24
+ it "taints the returned strings" do
25
+ Readline::HISTORY.push("1", "2", "3")
26
+ Readline::HISTORY.shift.tainted?.should be_true
27
+ Readline::HISTORY.shift.tainted?.should be_true
28
+ Readline::HISTORY.shift.tainted?.should be_true
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,10 @@
1
+ process_is_foreground do
2
+ with_feature :readline do
3
+ require 'readline'
4
+ require File.expand_path('../shared/size', __FILE__)
5
+
6
+ describe "Readline::HISTORY.size" do
7
+ it_behaves_like :readline_history_size, :size
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,11 @@
1
+ process_is_foreground do
2
+ with_feature :readline do
3
+ require 'readline'
4
+
5
+ describe "Readline::HISTORY.to_s" do
6
+ it "returns 'HISTORY'" do
7
+ Readline::HISTORY.to_s.should == "HISTORY"
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,32 @@
1
+ process_is_foreground do
2
+ with_feature :readline do
3
+ require 'readline'
4
+
5
+ describe "Readline.readline" do
6
+ before :each do
7
+ @file = tmp('readline')
8
+ File.open(@file, 'w') do |file|
9
+ file.puts "test\n"
10
+ end
11
+ @stdin_back = STDIN.dup
12
+ @stdout_back = STDOUT.dup
13
+ STDIN.reopen(@file, 'r')
14
+ STDOUT.reopen("/dev/null")
15
+ end
16
+
17
+ after :each do
18
+ rm_r @file
19
+ STDIN.reopen(@stdin_back)
20
+ STDOUT.reopen(@stdout_back)
21
+ end
22
+
23
+ it "returns the input string" do
24
+ Readline.readline.should == "test"
25
+ end
26
+
27
+ it "taints the returned strings" do
28
+ Readline.readline.tainted?.should be_true
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,11 @@
1
+ process_is_foreground do
2
+ with_feature :readline do
3
+ require 'readline'
4
+
5
+ describe "Readline.vi_editing_mode" do
6
+ it "returns nil" do
7
+ Readline.vi_editing_mode.should be_nil
8
+ end
9
+ end
10
+ end
11
+ end
metadata CHANGED
@@ -1,118 +1,166 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: rubysl-readline
3
- version: !ruby/object:Gem::Version
4
- hash: 856480538658449761
5
- prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 1
10
- version: 0.0.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Brian Shirai
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2013-04-15 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: redcard
11
+ date: 2013-09-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
22
21
  prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
26
24
  - - ~>
27
- - !ruby/object:Gem::Version
28
- hash: 4428665182548103036
29
- segments:
30
- - 1
31
- - 0
32
- version: "1.0"
33
- type: :runtime
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
36
28
  name: rake
37
- prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
39
- none: false
40
- requirements:
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
41
31
  - - ~>
42
- - !ruby/object:Gem::Version
43
- hash: 1510892033553700768
44
- segments:
45
- - 10
46
- - 0
47
- version: "10.0"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
48
34
  type: :development
49
- version_requirements: *id002
50
- - !ruby/object:Gem::Dependency
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
51
42
  name: mspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.5'
48
+ type: :development
52
49
  prerelease: false
53
- requirement: &id003 !ruby/object:Gem::Requirement
54
- none: false
55
- requirements:
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.5'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubysl-prettyprint
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
56
59
  - - ~>
57
- - !ruby/object:Gem::Version
58
- hash: 1660815245844205030
59
- segments:
60
- - 1
61
- - 5
62
- version: "1.5"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
63
62
  type: :development
64
- version_requirements: *id003
65
- description: Ruby Standard Library - readline
66
- email:
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '1.0'
69
+ description: Ruby standard library readline.
70
+ email:
67
71
  - brixen@gmail.com
68
72
  executables: []
69
-
70
- extensions: []
71
-
73
+ extensions:
74
+ - ext/rubysl/readline/extconf.rb
72
75
  extra_rdoc_files: []
73
-
74
- files:
76
+ files:
75
77
  - .gitignore
78
+ - .travis.yml
76
79
  - Gemfile
77
80
  - LICENSE
78
81
  - README.md
79
82
  - Rakefile
80
- - lib/rubysl-readline.rb
81
- - lib/rubysl-readline/version.rb
83
+ - ext/rubysl/readline/extconf.rb
84
+ - ext/rubysl/readline/readline.c
85
+ - lib/readline.rb
86
+ - lib/rubysl/readline.rb
87
+ - lib/rubysl/readline/version.rb
82
88
  - rubysl-readline.gemspec
83
- homepage: ""
84
- licenses: []
85
-
89
+ - spec/basic_quote_characters_spec.rb
90
+ - spec/basic_word_break_characters_spec.rb
91
+ - spec/completer_quote_characters_spec.rb
92
+ - spec/completer_word_break_characters_spec.rb
93
+ - spec/completion_append_character_spec.rb
94
+ - spec/completion_case_fold_spec.rb
95
+ - spec/completion_proc_spec.rb
96
+ - spec/constants_spec.rb
97
+ - spec/emacs_editing_mode_spec.rb
98
+ - spec/filename_quote_characters_spec.rb
99
+ - spec/history/append_spec.rb
100
+ - spec/history/delete_at_spec.rb
101
+ - spec/history/each_spec.rb
102
+ - spec/history/element_reference_spec.rb
103
+ - spec/history/element_set_spec.rb
104
+ - spec/history/empty_spec.rb
105
+ - spec/history/history_spec.rb
106
+ - spec/history/length_spec.rb
107
+ - spec/history/pop_spec.rb
108
+ - spec/history/push_spec.rb
109
+ - spec/history/shared/size.rb
110
+ - spec/history/shift_spec.rb
111
+ - spec/history/size_spec.rb
112
+ - spec/history/to_s_spec.rb
113
+ - spec/readline_spec.rb
114
+ - spec/vi_editing_mode_spec.rb
115
+ homepage: https://github.com/rubysl/rubysl-readline
116
+ licenses:
117
+ - BSD
118
+ metadata: {}
86
119
  post_install_message:
87
120
  rdoc_options: []
88
-
89
- require_paths:
121
+ require_paths:
90
122
  - lib
91
- required_ruby_version: !ruby/object:Gem::Requirement
92
- none: false
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- hash: 2002549777813010636
97
- segments:
98
- - 0
99
- version: "0"
100
- required_rubygems_version: !ruby/object:Gem::Requirement
101
- none: false
102
- requirements:
103
- - - ">="
104
- - !ruby/object:Gem::Version
105
- hash: 2002549777813010636
106
- segments:
107
- - 0
108
- version: "0"
123
+ required_ruby_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - '>='
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ required_rubygems_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - '>='
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
109
133
  requirements: []
110
-
111
134
  rubyforge_project:
112
- rubygems_version: 1.8.25
135
+ rubygems_version: 2.0.3
113
136
  signing_key:
114
- specification_version: 3
115
- summary: Ruby Standard Library - readline
116
- test_files: []
117
-
137
+ specification_version: 4
138
+ summary: Ruby standard library readline.
139
+ test_files:
140
+ - spec/basic_quote_characters_spec.rb
141
+ - spec/basic_word_break_characters_spec.rb
142
+ - spec/completer_quote_characters_spec.rb
143
+ - spec/completer_word_break_characters_spec.rb
144
+ - spec/completion_append_character_spec.rb
145
+ - spec/completion_case_fold_spec.rb
146
+ - spec/completion_proc_spec.rb
147
+ - spec/constants_spec.rb
148
+ - spec/emacs_editing_mode_spec.rb
149
+ - spec/filename_quote_characters_spec.rb
150
+ - spec/history/append_spec.rb
151
+ - spec/history/delete_at_spec.rb
152
+ - spec/history/each_spec.rb
153
+ - spec/history/element_reference_spec.rb
154
+ - spec/history/element_set_spec.rb
155
+ - spec/history/empty_spec.rb
156
+ - spec/history/history_spec.rb
157
+ - spec/history/length_spec.rb
158
+ - spec/history/pop_spec.rb
159
+ - spec/history/push_spec.rb
160
+ - spec/history/shared/size.rb
161
+ - spec/history/shift_spec.rb
162
+ - spec/history/size_spec.rb
163
+ - spec/history/to_s_spec.rb
164
+ - spec/readline_spec.rb
165
+ - spec/vi_editing_mode_spec.rb
118
166
  has_rdoc: