snip 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,19 +0,0 @@
1
- = snip
2
-
3
- Description goes here.
4
-
5
- == Contributing to snip
6
-
7
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
8
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
9
- * Fork the project.
10
- * Start a feature/bugfix branch.
11
- * Commit and push until you are happy with your contribution.
12
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
-
15
- == Copyright
16
-
17
- Copyright (c) 2012 Boris Searles. See LICENSE.txt for
18
- further details.
19
-
data/bin/snip CHANGED
@@ -1,36 +1,122 @@
1
1
  #!/usr/bin/env ruby
2
-
2
+ # 1.9 adds realpath to resolve symlinks; 1.8 doesn't
3
+ # have this method, so we add it so we get resolved symlinks
4
+ # and compatibility
5
+ unless File.respond_to? :realpath
6
+ class File #:nodoc:
7
+ def self.realpath path
8
+ return realpath(File.readlink(path)) if symlink?(path)
9
+ path
10
+ end
11
+ end
12
+ end
13
+ $: << File.expand_path(File.dirname(File.realpath(__FILE__)) + '/../lib')
14
+ require 'rubygems'
15
+ require 'gli'
3
16
  require 'snip'
4
- require 'trollop'
5
-
6
- SUB_COMMANDS = %w(add edit list rm show run)
7
- global_opts = Trollop::options do
8
- version "snip 0.1.0 (c) 2012 Boris Searles"
9
- banner "command line snippet manager"
10
- stop_on SUB_COMMANDS
11
- end
12
-
13
- cmd = ARGV.shift # get the subcommand
14
- cmd_opts = case cmd
15
- when "add"
16
- Snip.add(ARGV[0])
17
- when "edit"
18
- Snip.edit(ARGV[0])
19
- when "list"
20
- Snip.list(ARGV[0])
21
- when "rm"
22
- Snip.rm(ARGV[0])
23
- when "show"
24
- Snip.show(ARGV[0])
25
- when "run"
26
- Snip.run(ARGV[0])
17
+ require 'snip_version'
18
+ require 'snip/commands'
19
+
20
+ include GLI
21
+ include Snip::Commands
22
+
23
+ program_desc 'A command line snippet manager'
24
+
25
+ version Snip::VERSION
26
+
27
+
28
+ pre do |global,command,options,args|
29
+ if Snip::initialized?
30
+ true
27
31
  else
28
- Trollop::die "unknown subcommand #{cmd.inspect}"
32
+ puts "This seems to be the first time snip is run on this computer."
33
+ puts "Should #{Snip::INSTALL_DIR} be created? (Yn)"
34
+ check = $stdin.gets.chomp
35
+ if check == 'Y'
36
+ Snip::init
37
+ true
38
+ else
39
+ puts "aborting..."
40
+ false
41
+ end
42
+ end
43
+ end
44
+
45
+
46
+ on_error do |exception|
47
+ # Error logic here
48
+ # return false to skip default error handling
49
+ true
50
+ end
51
+
52
+
53
+ desc 'List snippets'
54
+ long_desc <<EOS
55
+ List all existing snippets. Optional regex argument can be used to filter list.
56
+ EOS
57
+ arg_name 'regex'
58
+ command :list do |c|
59
+ c.action do |global_options,options,arguments|
60
+ list_snippets(arguments, options)
61
+ end
62
+ end
63
+
64
+
65
+ desc 'Show snippet'
66
+ long_desc <<EOS
67
+ Display the specified snippet.
68
+ EOS
69
+ arg_name 'snippet_name'
70
+ command :show do |c|
71
+ c.action do |global_options,options,arguments|
72
+ show_snippet(arguments, options)
29
73
  end
74
+ end
30
75
 
31
- #puts "Global options: #{global_opts.inspect}"
32
- #puts "Subcommand: #{cmd.inspect}"
33
- #puts "Subcommand options: #{cmd_opts.inspect}"
34
- #puts "Remaining arguments: #{ARGV.inspect}"
35
76
 
77
+ desc 'Edit snippet'
78
+ long_desc <<EOS
79
+ Edit the specified snippet.
80
+ EOS
81
+ arg_name 'snippet_name'
82
+ command :edit do |c|
83
+ c.action do |global_options,options,arguments|
84
+ edit_snippet(arguments, options)
85
+ end
86
+ end
87
+
88
+
89
+ desc 'Run snippet'
90
+ long_desc <<EOS
91
+ Execute the specified snippet.
92
+ EOS
93
+ arg_name 'snippet_name'
94
+ command :run do |c|
95
+ c.action do |global_options,options,arguments|
96
+ run_snippet(arguments, options)
97
+ end
98
+ end
99
+
100
+
101
+ desc 'Remove snippet'
102
+ arg_name 'snippet_name'
103
+ command [:remove, :rm] do |c|
104
+ c.action do |global_options,options,arguments|
105
+ remove_snippet(arguments, options)
106
+ end
107
+ end
108
+
109
+
110
+ desc 'Add a new snippet'
111
+ long_desc <<EOS
112
+ The first argument is required and is the name of the new snippet. The second argument is the actual snippet itself, should be a string. If the second argument is not supplied then the configured editor ($EDITOR) will be opened and will be saved when saved in editor.
113
+ Example: snip add dirsize "du -ch | grep total"
114
+ EOS
115
+ arg_name 'snippet_name'
116
+ command :add do |c|
117
+ c.action do |global_options,options,arguments|
118
+ add_snippet(arguments, options)
119
+ end
120
+ end
36
121
 
122
+ exit GLI.run(ARGV)
@@ -1,78 +1,26 @@
1
- class Snip
1
+ require 'rainbow'
2
2
 
3
- def self.init
4
- root_dir = File.expand_path('~')
5
- unless File.exists?("#{root_dir}/.snips")
6
- puts "...initializing ~/.snips directory"
7
- `mkdir $HOME/.snips`
8
- end
9
- end
10
-
11
-
12
- def self.add(snippet)
13
- Snip.init
14
- `vim "$HOME/.snips/#{snippet}" 3>&1 1>&2 2>&3`
15
- puts "...added new snippet: #{snippet}"
16
- end
17
-
18
-
19
- def self.edit(snippet)
20
- Snip.init
21
- root_dir = File.expand_path('~')
22
- target_file = "#{root_dir}/.snips/#{snippet}"
23
- if File.exists?(target_file)
24
- `vim "#{target_file}" 3>&1 1>&2 2>&3`
25
- else
26
- puts "Snippet #{snippet} could not be found"
27
- end
28
- end
3
+ module Snip
29
4
 
5
+ DEFAULT_DIR = '~/.snip'
6
+ INSTALL_DIR = File.expand_path(Snip::DEFAULT_DIR)
30
7
 
31
- def self.list(query)
32
- Snip.init
33
- root_dir = File.expand_path('~')
34
- Dir.foreach("#{root_dir}/.snips") do |file|
35
- unless File.directory?(file)
36
- puts file
37
- end
38
- end
39
- end
8
+ class NotInitializedError < StandardError ; end
9
+ class DuplicateSnippetNameError < StandardError ; end
10
+ class SnippetNotFoundError < StandardError ; end
11
+ class ExecuteSnippetError < StandardError ; end
40
12
 
41
-
42
- def self.rm(snippet)
43
- Snip.init
44
- root_dir = File.expand_path('~')
45
- target_file = "#{root_dir}/.snips/#{snippet}"
46
- if File.exists?(target_file)
47
- `rm #{target_file}`
48
- puts "Snippet #{snippet} was deleted"
49
- else
50
- puts "Snippet #{snippet} could not be found"
51
- end
13
+ def self.initialized?
14
+ File.directory?(Snip::INSTALL_DIR)
52
15
  end
53
16
 
54
-
55
- def self.show(snippet)
56
- Snip.init
57
- root_dir = File.expand_path('~')
58
- target_file = "#{root_dir}/.snips/#{snippet}"
59
- if File.exists?(target_file)
60
- puts `cat #{target_file}`
61
- else
62
- puts "Snippet #{snippet} could not be found"
17
+ def self.init
18
+ unless Snip::initialized?
19
+ FileUtils.mkdir(Snip::INSTALL_DIR)
63
20
  end
64
21
  end
65
22
 
66
-
67
- def self.run(snippet)
68
- Snip.init
69
- root_dir = File.expand_path('~')
70
- target_file = "#{root_dir}/.snips/#{snippet}"
71
- if File.exists?(target_file)
72
- puts `cat #{target_file}`
73
- puts `cat #{target_file} | sh`
74
- else
75
- puts "Snippet #{snippet} could not be found"
76
- end
23
+ def self.snippet_exists?(name)
24
+ File.exists?(File.join(Snip::INSTALL_DIR, name))
77
25
  end
78
26
  end
@@ -0,0 +1,34 @@
1
+ require 'snip'
2
+ require 'snip/util/editor'
3
+
4
+ module Snip
5
+ module Command
6
+ class Add
7
+ include Snip
8
+
9
+ def initialize(args, options={})
10
+ @args = Array(args)
11
+ @options = options
12
+ end
13
+
14
+ def execute
15
+ name, content = @args
16
+ raise NotInitializedError unless Snip::initialized?
17
+ raise DuplicateSnippetNameError if Snip::snippet_exists?(name)
18
+
19
+ file_path = File.join(Snip::INSTALL_DIR, name)
20
+ if content.nil?
21
+ if Snip::Util::Editor::open(file_path)
22
+ if File.exists?(file_path)
23
+ puts "Snippet created successfully"
24
+ end
25
+ end
26
+ else
27
+ File.open(file_path, 'w') do |f|
28
+ f.puts content
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,26 @@
1
+ require 'snip'
2
+ require 'snip/util/editor'
3
+
4
+ module Snip
5
+ module Command
6
+ class Edit
7
+ include Snip
8
+
9
+ def initialize(args, options={})
10
+ @args = Array(args)
11
+ @options = options
12
+ end
13
+
14
+ def execute
15
+ name = @args
16
+ raise NotInitializedError unless Snip::initialized?
17
+ raise SnippetNotFoundError unless Snip::snippet_exists?(name)
18
+
19
+ file_path = File.join(Snip::INSTALL_DIR, name)
20
+ if Snip::Util::Editor::open(file_path)
21
+ puts "Snippet updated successfully"
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ require 'snip'
2
+
3
+ module Snip
4
+ module Command
5
+ class List
6
+ def initialize(args=[], options={})
7
+ @args = Array(args)
8
+ @options = options
9
+ end
10
+
11
+ def execute
12
+ raise NotInitializedError unless Snip::initialized?
13
+
14
+ Dir.foreach(Snip::INSTALL_DIR) do |file|
15
+ next if file == '.' or file == '..'
16
+ next unless @args.empty? || file.match(@args.first)
17
+
18
+ first_line = ""
19
+ File.open(File.join(Snip::INSTALL_DIR, file)) {|f| first_line = f.readline}
20
+
21
+ printf("%-35s # %s", file.color(:blue), first_line);
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,20 @@
1
+ require 'snip'
2
+
3
+ module Snip
4
+ module Command
5
+ class Remove
6
+ def initialize(args, options={})
7
+ @args = Array(args)
8
+ @options = options
9
+ end
10
+
11
+ def execute
12
+ name = @args
13
+ raise NotInitializedError unless Snip::initialized?
14
+ raise SnippetNotFoundError unless Snip::snippet_exists?(name)
15
+
16
+ FileUtils.rm(File.join(Snip::INSTALL_DIR, name)) if Snip::snippet_exists?(name)
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,27 @@
1
+ require 'snip'
2
+
3
+ module Snip
4
+ module Command
5
+ class Run
6
+ def initialize(args, options={})
7
+ @args = Array(args)
8
+ @options = options
9
+ end
10
+
11
+ def execute
12
+ name = @args
13
+ raise NotInitializedError unless Snip::initialized?
14
+ raise SnippetNotFoundError unless Snip::snippet_exists?(name)
15
+
16
+ snippet = File.read(File.join(Snip::INSTALL_DIR, name))
17
+
18
+ begin
19
+ puts snippet.color(:magenta)
20
+ puts `#{snippet}`
21
+ rescue
22
+ raise ExecuteSnippetError
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,20 @@
1
+ require 'snip'
2
+
3
+ module Snip
4
+ module Command
5
+ class Show
6
+ def initialize(args, options={})
7
+ @args = Array(args)
8
+ @options = options
9
+ end
10
+
11
+ def execute
12
+ name = @args
13
+ raise NotInitializedError unless Snip::initialized?
14
+ raise SnippetNotFoundError unless Snip::snippet_exists?(name)
15
+
16
+ puts File.read(File.join(Snip::INSTALL_DIR, name)).color(:magenta)
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,34 @@
1
+ require 'snip/command/list'
2
+ require 'snip/command/show'
3
+ require 'snip/command/add'
4
+ require 'snip/command/edit'
5
+ require 'snip/command/run'
6
+ require 'snip/command/remove'
7
+
8
+ module Snip
9
+ module Commands
10
+ def list_snippets(args=[], options={})
11
+ Snip::Command::List.new(args, options).execute
12
+ end
13
+
14
+ def show_snippet(args, options={})
15
+ Snip::Command::Show.new(args, options).execute
16
+ end
17
+
18
+ def add_snippet(args, options={})
19
+ Snip::Command::Add.new(args, options).execute
20
+ end
21
+
22
+ def edit_snippet(args, options={})
23
+ Snip::Command::Edit.new(args, options).execute
24
+ end
25
+
26
+ def run_snippet(args, options={})
27
+ Snip::Command::Run.new(args, options).execute
28
+ end
29
+
30
+ def remove_snippet(args, options={})
31
+ Snip::Command::Remove.new(args, options).execute
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,23 @@
1
+
2
+ module Snip
3
+ module Util
4
+ class Editor
5
+ def self.open(file_path)
6
+ unless ENV.has_key?('EDITOR')
7
+ puts "No editor configured. The $EDITOR shell variable is empty."
8
+ puts "Example: Add 'echo EDITOR=vim' to your .bashrc or .zshrc if you would like to use VIM as your editor."
9
+ return
10
+ end
11
+
12
+ # open configured editor and redirect outputs
13
+ `#{ENV['EDITOR']} "#{file_path}" 3>&1 1>&2 2>&3`
14
+
15
+ unless $?.success?
16
+ puts "Error occured: " + $?.to_s
17
+ end
18
+
19
+ $?
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,3 @@
1
+ module Snip
2
+ VERSION = '0.2.0'
3
+ end
@@ -0,0 +1,5 @@
1
+ = snip
2
+
3
+ Generate this with
4
+ snip rdoc
5
+ After you have described your command line interface
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snip
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,22 +9,33 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-04 00:00:00.000000000Z
12
+ date: 2012-04-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: trollop
16
- requirement: &24388840 !ruby/object:Gem::Requirement
15
+ name: gli
16
+ requirement: &70316298687900 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: '1.16'
21
+ version: '1.4'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *24388840
24
+ version_requirements: *70316298687900
25
25
  - !ruby/object:Gem::Dependency
26
- name: shoulda
27
- requirement: &24388280 !ruby/object:Gem::Requirement
26
+ name: rainbow
27
+ requirement: &70316298686860 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: 1.1.3
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70316298686860
36
+ - !ruby/object:Gem::Dependency
37
+ name: rake
38
+ requirement: &70316298686080 !ruby/object:Gem::Requirement
28
39
  none: false
29
40
  requirements:
30
41
  - - ! '>='
@@ -32,76 +43,80 @@ dependencies:
32
43
  version: '0'
33
44
  type: :development
34
45
  prerelease: false
35
- version_requirements: *24388280
46
+ version_requirements: *70316298686080
36
47
  - !ruby/object:Gem::Dependency
37
48
  name: rdoc
38
- requirement: &24387800 !ruby/object:Gem::Requirement
49
+ requirement: &70316298684820 !ruby/object:Gem::Requirement
39
50
  none: false
40
51
  requirements:
41
- - - ~>
52
+ - - ! '>='
42
53
  - !ruby/object:Gem::Version
43
- version: '3.12'
54
+ version: '0'
44
55
  type: :development
45
56
  prerelease: false
46
- version_requirements: *24387800
57
+ version_requirements: *70316298684820
47
58
  - !ruby/object:Gem::Dependency
48
- name: bundler
49
- requirement: &24387020 !ruby/object:Gem::Requirement
59
+ name: minitest-reporters
60
+ requirement: &70316298683980 !ruby/object:Gem::Requirement
50
61
  none: false
51
62
  requirements:
52
- - - ~>
63
+ - - ! '>='
53
64
  - !ruby/object:Gem::Version
54
- version: 1.0.0
65
+ version: '0'
55
66
  type: :development
56
67
  prerelease: false
57
- version_requirements: *24387020
68
+ version_requirements: *70316298683980
58
69
  - !ruby/object:Gem::Dependency
59
- name: jeweler
60
- requirement: &24386480 !ruby/object:Gem::Requirement
70
+ name: fakefs
71
+ requirement: &70316298683440 !ruby/object:Gem::Requirement
61
72
  none: false
62
73
  requirements:
63
- - - ~>
74
+ - - ! '>='
64
75
  - !ruby/object:Gem::Version
65
- version: 1.8.3
76
+ version: '0'
66
77
  type: :development
67
78
  prerelease: false
68
- version_requirements: *24386480
69
- description: command line snippet manager
79
+ version_requirements: *70316298683440
80
+ description:
70
81
  email: boris@lucidgardens.com
71
82
  executables:
72
83
  - snip
73
84
  extensions: []
74
85
  extra_rdoc_files:
75
- - LICENSE.txt
76
86
  - README.rdoc
87
+ - snip.rdoc
77
88
  files:
78
- - .document
79
- - Gemfile
80
- - Gemfile.lock
81
- - LICENSE.txt
82
- - README.rdoc
83
- - Rakefile
84
- - VERSION
85
89
  - bin/snip
86
90
  - lib/snip.rb
87
- - test/helper.rb
88
- - test/test_snip.rb
91
+ - lib/snip_version.rb
92
+ - lib/snip/commands.rb
93
+ - lib/snip/command/list.rb
94
+ - lib/snip/command/show.rb
95
+ - lib/snip/command/add.rb
96
+ - lib/snip/command/edit.rb
97
+ - lib/snip/command/run.rb
98
+ - lib/snip/command/remove.rb
99
+ - lib/snip/util/editor.rb
100
+ - README.rdoc
101
+ - snip.rdoc
89
102
  homepage: http://github.com/bozz/snip
90
- licenses:
91
- - MIT
103
+ licenses: []
92
104
  post_install_message:
93
- rdoc_options: []
105
+ rdoc_options:
106
+ - --title
107
+ - snip
108
+ - --main
109
+ - README.rdoc
110
+ - -ri
94
111
  require_paths:
95
112
  - lib
113
+ - lib
96
114
  required_ruby_version: !ruby/object:Gem::Requirement
97
115
  none: false
98
116
  requirements:
99
117
  - - ! '>='
100
118
  - !ruby/object:Gem::Version
101
119
  version: '0'
102
- segments:
103
- - 0
104
- hash: -2118759123288687265
105
120
  required_rubygems_version: !ruby/object:Gem::Requirement
106
121
  none: false
107
122
  requirements:
@@ -113,5 +128,5 @@ rubyforge_project:
113
128
  rubygems_version: 1.8.10
114
129
  signing_key:
115
130
  specification_version: 3
116
- summary: command line snippet manager
131
+ summary: A Command Line Snippet Manager
117
132
  test_files: []
data/.document DELETED
@@ -1,5 +0,0 @@
1
- lib/**/*.rb
2
- bin/*
3
- -
4
- features/**/*.feature
5
- LICENSE.txt
data/Gemfile DELETED
@@ -1,14 +0,0 @@
1
- source "http://rubygems.org"
2
- # Add dependencies required to use your gem here.
3
- # Example:
4
- # gem "activesupport", ">= 2.3.5"
5
- gem "trollop", "~> 1.16"
6
-
7
- # Add dependencies to develop your gem here.
8
- # Include everything needed to run rake, tests, features, etc.
9
- group :development do
10
- gem "shoulda", ">= 0"
11
- gem "rdoc", "~> 3.12"
12
- gem "bundler", "~> 1.0.0"
13
- gem "jeweler", "~> 1.8.3"
14
- end
@@ -1,25 +0,0 @@
1
- GEM
2
- remote: http://rubygems.org/
3
- specs:
4
- git (1.2.5)
5
- jeweler (1.8.3)
6
- bundler (~> 1.0)
7
- git (>= 1.2.5)
8
- rake
9
- rdoc
10
- json (1.6.5)
11
- rake (0.9.2.2)
12
- rdoc (3.12)
13
- json (~> 1.4)
14
- shoulda (2.11.3)
15
- trollop (1.16.2)
16
-
17
- PLATFORMS
18
- ruby
19
-
20
- DEPENDENCIES
21
- bundler (~> 1.0.0)
22
- jeweler (~> 1.8.3)
23
- rdoc (~> 3.12)
24
- shoulda
25
- trollop (~> 1.16)
@@ -1,20 +0,0 @@
1
- Copyright (c) 2012 Boris Searles
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile DELETED
@@ -1,46 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'rubygems'
4
- require 'bundler'
5
- begin
6
- Bundler.setup(:default, :development)
7
- rescue Bundler::BundlerError => e
8
- $stderr.puts e.message
9
- $stderr.puts "Run `bundle install` to install missing gems"
10
- exit e.status_code
11
- end
12
- require 'rake'
13
-
14
- require 'jeweler'
15
- Jeweler::Tasks.new do |gem|
16
- # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
- gem.name = "snip"
18
- gem.homepage = "http://github.com/bozz/snip"
19
- gem.license = "MIT"
20
- gem.summary = %Q{command line snippet manager}
21
- gem.description = %Q{command line snippet manager}
22
- gem.email = "boris@lucidgardens.com"
23
- gem.authors = ["Boris Searles"]
24
- gem.executable = "snip"
25
- # dependencies defined in Gemfile
26
- end
27
- Jeweler::RubygemsDotOrgTasks.new
28
-
29
- require 'rake/testtask'
30
- Rake::TestTask.new(:test) do |test|
31
- test.libs << 'lib' << 'test'
32
- test.pattern = 'test/**/test_*.rb'
33
- test.verbose = true
34
- end
35
-
36
- task :default => :test
37
-
38
- require 'rdoc/task'
39
- Rake::RDocTask.new do |rdoc|
40
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
41
-
42
- rdoc.rdoc_dir = 'rdoc'
43
- rdoc.title = "snip #{version}"
44
- rdoc.rdoc_files.include('README*')
45
- rdoc.rdoc_files.include('lib/**/*.rb')
46
- end
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.1.0
@@ -1,18 +0,0 @@
1
- require 'rubygems'
2
- require 'bundler'
3
- begin
4
- Bundler.setup(:default, :development)
5
- rescue Bundler::BundlerError => e
6
- $stderr.puts e.message
7
- $stderr.puts "Run `bundle install` to install missing gems"
8
- exit e.status_code
9
- end
10
- require 'test/unit'
11
- require 'shoulda'
12
-
13
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
- $LOAD_PATH.unshift(File.dirname(__FILE__))
15
- require 'snip'
16
-
17
- class Test::Unit::TestCase
18
- end
@@ -1,7 +0,0 @@
1
- require 'helper'
2
-
3
- class TestSnip < Test::Unit::TestCase
4
- should "probably rename this file and start testing for real" do
5
- flunk "hey buddy, you should probably rename this file and start testing for real"
6
- end
7
- end