water 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YmE0MDQ1M2JmNWQ2ZjlkYTQ5YWY2NWZmYTgyNGI3NzdmMmVkODk4MA==
5
+ data.tar.gz: !binary |-
6
+ ZTY3NzZlZGJmNjQwN2U1ODFlMDc4MTBkMTFkMjA4MjRjOWJjMjU3Yg==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ OWVkMTdhZDMzY2ZmN2ZiNjY5NWEyMWUwYzk1ZDM0ZWMxMjM1MzZlNWQ1OTNl
10
+ M2QwODE3OTlhMTg2NGI3MjdmZmFiMmY0ODY5MzZlYWUwOTRjODY1ODMxYmFm
11
+ MDA4YmZlOGJiMTQwYWQ2YjQ4ZDM3YjYwZWE0NWEyNDUxOTI0YzA=
12
+ data.tar.gz: !binary |-
13
+ ZTE2NTg1N2NiYmI4M2M5ODBiMjc0MDhlNmQzYWUzODdhOGViODE1OWRiNGRk
14
+ MmE1MDFkOWQyODlkMmFiODg4M2YyMDJhM2E4NDg2NzM2ZGE5OTkzZTg3YTE1
15
+ ODAzN2FmYjk2ZWI1MDE0N2E2MzU5MjUzNTdhMTdkODFiNjAxNzU=
data/Rakefile CHANGED
@@ -5,5 +5,5 @@ task :default => :test
5
5
 
6
6
  desc 'Run a quick test'
7
7
  task :test do
8
- puts `git diff | ruby -rubygems -w -Ilib bin/water`
8
+ puts %x(git diff `git rev-list HEAD | tail -n 1` | ruby -rubygems -w -Ilib bin/water)
9
9
  end
@@ -0,0 +1,50 @@
1
+ body {
2
+ background: gray;
3
+ padding-bottom: 1000px;
4
+ }
5
+ body > a {
6
+ display: block;
7
+ position: fixed;
8
+ top: 0;
9
+ right: 0;
10
+ background: gray;
11
+ color: white;
12
+ padding: 5px 10px;
13
+ font-family: monospace;
14
+ font-weight: bold;
15
+ text-decoration: none;
16
+ }
17
+ body > a:hover {
18
+ text-decoration: underline;
19
+ }
20
+
21
+ .diff-block {
22
+ background: hsl(0,0%,95%);
23
+ margin: 5px;
24
+ margin-bottom: 0;
25
+ padding: 3px 6px;
26
+ overflow-y: visible;
27
+ overflow-x: auto;
28
+ -webkit-transition: 0.3s;
29
+ -moz-transition: 0.3s;
30
+ transition: 0.3s;
31
+ }
32
+ .diff-block.closed {
33
+ margin-top: -5px;
34
+ overflow: hidden;
35
+ }
36
+ .diff-block:first-of-type.closed {
37
+ margin-top: 0;
38
+ }
39
+
40
+ .CodeRay pre {
41
+ width: -moz-fit-content;
42
+ line-height: 15px;
43
+ }
44
+ .CodeRay .line {
45
+ float: none;
46
+ height: 15px;
47
+ }
48
+ .diff-block-content .CodeRay .line {
49
+ margin-bottom: -15px;
50
+ }
@@ -5,7 +5,9 @@ require 'coderay'
5
5
  require 'launchy'
6
6
 
7
7
  class Water
8
- DIFF_DIR_NAME = Pathname.new('~/.water').expand_path
8
+ DIFF_DIR_NAME = Pathname.new('~/.water').expand_path
9
+
10
+ CSS = File.read(File.expand_path('../../assets/water.css', __FILE__))
9
11
 
10
12
  def self.run
11
13
  new.run
@@ -44,7 +46,7 @@ class Water
44
46
  end
45
47
 
46
48
  def water diff
47
- output = diff.gsub(/\r\n?/, "\n").scan(/ (?> ^(?!-(?!--)|\+(?!\+\+)|[\\ ]|$|@@) .*\n)* (?> ^(?=-(?!--)|\+(?!\+\+)|[\\ ]|$|@@) .*(?:\n|\z))+ /x).map do |block|
49
+ output = diff.gsub(/\r\n?/, "\n").scan(/ (?> ^(?!-(?!--\ )|\+(?!\+\+)|[\\ ]|$|@@) .*\n)* (?> ^(?=-(?!--\ )|\+(?!\+\+)|[\\ ]|$|@@) .*(?:\n|\z))+ /x).map do |block|
48
50
  head_ray, content_ray = CodeRay.scanner(:diff).tokenize(block.split("\n", 2))
49
51
  content_ray ||= ''
50
52
 
@@ -58,80 +60,27 @@ class Water
58
60
 
59
61
  output.extend(CodeRay::Encoders::HTML::Output)
60
62
  output.css = CodeRay::Encoders::HTML::CSS.new(:alpha)
61
-
62
- output.css.stylesheet << <<-CSS
63
-
64
- body {
65
- background: gray;
66
- padding-bottom: 1000px;
67
- }
68
- body > a {
69
- display: block;
70
- position: fixed;
71
- top: 0;
72
- right: 0;
73
- background: gray;
74
- color: white;
75
- padding: 5px 10px;
76
- font-family: monospace;
77
- font-weight: bold;
78
- text-decoration: none;
79
- }
80
- body > a:hover {
81
- text-decoration: underline;
82
- }
83
-
84
- .diff-block {
85
- background: hsl(0,0%,95%);
86
- margin: 5px;
87
- margin-bottom: 0;
88
- padding: 3px 6px;
89
- overflow-y: visible;
90
- overflow-x: auto;
91
- -webkit-transition: 0.3s;
92
- -moz-transition: 0.3s;
93
- transition: 0.3s;
94
- }
95
- .diff-block.closed {
96
- margin-top: -5px;
97
- overflow: hidden;
98
- }
99
- .diff-block:first-of-type.closed {
100
- margin-top: 0;
101
- }
102
-
103
- .CodeRay pre {
104
- width: -moz-fit-content;
105
- line-height: 15px;
106
- }
107
- .CodeRay .line {
108
- float: none;
109
- height: 15px;
110
- }
111
- .diff-block-content .CodeRay .line {
112
- margin-bottom: -15px;
113
- }
114
- CSS
63
+ output.css.stylesheet << Water::CSS
115
64
 
116
65
  output.wrap_in! CodeRay::Encoders::HTML::Output.page_template_for_css(output.css)
117
66
  output.apply_title! "diff #{Dir.pwd} | water"
118
67
 
119
68
  output[/<\/head>\s*<body[^>]*>?/] = <<-JS
120
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
69
+ <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
121
70
  <script>
122
71
  $(function () {
123
- $('.diff-block').live('click', function () {
72
+ $(document).on('click', '.diff-block', function () {
124
73
  $(this).toggleClass('closed').find('.diff-block-content').slideToggle('fast');
125
74
  $('html, body').animate({ scrollTop: $(this).offset().top }, 'fast');
126
75
  });
127
- $('.diff-block').live('touchend', function () {
76
+ $(document).on('touchend', '.diff-block', function () {
128
77
  $(this).toggleClass('closed').find('.diff-block-content').slideToggle('fast');
129
78
  $('html, body').animate({ scrollTop: $(this).offset().top }, 'fast');
130
79
  });
131
- $('a.toggle-all').click(function () {
80
+ $(document).on('click', 'a.toggle-all', function () {
132
81
  $('.diff-block').toggleClass('closed').find('.diff-block-content').toggle();
133
82
  });
134
- })
83
+ });
135
84
  </script>
136
85
  </head>
137
86
 
@@ -1,14 +1,28 @@
1
1
  h1. Water
2
2
 
3
- Water takes a unified diff as its input and opens a browser window with a nicely formatted display of it. It uses CodeRay to highlight the code inside of the diff.
3
+ Water takes a unified diff and opens it in your browser nicely formatted.
4
+
5
+ p=. !http://cl.ly/Cdh8!
6
+
7
+ h2. Features
8
+
9
+ * syntax colors (CodeRay)
10
+ * highlighting of in-line changes ("eye-catchers")
11
+ * toggle files with a click
4
12
 
5
13
  h2. Usage
6
-
7
- bc. [git|svn|...] diff | water
14
+
15
+ bc. git diff | water
16
+
17
+ bc. svn diff -rPREV:HEAD | water
18
+
19
+ bc. diff -wu | water
20
+
21
+ p. …et cetera.
8
22
 
9
23
  h2. Installation
10
24
 
11
25
  bc. gem install water
12
26
 
13
- This will install a pre-release version of CodeRay (for syntax highlighting),
14
- and launchy (along with its dependencies) to cross-platform browser opening.
27
+ This will install a latest version of CodeRay,
28
+ and launchy (along with its dependencies) for cross-platform browser opening.
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "water"
6
- s.version = '0.6.0'
6
+ s.version = '0.7.0'
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Kornelius Kalnbach"]
9
9
  s.email = ["murphy@rubychan.de"]
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.summary = "diff viewer with code highlighting"
12
12
  s.description = "The diff washing machine. See your code changes clearly."
13
13
 
14
- s.add_dependency "coderay", '~> 1.0.0'
14
+ s.add_dependency "coderay", '~> 1.0.7'
15
15
  s.add_dependency "launchy", '~> 2.0.0'
16
16
 
17
17
  s.files = `git ls-files`.split("\n")
metadata CHANGED
@@ -1,38 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: water
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
5
- prerelease:
4
+ version: 0.7.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Kornelius Kalnbach
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2011-12-14 00:00:00.000000000Z
11
+ date: 2013-10-03 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: coderay
16
- requirement: &70345625837780 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
21
- version: 1.0.0
19
+ version: 1.0.7
22
20
  type: :runtime
23
21
  prerelease: false
24
- version_requirements: *70345625837780
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 1.0.7
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: launchy
27
- requirement: &70345625836900 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
31
  - - ~>
31
32
  - !ruby/object:Gem::Version
32
33
  version: 2.0.0
33
34
  type: :runtime
34
35
  prerelease: false
35
- version_requirements: *70345625836900
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: 2.0.0
36
41
  description: The diff washing machine. See your code changes clearly.
37
42
  email:
38
43
  - murphy@rubychan.de
@@ -46,32 +51,32 @@ files:
46
51
  - Gemfile
47
52
  - LICENSE.txt
48
53
  - Rakefile
54
+ - assets/water.css
49
55
  - bin/water
50
56
  - lib/water.rb
51
57
  - readme.textile
52
58
  - water.gemspec
53
59
  homepage: http://water.rubychan.de
54
60
  licenses: []
61
+ metadata: {}
55
62
  post_install_message:
56
63
  rdoc_options: []
57
64
  require_paths:
58
65
  - lib
59
66
  required_ruby_version: !ruby/object:Gem::Requirement
60
- none: false
61
67
  requirements:
62
68
  - - ! '>='
63
69
  - !ruby/object:Gem::Version
64
70
  version: '0'
65
71
  required_rubygems_version: !ruby/object:Gem::Requirement
66
- none: false
67
72
  requirements:
68
73
  - - ! '>='
69
74
  - !ruby/object:Gem::Version
70
75
  version: '0'
71
76
  requirements: []
72
77
  rubyforge_project:
73
- rubygems_version: 1.8.12
78
+ rubygems_version: 2.0.7
74
79
  signing_key:
75
- specification_version: 3
80
+ specification_version: 4
76
81
  summary: diff viewer with code highlighting
77
82
  test_files: []