lovely-rufus 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -6,8 +6,14 @@ PATH
6
6
  GEM
7
7
  remote: http://rubygems.org/
8
8
  specs:
9
- minitest (2.11.4)
9
+ ffi (1.1.5)
10
+ listen (0.5.3)
11
+ minitest (4.2.0)
10
12
  rake (0.9.2.2)
13
+ rb-inotify (0.8.8)
14
+ ffi (>= 0.5.0)
15
+ rerun (0.7.1)
16
+ listen
11
17
 
12
18
  PLATFORMS
13
19
  ruby
@@ -15,5 +21,7 @@ PLATFORMS
15
21
  DEPENDENCIES
16
22
  bundler
17
23
  lovely-rufus!
18
- minitest (>= 2.3)
24
+ minitest (~> 4.0)
19
25
  rake
26
+ rb-inotify
27
+ rerun
data/Rakefile CHANGED
@@ -2,6 +2,7 @@ require 'rake/testtask'
2
2
 
3
3
  Rake::TestTask.new :spec do |task|
4
4
  task.test_files = FileList['spec/**/*_spec.rb']
5
+ task.warning = true
5
6
  end
6
7
 
7
8
  task default: :spec
@@ -1,16 +1,17 @@
1
1
  module LovelyRufus class Executable
2
-
3
- def initialize opts = ARGV
2
+ def initialize args = ARGV
4
3
  @width = 72
5
4
  OptionParser.new do |opts|
6
5
  opts.on '-w', '--width WIDTH', Integer, 'Wrapping width' do |width|
7
6
  @width = width
8
7
  end
9
- end.parse! opts
8
+ end.parse! args
10
9
  end
11
10
 
12
11
  def run input = $stdin
13
- puts Wrapper.new(input.read).wrapped @width
12
+ puts Wrapper.new(input.read).wrapped width
14
13
  end
15
14
 
15
+ attr_reader :width
16
+ private :width
16
17
  end end
@@ -5,13 +5,13 @@ module LovelyRufus class Wrapper
5
5
  NBSP = ' '
6
6
 
7
7
  def initialize text
8
- @paras = text.split(/\n[\/#> ]*\n/).map &:strip
8
+ @paras = text.split(/\n[\/#> ]*\n/).map(&:strip)
9
9
  end
10
10
 
11
11
  def wrapped max_width = 72
12
- return '' if @paras.all? &:empty?
12
+ return '' if paras.all?(&:empty?)
13
13
 
14
- @paras.map do |para|
14
+ paras.map do |para|
15
15
  best = wrap_para_to_width para, max_width
16
16
  (max_width - 1).downto 1 do |width|
17
17
  shorter = wrap_para_to_width para, width
@@ -23,6 +23,9 @@ module LovelyRufus class Wrapper
23
23
  end.join "\n\n"
24
24
  end
25
25
 
26
+ attr_reader :paras
27
+ private :paras
28
+
26
29
  private
27
30
 
28
31
  def remove_hangouts para, width
@@ -51,7 +54,7 @@ module LovelyRufus class Wrapper
51
54
  .tr("\n", ' ') # unwrap para
52
55
  .gsub(/ ([^ ]) /, " \\1#{NBSP}") # glue 1-letter words
53
56
  .gsub(/(.{1,#{width}})( |$\n?)/, "\\1\n") # wrap to width
54
- .tap { |para| remove_hangouts para, width } # handle hangouts
57
+ .tap { |par| remove_hangouts par, width } # handle hangouts
55
58
  .lines.map { |line| line.insert 0, leader }.join # re-insert leader
56
59
  .tr(NBSP, ' ') # drop glue spaces
57
60
  .chomp # final touch
data/lovely-rufus.gemspec CHANGED
@@ -1,16 +1,18 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = 'lovely-rufus'
3
- gem.version = '0.0.2'
3
+ gem.version = '0.0.3'
4
4
  gem.summary = 'lovely-rufus: text wrapper'
5
5
  gem.homepage = 'http://github.com/chastell/lovely-rufus'
6
6
  gem.author = 'Piotr Szotkowski'
7
7
  gem.email = 'chastell@chastell.net'
8
8
 
9
9
  gem.files = `git ls-files -z`.split "\0"
10
- gem.executables = `git ls-files -z -- bin/*`.split("\0").map { |file| File.basename file }
11
- gem.test_files = `git ls-files -z -- spec/*`.split "\0"
10
+ gem.executables = gem.files.grep(%r{^bin/}).map { |path| File.basename path }
11
+ gem.test_files = gem.files.grep %r{^spec/.*\.rb$}
12
12
 
13
13
  gem.add_development_dependency 'bundler'
14
- gem.add_development_dependency 'minitest', '>= 2.3'
14
+ gem.add_development_dependency 'minitest', '~> 4.0'
15
15
  gem.add_development_dependency 'rake'
16
+ gem.add_development_dependency 'rb-inotify'
17
+ gem.add_development_dependency 'rerun'
16
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lovely-rufus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-30 00:00:00.000000000 Z
12
+ date: 2012-11-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
16
- requirement: &19234340 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,21 +21,31 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *19234340
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: minitest
27
- requirement: &19233820 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
- - - ! '>='
35
+ - - ~>
31
36
  - !ruby/object:Gem::Version
32
- version: '2.3'
37
+ version: '4.0'
33
38
  type: :development
34
39
  prerelease: false
35
- version_requirements: *19233820
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '4.0'
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: rake
38
- requirement: &19233320 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ! '>='
@@ -43,7 +53,44 @@ dependencies:
43
53
  version: '0'
44
54
  type: :development
45
55
  prerelease: false
46
- version_requirements: *19233320
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rb-inotify
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: rerun
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
47
94
  description:
48
95
  email: chastell@chastell.net
49
96
  executables:
@@ -86,13 +133,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
133
  version: '0'
87
134
  requirements: []
88
135
  rubyforge_project:
89
- rubygems_version: 1.8.17
136
+ rubygems_version: 1.8.24
90
137
  signing_key:
91
138
  specification_version: 3
92
139
  summary: ! 'lovely-rufus: text wrapper'
93
140
  test_files:
94
- - spec/fixtures/wrapper.yml
95
141
  - spec/lovely-rufus/executable_spec.rb
96
142
  - spec/lovely-rufus/wrapper_spec.rb
97
143
  - spec/spec_helper.rb
98
- has_rdoc: