brice 0.2.2 → 0.2.3
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/.rspec +3 -0
- data/README +1 -1
- data/lib/brice/config.rb +13 -0
- data/lib/brice/shortcuts.rb +8 -6
- data/lib/brice/version.rb +1 -1
- data/spec/brice/history_spec.rb +97 -0
- data/spec/spec_helper.rb +21 -0
- metadata +24 -21
data/.rspec
ADDED
data/README
CHANGED
data/lib/brice/config.rb
CHANGED
@@ -97,6 +97,19 @@ module Brice
|
|
97
97
|
|
98
98
|
alias_method :-, :exclude
|
99
99
|
|
100
|
+
# call-seq:
|
101
|
+
# config.only(*packages)
|
102
|
+
# config %= packages
|
103
|
+
#
|
104
|
+
# Enable/include *only* packages +packages+,
|
105
|
+
# disable/exclude everything else.
|
106
|
+
def only(*packages)
|
107
|
+
clear
|
108
|
+
self.include(*packages)
|
109
|
+
end
|
110
|
+
|
111
|
+
alias_method :%, :only
|
112
|
+
|
100
113
|
# call-seq:
|
101
114
|
# config.clear
|
102
115
|
#
|
data/lib/brice/shortcuts.rb
CHANGED
@@ -81,14 +81,16 @@ module Brice
|
|
81
81
|
|
82
82
|
def cgrep(needle)
|
83
83
|
needle = %r{#{Regexp.escape(needle)}}i unless needle.is_a?(Regexp)
|
84
|
-
|
84
|
+
klass = is_a?(Class) ? self : self.class
|
85
85
|
res = []
|
86
86
|
|
87
|
-
ObjectSpace.each_object { |obj|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
87
|
+
ObjectSpace.each_object(Class) { |obj|
|
88
|
+
next unless obj <= klass
|
89
|
+
|
90
|
+
name = obj.name
|
91
|
+
next unless name =~ needle
|
92
|
+
|
93
|
+
res.push(name.empty? ? obj.inspect : name)
|
92
94
|
}
|
93
95
|
|
94
96
|
res
|
data/lib/brice/version.rb
CHANGED
@@ -0,0 +1,97 @@
|
|
1
|
+
require 'brice/history'
|
2
|
+
|
3
|
+
describe Brice::History do
|
4
|
+
|
5
|
+
def hist
|
6
|
+
@hist_store ||= []
|
7
|
+
end
|
8
|
+
|
9
|
+
def init_hist(opt = {})
|
10
|
+
@hist = Brice::History.new(opt.merge(:path => @path), hist)
|
11
|
+
end
|
12
|
+
|
13
|
+
def saved_hist
|
14
|
+
@hist.send(:save_history)
|
15
|
+
File.read(@path)
|
16
|
+
end
|
17
|
+
|
18
|
+
def compare_hist(input, result = input, saved = result)
|
19
|
+
input.each { |i| hist.push(i) }
|
20
|
+
hist.should == result
|
21
|
+
saved_hist.should == saved.map { |i| "#{i}\n" }.join
|
22
|
+
end
|
23
|
+
|
24
|
+
describe 'no uniq, no merge' do
|
25
|
+
|
26
|
+
before :each do
|
27
|
+
init_hist(:uniq => false, :merge => false)
|
28
|
+
end
|
29
|
+
|
30
|
+
example { compare_hist(%w[]) }
|
31
|
+
example { compare_hist(%w[1]) }
|
32
|
+
example { compare_hist(%w[1 2 3]) }
|
33
|
+
example { compare_hist(%w[1] * 3, %w[1 1 1]) }
|
34
|
+
example { compare_hist(%w[1 2 3 1], %w[1 2 3 1]) }
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
describe 'uniq, no merge' do
|
39
|
+
|
40
|
+
before :each do
|
41
|
+
init_hist(:uniq => true, :merge => false)
|
42
|
+
end
|
43
|
+
|
44
|
+
example { compare_hist(%w[]) }
|
45
|
+
example { compare_hist(%w[1]) }
|
46
|
+
example { compare_hist(%w[1 2 3]) }
|
47
|
+
example { compare_hist(%w[1] * 3, %w[1 1 1], %w[1]) }
|
48
|
+
example { compare_hist(%w[1 2 3 1], %w[1 2 3 1], %w[1 2 3]) }
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
describe 'uniq, merge' do
|
53
|
+
|
54
|
+
before :each do
|
55
|
+
init_hist(:uniq => true, :merge => true)
|
56
|
+
end
|
57
|
+
|
58
|
+
example { compare_hist(%w[]) }
|
59
|
+
example { compare_hist(%w[1]) }
|
60
|
+
example { compare_hist(%w[1 2 3]) }
|
61
|
+
example { compare_hist(%w[1] * 3, %w[1]) }
|
62
|
+
|
63
|
+
# TODO: describe merging
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
describe 'reverse uniq, no merge' do
|
68
|
+
|
69
|
+
before :each do
|
70
|
+
init_hist(:uniq => :reverse, :merge => false)
|
71
|
+
end
|
72
|
+
|
73
|
+
example { compare_hist(%w[]) }
|
74
|
+
example { compare_hist(%w[1]) }
|
75
|
+
example { compare_hist(%w[1 2 3]) }
|
76
|
+
example { compare_hist(%w[1] * 3, %w[1 1 1], %w[1]) }
|
77
|
+
example { compare_hist(%w[1 2 3 1], %w[1 2 3 1], %w[2 3 1]) }
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
describe 'reverse uniq, merge' do
|
82
|
+
|
83
|
+
before :each do
|
84
|
+
init_hist(:uniq => :reverse, :merge => true)
|
85
|
+
end
|
86
|
+
|
87
|
+
example { compare_hist(%w[]) }
|
88
|
+
example { compare_hist(%w[1]) }
|
89
|
+
example { compare_hist(%w[1 2 3]) }
|
90
|
+
example { compare_hist(%w[1] * 3, %w[1]) }
|
91
|
+
example { compare_hist(%w[1 2 3 1], %w[2 3 1]) }
|
92
|
+
|
93
|
+
# TODO: describe merging
|
94
|
+
|
95
|
+
end
|
96
|
+
|
97
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
$:.unshift('lib') unless $:.first == 'lib'
|
2
|
+
|
3
|
+
require 'tempfile'
|
4
|
+
|
5
|
+
RSpec.configure { |config|
|
6
|
+
config.before(:each) { open_tempfile }
|
7
|
+
config.after(:each) { close_tempfile }
|
8
|
+
|
9
|
+
config.include(Module.new {
|
10
|
+
def open_tempfile
|
11
|
+
@temp = Tempfile.open("wirble_spec_#{object_id}_temp")
|
12
|
+
@path = path = @temp.path
|
13
|
+
|
14
|
+
Kernel.at_exit { File.unlink(path) if File.file?(path) }
|
15
|
+
end
|
16
|
+
|
17
|
+
def close_tempfile
|
18
|
+
@temp.close(true) if @temp
|
19
|
+
end
|
20
|
+
})
|
21
|
+
}
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brice
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 3
|
10
|
+
version: 0.2.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jens Wille
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-12-13 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: ruby-nuggets
|
@@ -44,41 +44,44 @@ extra_rdoc_files:
|
|
44
44
|
- COPYING
|
45
45
|
- ChangeLog
|
46
46
|
files:
|
47
|
-
- lib/brice.rb
|
48
|
-
- lib/brice/init.rb
|
49
|
-
- lib/brice/history.rb
|
50
|
-
- lib/brice/colours.rb
|
51
|
-
- lib/brice/version.rb
|
52
|
-
- lib/brice/shortcuts.rb
|
53
47
|
- lib/brice/config.rb
|
54
|
-
- lib/brice/
|
55
|
-
- lib/brice/
|
56
|
-
- lib/brice/rc/020_libs.rb
|
57
|
-
- lib/brice/rc/030_history.rb
|
58
|
-
- lib/brice/rc/070_prompt.rb
|
48
|
+
- lib/brice/dsl.rb
|
49
|
+
- lib/brice/colours.rb
|
59
50
|
- lib/brice/rc/040_colours.rb
|
51
|
+
- lib/brice/rc/070_prompt.rb
|
52
|
+
- lib/brice/rc/030_history.rb
|
60
53
|
- lib/brice/rc/050_shortcuts.rb
|
54
|
+
- lib/brice/rc/090_devel.rb
|
55
|
+
- lib/brice/rc/020_libs.rb
|
61
56
|
- lib/brice/rc/060_init.rb
|
57
|
+
- lib/brice/rc/010_added_methods.rb
|
62
58
|
- lib/brice/rc/080_rails.rb
|
63
|
-
- lib/brice/
|
64
|
-
-
|
59
|
+
- lib/brice/version.rb
|
60
|
+
- lib/brice/history.rb
|
61
|
+
- lib/brice/init.rb
|
62
|
+
- lib/brice/shortcuts.rb
|
63
|
+
- lib/brice.rb
|
65
64
|
- ChangeLog
|
65
|
+
- COPYING
|
66
|
+
- README
|
66
67
|
- Rakefile
|
67
68
|
- TODO
|
68
|
-
-
|
69
|
+
- spec/brice/history_spec.rb
|
70
|
+
- spec/spec_helper.rb
|
71
|
+
- .rspec
|
69
72
|
homepage: http://prometheus.rubyforge.org/brice
|
70
73
|
licenses: []
|
71
74
|
|
72
75
|
post_install_message:
|
73
76
|
rdoc_options:
|
74
77
|
- --line-numbers
|
78
|
+
- --all
|
75
79
|
- --main
|
76
80
|
- README
|
77
|
-
- --all
|
78
81
|
- --charset
|
79
82
|
- UTF-8
|
80
83
|
- --title
|
81
|
-
- brice Application documentation (v0.2.
|
84
|
+
- brice Application documentation (v0.2.3)
|
82
85
|
require_paths:
|
83
86
|
- lib
|
84
87
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -102,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
105
|
requirements: []
|
103
106
|
|
104
107
|
rubyforge_project: prometheus
|
105
|
-
rubygems_version: 1.8.
|
108
|
+
rubygems_version: 1.8.12
|
106
109
|
signing_key:
|
107
110
|
specification_version: 3
|
108
111
|
summary: Extra cool IRb goodness for the masses
|