sheet 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.8.7
4
+ - 1.9.3
data/README.md CHANGED
@@ -3,6 +3,8 @@
3
3
  Easily create and access snippets of text from your terminal. `sheet` is
4
4
  your own personal wiki.
5
5
 
6
+ ![Build status](https://secure.travis-ci.org/oscardelben/sheet.png)
7
+
6
8
  ```bash
7
9
 
8
10
  gem install sheet
@@ -45,7 +47,8 @@ url: http://example.com
45
47
  ```
46
48
 
47
49
  Please note that to open urls, sheet will use the `open` command on mac
48
- os x and `xdg-open` in linux. Patches welcome for other systems.
50
+ os x and `xdg-open` in linux and `cygstart` in cygwin. Patches welcome
51
+ for other systems.
49
52
 
50
53
  ### Copying sheets
51
54
 
@@ -63,12 +66,6 @@ multiple systems.
63
66
  For writing files, `sheet` looks for the `$EDITOR` global variable, and
64
67
  will raise an error if no editor was found.
65
68
 
66
- ### Help your stuff is broken
67
-
68
- I tested this software in mac os x with Ruby 1.9. If you find any bug
69
- with other platforms/interpreters please let me know and I'll push a
70
- fix.
71
-
72
69
  ### Contributing to sheet
73
70
 
74
71
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
data/lib/sheet.rb CHANGED
@@ -12,7 +12,7 @@ class Sheet
12
12
 
13
13
  class << self
14
14
  # Utility to write to standard output
15
- def write(message)
15
+ def display(message)
16
16
  puts message
17
17
  end
18
18
 
@@ -65,6 +65,8 @@ class Sheet
65
65
  'open'
66
66
  elsif RUBY_PLATFORM =~ /linux/ && command_available?('xdg-open')
67
67
  'xdg-open'
68
+ elsif RUBY_PLATFORM =~ /cygwin/
69
+ 'cygstart'
68
70
  else
69
71
  nil
70
72
  end
@@ -111,7 +113,6 @@ class Sheet
111
113
  end
112
114
 
113
115
  private
114
-
115
116
  def open(name)
116
117
  Sheet::Open.new(name).open
117
118
  end
data/lib/sheet/copy.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  class Sheet
2
2
  class Copy
3
-
4
3
  attr_accessor :name
5
4
 
6
5
  def initialize(name)
@@ -11,17 +10,16 @@ class Sheet
11
10
  if name
12
11
  check_if_sheet_exists_and_copy_sheet
13
12
  else
14
- Sheet.write("Please specify a sheet name!")
13
+ Sheet.display("Please specify a sheet name!")
15
14
  end
16
15
  end
17
16
 
18
17
  private
19
-
20
18
  def check_if_sheet_exists_and_copy_sheet
21
19
  if Sheet.sheet_exists?(name)
22
20
  copy_sheet
23
21
  else
24
- Sheet.write("A sheet named #{name} could not be found")
22
+ Sheet.display("A sheet named #{name} could not be found")
25
23
  end
26
24
  end
27
25
 
@@ -30,7 +28,7 @@ class Sheet
30
28
  if copy_cmd
31
29
  Sheet.exec("cat #{Sheet::sheet_path(name)} | #{copy_cmd}", true)
32
30
  else
33
- Sheet.write("Could not copy sheet, no copy command found")
31
+ Sheet.display("Could not copy sheet, no copy command found")
34
32
  end
35
33
  end
36
34
 
data/lib/sheet/list.rb CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  class Sheet
3
2
  class List
4
3
 
@@ -6,8 +5,9 @@ class Sheet
6
5
  if Sheet.sheets_directory_exists?
7
6
  Sheet.exec("ls -1 #{Sheet.sheets_dir}", true)
8
7
  else
9
- Sheet.write("No sheet found. Create a new sheet with `sheet new <name>`")
8
+ Sheet.display("No sheet found. Create a new sheet with `sheet new <name>`")
10
9
  end
11
10
  end
11
+
12
12
  end
13
13
  end
data/lib/sheet/open.rb CHANGED
@@ -1,7 +1,5 @@
1
1
  class Sheet
2
-
3
2
  class Open
4
-
5
3
  attr_accessor :name
6
4
 
7
5
  def initialize(name)
@@ -12,19 +10,18 @@ class Sheet
12
10
  if Sheet.sheet_exists?(name)
13
11
  process_sheet_content
14
12
  else
15
- Sheet.write "A cheat named #{name} doesn't exist.\nYou can create one with sheet new #{name}"
13
+ Sheet.display "A cheat named #{name} doesn't exist.\nYou can create one with sheet new #{name}"
16
14
  end
17
15
  end
18
16
 
19
17
  private
20
-
21
18
  def process_sheet_content
22
19
  if !sheet_urls.empty? && cmd = Sheet.open_command
23
20
  sheet_urls.each do |url|
24
21
  Sheet.exec "#{cmd} #{url.chomp.sub(/url: /,'')}"
25
22
  end
26
23
  else
27
- Sheet.write sheet_content
24
+ Sheet.display sheet_content
28
25
  end
29
26
  end
30
27
 
data/lib/sheet/write.rb CHANGED
@@ -1,31 +1,31 @@
1
+ class Sheet
2
+ class Write
3
+ attr_accessor :name
1
4
 
2
- class Sheet::Write
3
-
4
- attr_accessor :name
5
-
6
- def initialize(name=nil)
7
- @name = name
8
- end
9
-
10
- def write
11
- return Sheet.write("Please specify a name") unless name
12
- create_dir_if_doesnt_exist
13
- if editor_is_set?
14
- Sheet.exec("#{Sheet.editor} #{Sheet.sheet_path(name)}", true)
15
- else
16
- Sheet.write "Please set the $EDITOR variable to write files"
5
+ def initialize(name=nil)
6
+ @name = name
17
7
  end
18
- end
19
8
 
20
- private
9
+ def write
10
+ return Sheet.display("Please specify a name") unless name
11
+ create_dir_if_doesnt_exist
12
+ if editor_is_set?
13
+ Sheet.exec("#{Sheet.editor} #{Sheet.sheet_path(name)}", true)
14
+ else
15
+ Sheet.display "Please set the $EDITOR variable to write files"
16
+ end
17
+ end
21
18
 
22
- def editor_is_set?
23
- (editor = Sheet.editor) && editor.length > 0
24
- end
19
+ private
20
+ def editor_is_set?
21
+ (editor = Sheet.editor) && editor.length > 0
22
+ end
25
23
 
26
- def create_dir_if_doesnt_exist
27
- if ! Sheet.sheets_directory_exists?
28
- Dir.mkdir(Sheet.sheets_dir)
24
+ def create_dir_if_doesnt_exist
25
+ if ! Sheet.sheets_directory_exists?
26
+ Dir.mkdir(Sheet.sheets_dir)
27
+ end
29
28
  end
29
+
30
30
  end
31
31
  end
data/sheet.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "sheet"
8
- s.version = "0.2.0"
8
+ s.version = "0.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Oscar Del Ben"]
12
- s.date = "2012-05-01"
12
+ s.date = "2012-08-07"
13
13
  s.description = "sheets allows you to store and browse snippets of text from your command line."
14
14
  s.email = "info@oscardelben.com"
15
15
  s.executables = ["sheet"]
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.files = [
21
21
  ".document",
22
22
  ".rspec",
23
+ ".travis.yml",
23
24
  "Gemfile",
24
25
  "Gemfile.lock",
25
26
  "LICENSE.txt",
@@ -43,7 +44,7 @@ Gem::Specification.new do |s|
43
44
  s.homepage = "http://github.com/oscardelben/sheet"
44
45
  s.licenses = ["MIT"]
45
46
  s.require_paths = ["lib"]
46
- s.rubygems_version = "1.8.21"
47
+ s.rubygems_version = "1.8.23"
47
48
  s.summary = "snippets for your command line"
48
49
 
49
50
  if s.respond_to? :specification_version then
@@ -13,20 +13,20 @@ describe Sheet::Copy do
13
13
  end
14
14
 
15
15
  it 'should show an error if name is nil' do
16
- Sheet.should_receive(:write).with("Please specify a sheet name!")
16
+ Sheet.should_receive(:display).with("Please specify a sheet name!")
17
17
 
18
18
  Sheet::Copy.new(nil).copy
19
19
  end
20
20
 
21
21
  it 'should show an error if snippet is not found' do
22
- Sheet.should_receive(:write).with("A sheet named git could not be found")
22
+ Sheet.should_receive(:display).with("A sheet named git could not be found")
23
23
  Sheet.stub(:sheet_exists?).with('git') { false }
24
24
 
25
25
  Sheet::Copy.new('git').copy
26
26
  end
27
27
 
28
28
  it 'should show a message if no copy program was found' do
29
- Sheet.should_receive(:write).with("Could not copy sheet, no copy command found")
29
+ Sheet.should_receive(:display).with("Could not copy sheet, no copy command found")
30
30
 
31
31
  Sheet.stub(:copy_command) { nil }
32
32
  Sheet.stub(:sheet_exists?).with('git') { true }
@@ -1,4 +1,3 @@
1
-
2
1
  require 'spec_helper'
3
2
 
4
3
  describe Sheet::List do
@@ -22,7 +21,7 @@ describe Sheet::List do
22
21
  end
23
22
 
24
23
  it 'shows a message' do
25
- Sheet.should_receive(:write).with("No sheet found. Create a new sheet with `sheet new <name>`")
24
+ Sheet.should_receive(:display).with("No sheet found. Create a new sheet with `sheet new <name>`")
26
25
 
27
26
  Sheet::List.new.list
28
27
  end
@@ -4,14 +4,14 @@ describe Sheet::Open do
4
4
 
5
5
  it "should show a message when the app doesn't exist" do
6
6
  message = "A cheat named rails doesn't exist.\nYou can create one with sheet new rails"
7
- Sheet.should_receive(:write).with(message)
7
+ Sheet.should_receive(:display).with(message)
8
8
 
9
9
  Sheet::Open.new('rails').open
10
10
  end
11
11
 
12
12
  it "should output the sheet content" do
13
13
  message = "My sheet about git"
14
- Sheet.should_receive(:write).with(message)
14
+ Sheet.should_receive(:display).with(message)
15
15
 
16
16
  s = Sheet::Open.new('git')
17
17
  Sheet.stub(:sheet_exists?).with('git') { true }
@@ -9,7 +9,7 @@ describe Sheet::Write do
9
9
  end
10
10
 
11
11
  it 'shows an error message if no argument is passed' do
12
- Sheet.should_receive(:write).with('Please specify a name')
12
+ Sheet.should_receive(:display).with('Please specify a name')
13
13
  Sheet::Write.new.write
14
14
  end
15
15
 
@@ -24,7 +24,7 @@ describe Sheet::Write do
24
24
 
25
25
  it 'returns an error if no editor is found' do
26
26
  Sheet.stub(:editor) { nil }
27
- Sheet.should_receive(:write).with { "Please set the $EDITOR variable to write files" }
27
+ Sheet.should_receive(:display).with { "Please set the $EDITOR variable to write files" }
28
28
 
29
29
  Sheet::Write.new('tmux').write
30
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sheet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-01 00:00:00.000000000 Z
12
+ date: 2012-08-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -87,6 +87,7 @@ extra_rdoc_files:
87
87
  files:
88
88
  - .document
89
89
  - .rspec
90
+ - .travis.yml
90
91
  - Gemfile
91
92
  - Gemfile.lock
92
93
  - LICENSE.txt
@@ -121,7 +122,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
121
122
  version: '0'
122
123
  segments:
123
124
  - 0
124
- hash: 2528826102062921257
125
+ hash: -3960005247131765997
125
126
  required_rubygems_version: !ruby/object:Gem::Requirement
126
127
  none: false
127
128
  requirements:
@@ -130,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
131
  version: '0'
131
132
  requirements: []
132
133
  rubyforge_project:
133
- rubygems_version: 1.8.21
134
+ rubygems_version: 1.8.23
134
135
  signing_key:
135
136
  specification_version: 3
136
137
  summary: snippets for your command line