pastehub 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 42857483fdc84f96368d04ba528141a859d6e16d
4
- data.tar.gz: 164089c90b685d3a6d4af4bd0c755581366f047b
3
+ metadata.gz: 300e17e0bff6735ae6db0a197c415affc8c0a6d3
4
+ data.tar.gz: 3ae5d75cd033afb65875970336c4853d1256682e
5
5
  SHA512:
6
- metadata.gz: 5a495f3dddc74bf8e4c5839735f665aa96695fa7a514a7a619309e99c054382d749646df12f56370fd38a810043afbc4c1eae267c5ffa9589de0871d7b41c7f9
7
- data.tar.gz: e3f3d0dd045c300eab8f0e8fbff536facaa47b07b940c0e50980f17278f5dfef96a095b018057a0058efa189b9fc9ad420c108ef2b44d60b143a9a9b531def24
6
+ metadata.gz: 8d6711785ce25257563c8b6839c5a17a8ab730e1968763ceedb3edc97f4e2d210b2dbfbe09313f565d801a0db2e7b63edb54e98cc3a40cb7e08a2db49bd03851
7
+ data.tar.gz: 159303dc2b151b59ef9308f59703803c8bac8e68c09b99b9b933b97c3ad1d8b43c96af63b123110d48fd706a3b84197d2df20871511461f3715b88ffdfb32f07
data/README.md CHANGED
@@ -16,8 +16,9 @@ MacOSX(gem) | OK | OK | OK |
16
16
  Windows(gem) | OK | not yet | not yet |
17
17
  Linux(gem) | not yet | OK | OK |
18
18
 
19
- ## Documents
19
+ ## How to install
20
20
 
21
+ + [Dropbox](./doc/client/dropbox.md)
21
22
  + [RubyGems](./doc/client/ruby_gems.md)
22
23
  + [Setup Emacs](./doc/client/setup_emacs.md)
23
24
  + [Setup Vim](./doc/client/setup_vim.md)
data/Rakefile CHANGED
@@ -32,7 +32,7 @@ begin
32
32
  'lib/*.rb',
33
33
  'lib/*/*.rb',
34
34
  ].to_a
35
- gemspec.add_dependency( "json", "1.8.1")
35
+ # gemspec.add_dependency( "json", "1.8.1")
36
36
  gemspec.add_dependency( "clipboard", "1.0.5" )
37
37
  gemspec.add_dependency( "ffi", "1.9.3")
38
38
  end
@@ -52,7 +52,7 @@ task :test do
52
52
  sh "/bin/rm -rf /tmp/home/user1"
53
53
  sh "ruby -I ./lib `which rspec` -b ./test/libclientsync_spec.rb "
54
54
  sh "ruby -I ./lib `which rspec` -b ./test/libsyncentry_spec.rb "
55
- # sh "ruby -I ./lib `which rspec` -b ./test/libutil_spec.rb "
55
+ sh "ruby -I ./lib `which rspec` -b ./test/libutil_spec.rb "
56
56
  end
57
57
 
58
58
  task :win32_test do
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 4
4
- :patch: 0
4
+ :patch: 1
@@ -98,7 +98,9 @@ def main( argv )
98
98
  nil
99
99
  end
100
100
  else
101
- lambda { |x| STDERR.puts '<< COUNTUP >>' }
101
+ lambda { |x|
102
+ # nothing to do.
103
+ }
102
104
  end
103
105
 
104
106
  clientSync.addNoitfyCallback( receiveNotifyFunc )
@@ -200,6 +200,7 @@ module PasteHub
200
200
 
201
201
  def sync_main()
202
202
  config = PasteHub::Config.instance
203
+ util = PasteHub::Util.new
203
204
 
204
205
  STDERR.puts "Info: sync_main thread start"
205
206
  free_counter = 0
@@ -211,7 +212,7 @@ module PasteHub
211
212
  if path
212
213
  body = get_sync_entry_body( path )
213
214
  if body
214
- STDERR.printf( "Info: push to OS's clipboard ([%s...] size=%d).\n", body[0...4], body.size )
215
+ STDERR.printf( "Info: push to OS's clipboard ([[%s]] size=%d).\n", util.stringLimit(body,config.notifyMessageMax), body.size )
215
216
  PasteHub::AbstractClipboard.push( body.dup )
216
217
  touch()
217
218
  else
@@ -227,6 +228,7 @@ module PasteHub
227
228
 
228
229
  def clipboard_check()
229
230
  config = PasteHub::Config.instance
231
+ util = PasteHub::Util.new
230
232
 
231
233
  STDERR.puts "Info: clipboardCheck thread start"
232
234
  @prevData = ""
@@ -237,7 +239,7 @@ module PasteHub
237
239
  if @prevData != data
238
240
  entry = Entry.new( @hostname )
239
241
  entry.save( data )
240
- STDERR.printf( "Info: clipboard to File ([%s...] size=%d).\n", data[0...4], data.size )
242
+ STDERR.printf( "Info: clipboard to File ([[%s]]] size=%d).\n", util.stringLimit(data,config.notifyMessageMax) , data.size )
241
243
  notifyToReceive( data )
242
244
  @prevData = data
243
245
  end
@@ -31,37 +31,6 @@ module PasteHub
31
31
  self.key_seconds( self.currentTime() )
32
32
  end
33
33
 
34
- def _splitKey( key )
35
- key.split( /[=]/ )
36
- end
37
-
38
- def key_seconds( key )
39
- arr = _splitKey( key )
40
- if 1 < arr.size
41
- arr[0].to_i
42
- else
43
- nil
44
- end
45
- end
46
-
47
- def key_timestamp( key )
48
- arr = _splitKey( key )
49
- if 1 < arr.size
50
- arr[1]
51
- else
52
- nil
53
- end
54
- end
55
-
56
- def key_digest( key )
57
- arr = _splitKey( key )
58
- if 2 < arr.size
59
- arr[2]
60
- else
61
- nil
62
- end
63
- end
64
-
65
34
  def diffList( list1, list2 )
66
35
  set1 = Set.new
67
36
  set2 = Set.new
@@ -92,62 +61,13 @@ module PasteHub
92
61
  end
93
62
  end
94
63
 
95
- def say( message )
96
- if USE_HIGHLINE
97
- HighLine.new.say( message ) {|q|
98
- q.readline = true
99
- }
100
- else
101
- puts "#{message}"
102
- end
103
- end
104
-
105
- def inputText( label )
106
- if USE_HIGHLINE
107
- HighLine.new.ask( label ) {|q|
108
- q.readline = true
109
- }
64
+ # Cut string with limit characters
65
+ def stringLimit( str, limit )
66
+ if limit < str.size()
67
+ str[0...(limit)] + "..."
110
68
  else
111
- print "#{label}"
112
- return gets.chomp
69
+ str
113
70
  end
114
71
  end
115
-
116
- def inputPassword( label )
117
- if USE_HIGHLINE
118
- HighLine.new.ask( label ) {|q|
119
- q.readline = true
120
- q.echo = '*'
121
- }
122
- else
123
- print "#{label}"
124
- return gets.chomp
125
- end
126
- end
127
-
128
- # input utility
129
- def inputPasswordTwice( message, firstLabel, secondLabel )
130
- required_password_chars = 6
131
-
132
- STDERR.puts( message )
133
- 3.times { |n|
134
- firstStr = nil
135
- while not firstStr
136
- firstStr = inputPassword(firstLabel)
137
- if required_password_chars > firstStr.size()
138
- STDERR.puts( "you must input #{required_password_chars} or more characters." )
139
- firstStr = nil
140
- elsif firstStr.match( /[ \t]/i )
141
- STDERR.puts( "you must not use white space characters." )
142
- firstStr = nil
143
- end
144
- end
145
- secondStr = inputPassword(secondLabel)
146
- if firstStr == secondStr
147
- return firstStr
148
- end
149
- }
150
- return nil
151
- end
152
72
  end
153
73
  end
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pastehub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kiyoka Nishiyama
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-06 00:00:00.000000000 Z
11
+ date: 2014-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: json
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - '='
18
- - !ruby/object:Gem::Version
19
- version: 1.8.1
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - '='
25
- - !ruby/object:Gem::Version
26
- version: 1.8.1
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: clipboard
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -94,20 +80,6 @@ dependencies:
94
80
  - - ">="
95
81
  - !ruby/object:Gem::Version
96
82
  version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: json
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - '='
102
- - !ruby/object:Gem::Version
103
- version: 1.8.1
104
- type: :runtime
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - '='
109
- - !ruby/object:Gem::Version
110
- version: 1.8.1
111
83
  - !ruby/object:Gem::Dependency
112
84
  name: clipboard
113
85
  requirement: !ruby/object:Gem::Requirement
@@ -136,20 +108,6 @@ dependencies:
136
108
  - - '='
137
109
  - !ruby/object:Gem::Version
138
110
  version: 1.9.3
139
- - !ruby/object:Gem::Dependency
140
- name: json
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - '='
144
- - !ruby/object:Gem::Version
145
- version: 1.8.1
146
- type: :runtime
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - '='
151
- - !ruby/object:Gem::Version
152
- version: 1.8.1
153
111
  - !ruby/object:Gem::Dependency
154
112
  name: clipboard
155
113
  requirement: !ruby/object:Gem::Requirement