accio 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ /pkg
2
+ /coverage
data/CHANGELOG ADDED
@@ -0,0 +1,12 @@
1
+ 0.0.2
2
+
3
+ * Fixed bug when laoding config file
4
+ * Fixed bug when loading snippet file
5
+ * Fixed failing specs
6
+ * Code improvements
7
+
8
+ 0.0.1
9
+
10
+ * Case insensitive search
11
+ * Showing of snippets
12
+ * Copying of snippets
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in snip.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,40 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ accio (0.0.2)
5
+ clipboard
6
+ term-ansicolor
7
+ terminal-table
8
+ thor
9
+
10
+ GEM
11
+ remote: https://rubygems.org/
12
+ specs:
13
+ clipboard (1.0.1)
14
+ diff-lcs (1.1.3)
15
+ multi_json (1.5.0)
16
+ rake (10.0.3)
17
+ rspec (2.12.0)
18
+ rspec-core (~> 2.12.0)
19
+ rspec-expectations (~> 2.12.0)
20
+ rspec-mocks (~> 2.12.0)
21
+ rspec-core (2.12.2)
22
+ rspec-expectations (2.12.1)
23
+ diff-lcs (~> 1.1.3)
24
+ rspec-mocks (2.12.2)
25
+ simplecov (0.7.1)
26
+ multi_json (~> 1.0)
27
+ simplecov-html (~> 0.7.1)
28
+ simplecov-html (0.7.1)
29
+ term-ansicolor (1.0.7)
30
+ terminal-table (1.4.5)
31
+ thor (0.17.0)
32
+
33
+ PLATFORMS
34
+ ruby
35
+
36
+ DEPENDENCIES
37
+ accio!
38
+ rake
39
+ rspec
40
+ simplecov
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Dennis Schneider
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # Accio - A command line code snippet manager
2
+
3
+ With **Accio** it's possible to categorize and organize snippets in a
4
+ markdown file. The snippets can then be searched and used via the terminal.
5
+
6
+ ## Installation
7
+
8
+ ```
9
+ gem install accio
10
+ ```
11
+
12
+ ## Usage
13
+
14
+ Create a **snippets.md** file in a folder and configure accio with the following
15
+ command (you must point to the folder relative to your home directory):
16
+
17
+ ```
18
+ # Or wherever you wish to have the snippets.md file
19
+ accio configure "Dropbox/Accio"
20
+ ```
21
+
22
+ Show all snippet groups:
23
+
24
+ ```
25
+ $ accio groups
26
+ Ruby
27
+ Erlang
28
+ Clojure
29
+ Haskell
30
+ Amazon Web Services
31
+ ...
32
+ ```
33
+
34
+ Show commands for a specific group or snippet:
35
+
36
+ ```
37
+ $ accio show Ruby [Files]
38
+ Ruby
39
+ Read Files
40
+ CODE_SNIPPET
41
+ ...
42
+ ```
43
+
44
+ Copy a snippet to clipboard:
45
+
46
+ ```
47
+ $ accio copy Ruby [Files]
48
+ Ruby
49
+ Read Files
50
+ CODE_SNIPPET
51
+ ...
52
+ ```
53
+
54
+ There are shortcuts like `accio c Ruby ...` and `accio s Ruby` for copy and show.
55
+
56
+
57
+ ## Example Snippet File (snippets.md)
58
+
59
+ An example snippet file can be found in the spec/fixtures folder.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/accio.gemspec ADDED
@@ -0,0 +1,28 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'accio/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "accio"
8
+ gem.version = Accio::VERSION
9
+ gem.authors = ["Dennis Schneider"]
10
+ gem.email = ["sinned.schneider@gmail.com"]
11
+ gem.description = %q{Accio is a code snippet management tool for the terminal}
12
+ gem.summary = %q{Accio - A code snippet management tool for the terminal}
13
+ gem.homepage = "https://github.com/dschneider/snip"
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+
20
+ gem.add_runtime_dependency('thor')
21
+ gem.add_runtime_dependency('term-ansicolor')
22
+ gem.add_runtime_dependency('clipboard')
23
+ gem.add_runtime_dependency('terminal-table')
24
+
25
+ gem.add_development_dependency('rspec')
26
+ gem.add_development_dependency('rake')
27
+ gem.add_development_dependency('simplecov')
28
+ end
data/bin/accio ADDED
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "thor"
4
+ require "accio"
5
+
6
+ class AccioCMD < Thor
7
+ desc "configure", "configures accio with the path of your snippet file"
8
+ def configure(path)
9
+ ::Accio.configure(path)
10
+ end
11
+
12
+ desc "groups", "show all groups"
13
+ def groups
14
+ ::Accio.show_groups
15
+ end
16
+
17
+ desc "show [GROUP][SNIPPET TITLE]", "show snippets for a specific group"
18
+ def show(group, snippet = nil)
19
+ ::Accio.show(group, snippet)
20
+ end
21
+
22
+ desc "s [GROUP][SNIPPET TITLE]", "show snippets for a specific group"
23
+ alias :s :show
24
+
25
+ desc "copy [GROUP][SNIPPET TITLE]", "copy snippets for a specific group"
26
+ def copy(group, snippet = nil)
27
+ ::Accio.copy(group, snippet)
28
+ end
29
+
30
+ desc "c [GROUP][SNIPPET TITLE]", "copy snippets for a specific group"
31
+ alias :c :copy
32
+ end
33
+
34
+ AccioCMD.start
data/lib/accio/code.rb ADDED
@@ -0,0 +1,20 @@
1
+ module Accio
2
+ # Public: Represents a code snippet.
3
+ class Code
4
+ attr_reader :text
5
+
6
+ # Public: Constructor.
7
+ #
8
+ # text - The code text.
9
+ def initialize(text)
10
+ @text = text
11
+ end
12
+
13
+ # Public: Adds text to the code text.
14
+ #
15
+ # text - The code text.
16
+ def add(text)
17
+ @text << text
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ module Accio
2
+ # Public: Represents a comment.
3
+ class Comment
4
+ attr_reader :text
5
+
6
+ # Public: Constructor.
7
+ #
8
+ # text - The comment text.
9
+ def initialize(text)
10
+ @text = text
11
+ end
12
+
13
+ # Public: Adds text to the comment text.
14
+ #
15
+ # text - The comment text.
16
+ def add(text)
17
+ @text << text
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,55 @@
1
+ module Accio
2
+ # Public: Represents the content of a snippet file.
3
+ class Content
4
+ attr_accessor :groups
5
+
6
+ # Public: Constructor.
7
+ def initialize
8
+ @groups = []
9
+ end
10
+
11
+ # Public: Search the groups and snippets for a specific text match.
12
+ #
13
+ # text - The text for main group titles to search for.
14
+ # subtext - The subtext for snippet titles to search for.
15
+ #
16
+ # Returns Array of Group matches with Snippet matches.
17
+ def search(text, subtext = nil)
18
+ matches = []
19
+ snippets = []
20
+ @groups.each do |group|
21
+ if group.title.downcase.include?(text.downcase)
22
+ # Search for matches in the snippets if a subtext is given.
23
+ if subtext
24
+ snippets = snippets | search_snippets(group, subtext)
25
+
26
+ # Reallocate the found snippets.
27
+ group.snippets = snippets
28
+ end
29
+
30
+ matches << group
31
+ end
32
+ end
33
+ matches
34
+ end
35
+
36
+ private
37
+
38
+ # Internal: Search the snippets for a specific text match.
39
+ #
40
+ # group - The parent group that includes all the snippets.
41
+ # text - The text for snippet titles to search for.
42
+ #
43
+ # Returns Array of snippet matches.
44
+ def search_snippets(group, text)
45
+ matches = []
46
+ group.snippets.each do |snippet|
47
+ # Only include the snippet if the text is found in the title.
48
+ if snippet.title.downcase.include?(text.downcase)
49
+ matches << snippet
50
+ end
51
+ end
52
+ matches
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,55 @@
1
+ require 'term/ansicolor'
2
+ require 'terminal-table'
3
+
4
+ module Accio
5
+ # Public: Formats the snippet output for the terminal.
6
+ module Formatter
7
+ COLOR = Term::ANSIColor
8
+
9
+ class << self
10
+ # Public: Colorizes the title of a group.
11
+ #
12
+ # Returns a colorized String.
13
+ def print_group_title(title)
14
+ COLOR.send(:red, title)
15
+ end
16
+
17
+ # Public: Colorizes the title of a snippet.
18
+ #
19
+ # Returns a colorized String.
20
+ def print_snippet_title(title)
21
+ COLOR.send(:blue, title)
22
+ end
23
+
24
+ # Public: Colorizes a code snippet.
25
+ #
26
+ # Returns a colorized String.
27
+ def print_code(snippet)
28
+ COLOR.send(:green, snippet)
29
+ end
30
+
31
+ # Public: Colorizes a code comment.
32
+ #
33
+ # Returns a colorized String.
34
+ def print_comment(comment)
35
+ COLOR.send(:yellow, comment)
36
+ end
37
+
38
+ # Public: Prints a table with group title, snippet title, comment and
39
+ # code.
40
+ def template(group_title, snippet_title, comment, code)
41
+ rows = []
42
+ rows << [print_group_title(group_title)]
43
+ rows << :separator
44
+ rows << [print_snippet_title(snippet_title)]
45
+ unless comment.text.length == 0
46
+ rows << :separator
47
+ rows << [print_comment(comment.text)]
48
+ end
49
+
50
+ puts Terminal::Table.new(rows: rows)
51
+ puts print_code(code.text)
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,14 @@
1
+ module Accio
2
+ # Public: Represents a snippet group (e. g. Ruby, Networking, AWS etc.).
3
+ class Group
4
+ attr_accessor :title, :snippets
5
+
6
+ # Public: Constructor.
7
+ #
8
+ # title - The title of the group.
9
+ def initialize(title)
10
+ @title = title
11
+ @snippets = []
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,118 @@
1
+ require 'accio/content'
2
+ require 'accio/group'
3
+ require 'accio/snippet'
4
+
5
+ module Accio
6
+ # Public: The snippet parser module is responsible for parsing markdown based
7
+ # snippet documents.
8
+ module Parser
9
+
10
+ class NoConfigError < StandardError; end
11
+ class NoSnippetFileError < StandardError; end
12
+
13
+ class << self
14
+ # Public: Reads the snippet markdown file, parses the codelines and
15
+ # collects groups and snippets.
16
+ #
17
+ # Returns a Content object.
18
+ def read
19
+ content = Accio::Content.new
20
+ code_area = false
21
+
22
+ while (line = file.gets)
23
+ header_count = line.count("#")
24
+
25
+ # Whenever a code area starts we flip this code_area.
26
+ if line.count("`") == 3
27
+ code_area = !code_area
28
+ end
29
+
30
+ # If markdown header character found and not a code group.
31
+ if header_count == 1 && code_area == false
32
+ # Main Group. Sets the group globally so that snippets get
33
+ # associated with this group.
34
+ group = Accio::Group.new(parse_headline(line))
35
+ content.groups << group
36
+ elsif header_count == 2 && code_area == false
37
+ # Snippet.
38
+ snippet = Accio::Snippet.new(parse_headline(line))
39
+ group.snippets << snippet
40
+ else
41
+ # Code text or comments.
42
+ if snippet
43
+ if line.count("*") == 4
44
+ snippet.comment.add(parse_comment(line))
45
+ else
46
+ unless line.length < 2 || line == "\n"
47
+ snippet.code.add(parse_code(line))
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ file.close
54
+ content
55
+ end
56
+
57
+ private
58
+
59
+ # Public: Parse headline. Remove hashtags, line breaks and the first
60
+ # space.
61
+ #
62
+ # line - The read line.
63
+ #
64
+ # Returns the text line.
65
+ def parse_headline(line)
66
+ line.gsub("#", "").gsub("\n", "").sub(" ", "")
67
+ end
68
+
69
+ # Public: Parse code area.
70
+ #
71
+ # line - The read line.
72
+ #
73
+ # Returns the text line.
74
+ def parse_code(line)
75
+ line.gsub("```", "")
76
+ end
77
+
78
+ # Public: Parse comment area.
79
+ #
80
+ # line - The read line.
81
+ #
82
+ # Returns the text line.
83
+ def parse_comment(line)
84
+ line.gsub("**", "")
85
+ end
86
+
87
+ # Public: Loads the config file.
88
+ #
89
+ # Returns a String path.
90
+ def config
91
+ return @config if @config
92
+
93
+ config_path = File.join(Dir.home, ".accio")
94
+
95
+ unless File.exists?(config_path)
96
+ raise NoConfigError, "Please run accio configure to create a config"
97
+ end
98
+
99
+ @config ||= File.new(config_path, "r").gets
100
+ end
101
+
102
+ # Public: Loads the snippet file.
103
+ #
104
+ # Returns a File object.
105
+ def file
106
+ return @file if @file
107
+
108
+ snippet_path = File.join(Dir.home, config.gsub("\n", ""), "snippets.md")
109
+
110
+ unless File.exists?(snippet_path)
111
+ raise NoSnippetFileError, "Please create a snippet file"
112
+ end
113
+
114
+ @file ||= File.new(snippet_path, "r")
115
+ end
116
+ end
117
+ end
118
+ end
@@ -0,0 +1,22 @@
1
+ require 'accio/code'
2
+ require 'accio/comment'
3
+
4
+ module Accio
5
+ # Public: Represents a snippet (e. g. Read Files, Establish SSH Connection
6
+ # etc.). A snippet consists of a title, a code part and optionally of a
7
+ # comment.
8
+ class Snippet
9
+ attr_accessor :title, :code, :comment
10
+
11
+ # Public: Constructor.
12
+ #
13
+ # title - The title of the snippet.
14
+ # code - The associated code.
15
+ # comment - The associated comment.
16
+ def initialize(title, code = "", comment = "")
17
+ @title = title
18
+ @code = Code.new(code)
19
+ @comment = Comment.new(comment)
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,3 @@
1
+ module Accio
2
+ VERSION = "0.0.2"
3
+ end
data/lib/accio.rb ADDED
@@ -0,0 +1,62 @@
1
+ require "accio/version"
2
+ require "accio"
3
+ require "accio/parser"
4
+ require "accio/formatter"
5
+ require "clipboard"
6
+
7
+ # Public: Accio is a module that helps to organize and categorize code
8
+ # snippets in the terminal.
9
+ module Accio
10
+ class << self
11
+ # Public: Rewrites the snip configuration file in the home directory.
12
+ def configure(path)
13
+ File.open(File.join(Dir.home, ".accio"), "w") do |file|
14
+ file.puts path
15
+ end
16
+ puts "Accio was configured successfully"
17
+ end
18
+
19
+ # Public: Shows all the groups that are existing in the markdown file.
20
+ def show_groups
21
+ content = Accio::Parser.read
22
+ content.groups.each do |group|
23
+ puts "#{group.title}\n"
24
+ end
25
+ end
26
+
27
+ # Public: Shows the code snippets for the specified group and optionally
28
+ # for the specified snippet title.
29
+ def show(group, snippet = nil)
30
+ content = Accio::Parser.read
31
+ matches = content.search(group, snippet)
32
+ matches.each do |match|
33
+ match.snippets.each do |submatch|
34
+ # Format the output and display it.
35
+ Accio::Formatter.template(
36
+ match.title, submatch.title, submatch.comment, submatch.code
37
+ )
38
+ end
39
+ end
40
+ end
41
+
42
+ # Public: Searches code snippets for a specified group and optionally for a
43
+ # specified snippet title and copies the last found code snippet to the
44
+ # clipboard.
45
+ def copy(group, snippet = nil)
46
+ content = Accio::Parser.read
47
+ matches = content.search(group, snippet)
48
+ matches.each do |match|
49
+ match.snippets.each do |submatch|
50
+ # Copy code to clipboard.
51
+ Clipboard.copy submatch.code.text.gsub(/^$\n/, '')
52
+
53
+ # Format the output and display it.
54
+ Accio::Formatter.template(
55
+ match.title, submatch.title, submatch.comment, submatch.code
56
+ )
57
+ end
58
+ end
59
+ puts "The last found code snippet has been copied to the clipboard"
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,29 @@
1
+ # Vim
2
+
3
+ ## Search and replace in open buffers
4
+
5
+ ```
6
+ bufdo %s/pattern/replace/ge | update
7
+ ```
8
+
9
+ ## Delete all occurences of search
10
+
11
+ ```
12
+ g/occurrence/d
13
+ ```
14
+
15
+ # Git
16
+
17
+ ## Reset to head hard
18
+
19
+ ```
20
+ git reset --hard HEAD
21
+ ```
22
+
23
+ ## Delete branch
24
+
25
+ **Deletes a whole branch**
26
+
27
+ ```
28
+ git branch -D
29
+ ```
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+
3
+ describe Accio::Code do
4
+
5
+ subject { Accio::Code.new("puts 'yes'") }
6
+
7
+ describe "#text" do
8
+ it "contains the code" do
9
+ expect(subject.text).to eq("puts 'yes'")
10
+ end
11
+ end
12
+
13
+ describe "#add" do
14
+ it "adds text to the code text" do
15
+ subject.add(" if true")
16
+
17
+ expect(subject.text).to eq("puts 'yes' if true")
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+
3
+ describe Accio::Comment do
4
+
5
+ subject { Accio::Comment.new("This is code that does something") }
6
+
7
+ describe "#text" do
8
+ it "contains the comment" do
9
+ expect(subject.text).to eq("This is code that does something")
10
+ end
11
+ end
12
+
13
+ describe "#add" do
14
+ it "adds text to the comment text" do
15
+ subject.add(" strange")
16
+
17
+ expect(subject.text).to eq("This is code that does something strange")
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,40 @@
1
+ require 'spec_helper'
2
+
3
+ describe Accio::Content do
4
+
5
+ subject { Accio::Content.new }
6
+
7
+ let(:group) { Accio::Group.new("Group") }
8
+ let(:snippet) { Accio::Snippet.new("Recursively delete folder") }
9
+ let(:another_snippet) { Accio::Snippet.new("Read Files") }
10
+
11
+ before do
12
+ snippet.code.add("puts 1 + 2")
13
+ group.snippets << snippet
14
+ group.snippets << another_snippet
15
+ subject.groups << group
16
+ end
17
+
18
+ describe "#search" do
19
+ it "searches for included text" do
20
+ matches = subject.search("Gro")
21
+
22
+ expect(matches).to eq([group])
23
+ end
24
+
25
+ it "searches case insensitive" do
26
+ matches = subject.search("GROU")
27
+
28
+ expect(matches).to eq([group])
29
+ end
30
+
31
+ context "subtext is specified" do
32
+ it "searches according to the subtext" do
33
+ matches = subject.search("Gro", "File")
34
+
35
+ expect(matches.count).to eq(1)
36
+ expect(matches.first.snippets).to eq([another_snippet])
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe Accio::Group do
4
+
5
+ subject { Accio::Group.new("Group") }
6
+
7
+ let(:snippet) { Accio::Snippet.new("Recursively delete folder") }
8
+
9
+ before do
10
+ subject.snippets << snippet
11
+ end
12
+
13
+ describe "snippets" do
14
+ it "contains the snippet" do
15
+ expect(subject.snippets).to include(snippet)
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,53 @@
1
+ require 'spec_helper'
2
+
3
+ describe Accio::Parser do
4
+
5
+ subject { Accio::Parser }
6
+
7
+ before :each do
8
+ subject.stub(:config).and_return('')
9
+ subject.stub(:file).and_return(File.new('spec/fixtures/snippets.md', 'r'))
10
+ end
11
+
12
+ describe ".read" do
13
+ it "parses two groups" do
14
+ content = subject.read
15
+
16
+ expect(content.groups.count).to eq(2)
17
+ end
18
+
19
+ it "parses four snippets" do
20
+ content = subject.read
21
+ first_group_count = content.groups.first.snippets.count
22
+ second_group_count = content.groups.last.snippets.count
23
+ total_count = first_group_count + second_group_count
24
+
25
+ expect(total_count).to eq(4)
26
+ end
27
+
28
+ it "parses one comment" do
29
+ content = subject.read
30
+ comment_text = content.groups.last.snippets.last.comment.text
31
+
32
+ expect(comment_text).to eq("Deletes a whole branch\n")
33
+ end
34
+
35
+ context "no config file" do
36
+ it "raises a NoConfigError" do
37
+ subject.unstub(:config)
38
+ subject.unstub(:file)
39
+ File.stub(:join).and_return('xyz')
40
+
41
+ expect { subject.read }.to raise_error(subject::NoConfigError)
42
+ end
43
+ end
44
+
45
+ context "no snippet file" do
46
+ it "raises a NoSnippetFileError" do
47
+ subject.unstub(:file)
48
+
49
+ expect { subject.read }.to raise_error(subject::NoSnippetFileError)
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ describe Accio::Snippet do
4
+
5
+ subject { Accio::Snippet.new("Do arithmetics", "1 + 1", "Addition") }
6
+
7
+ describe "#title" do
8
+ it "holds a code object" do
9
+ expect(subject.title).to eq("Do arithmetics")
10
+ end
11
+ end
12
+
13
+ describe "#code" do
14
+ it "holds a code object" do
15
+ expect(subject.code).to be_a(Accio::Code)
16
+ end
17
+ end
18
+
19
+ describe "#comment" do
20
+ it "holds a comment object" do
21
+ expect(subject.comment).to be_a(Accio::Comment)
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,16 @@
1
+ if ENV['COVERAGE']
2
+ require 'simplecov'
3
+ SimpleCov.start do
4
+ add_filter "/spec"
5
+ end
6
+ end
7
+
8
+ require "rspec"
9
+ require "accio"
10
+
11
+ RSpec.configure do |config|
12
+ config.treat_symbols_as_metadata_keys_with_true_values = true
13
+ config.run_all_when_everything_filtered = true
14
+ config.filter_run :focus
15
+ config.order = "random"
16
+ end
metadata ADDED
@@ -0,0 +1,198 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: accio
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Dennis Schneider
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-03-10 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: thor
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: term-ansicolor
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: clipboard
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
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: terminal-table
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :runtime
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: rspec
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'
94
+ - !ruby/object:Gem::Dependency
95
+ name: rake
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: simplecov
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ description: Accio is a code snippet management tool for the terminal
127
+ email:
128
+ - sinned.schneider@gmail.com
129
+ executables:
130
+ - accio
131
+ extensions: []
132
+ extra_rdoc_files: []
133
+ files:
134
+ - .gitignore
135
+ - CHANGELOG
136
+ - Gemfile
137
+ - Gemfile.lock
138
+ - LICENSE.txt
139
+ - README.md
140
+ - Rakefile
141
+ - accio.gemspec
142
+ - bin/accio
143
+ - lib/accio.rb
144
+ - lib/accio/code.rb
145
+ - lib/accio/comment.rb
146
+ - lib/accio/content.rb
147
+ - lib/accio/formatter.rb
148
+ - lib/accio/group.rb
149
+ - lib/accio/parser.rb
150
+ - lib/accio/snippet.rb
151
+ - lib/accio/version.rb
152
+ - spec/fixtures/snippets.md
153
+ - spec/lib/code_spec.rb
154
+ - spec/lib/comment_spec.rb
155
+ - spec/lib/content_spec.rb
156
+ - spec/lib/group_spec.rb
157
+ - spec/lib/parser_spec.rb
158
+ - spec/lib/snippet_spec.rb
159
+ - spec/spec_helper.rb
160
+ homepage: https://github.com/dschneider/snip
161
+ licenses: []
162
+ post_install_message:
163
+ rdoc_options: []
164
+ require_paths:
165
+ - lib
166
+ required_ruby_version: !ruby/object:Gem::Requirement
167
+ none: false
168
+ requirements:
169
+ - - ! '>='
170
+ - !ruby/object:Gem::Version
171
+ version: '0'
172
+ segments:
173
+ - 0
174
+ hash: 1446051849502590714
175
+ required_rubygems_version: !ruby/object:Gem::Requirement
176
+ none: false
177
+ requirements:
178
+ - - ! '>='
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ segments:
182
+ - 0
183
+ hash: 1446051849502590714
184
+ requirements: []
185
+ rubyforge_project:
186
+ rubygems_version: 1.8.24
187
+ signing_key:
188
+ specification_version: 3
189
+ summary: Accio - A code snippet management tool for the terminal
190
+ test_files:
191
+ - spec/fixtures/snippets.md
192
+ - spec/lib/code_spec.rb
193
+ - spec/lib/comment_spec.rb
194
+ - spec/lib/content_spec.rb
195
+ - spec/lib/group_spec.rb
196
+ - spec/lib/parser_spec.rb
197
+ - spec/lib/snippet_spec.rb
198
+ - spec/spec_helper.rb