recipe_box 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7265f5e6119d319eb7e9b71e6cdaaf3a90f6de8e
4
+ data.tar.gz: af878526adba49fac7f7dbe5794de36d35a56234
5
+ SHA512:
6
+ metadata.gz: 0577a74c42baf9e03089e3af681291dccc2827faf864038ce198d72801d4075e541853d6d9d1e4c08ac758d521e24463d22680faa82e30ef268e6e913cf734b0
7
+ data.tar.gz: 68106a9ea8e845259221a290970557617279ac9fdbccb695b11b1a2f0d5002b828c634ed02880db27ae2f3216e6059f3da7d512959dc0191cbaeb0df757f19ce
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in recipe_box.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Josh Klina
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,36 @@
1
+ # RecipeBox
2
+
3
+ This is basically a couple of file generators thrown together to enforce a specific format for storing recipes.
4
+
5
+ ## Installation
6
+
7
+ $ gem install recipe_box
8
+
9
+ ## Usage
10
+
11
+ You begin by creating a directory to store your reipes, or just type:
12
+
13
+ `recipe_box new my_recipe_box`
14
+
15
+ Once you have a dedicated directory for your recipes jump inside of it and try creating a new recipe:
16
+
17
+ `cd my_recipe_box`
18
+ `recipe_box insert roast_chicken`
19
+
20
+ This will create a new directory with a basic markdown template you can use. At this point, use your favorite editor to edit the file. Since each recipe has its own directory you can add images or even multiple files, or keep it as simple as a single markdown file.
21
+
22
+ If you want to remove a recipe you can manually delete the directory or type:
23
+
24
+ `recipe_box remove roast_chicken`
25
+
26
+ This will delete the directory and the files inside the directory of the given recipe.
27
+
28
+ Since all the content is nothing but directories and markdown, you can use Git to keep track of all your changes and even save your recipes to a remote repository! A nice side effect is that you'll be able to track all the changes and modifications you make to your recipes.
29
+
30
+ ## Contributing
31
+
32
+ 1. Fork it ( http://github.com/<my-github-username>/recipe_box/fork )
33
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
34
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
35
+ 4. Push to the branch (`git push origin my-new-feature`)
36
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new do |t|
5
+ t.test_files = FileList['features/**/*_spec.rb']
6
+ end
data/bin/recipe_box ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../lib/recipe_box'
3
+
4
+ RecipeBox::CLI.start(ARGV)
@@ -0,0 +1,5 @@
1
+ require 'minitest/autorun'
2
+ require 'minitest/pride'
3
+ require 'minitest/mock'
4
+ require 'mocha/mini_test'
5
+ require_relative '../lib/recipe_box'
@@ -0,0 +1,51 @@
1
+ require_relative 'helper'
2
+
3
+ describe "creating a recipe box" do
4
+ it "creates a proper directory structure" do
5
+ name = "cool_recipes"
6
+ out = capture_io{ RecipeBox::CLI.start %w{ new cool_recipes } }.join ''
7
+ assert File.directory?(name)
8
+ end
9
+ end
10
+
11
+ describe "creating a recipe" do
12
+ before do
13
+ @recipe_name = "flan"
14
+ @out = capture_io{ RecipeBox::CLI.start %w{ insert flan } }.join ''
15
+ end
16
+
17
+ it "creates a proper directory structure" do
18
+ assert File.directory?(@recipe_name)
19
+ end
20
+
21
+ it "creates a new template file in markdown based on the recipe name" do
22
+ assert File.exist?("#{@recipe_name}/#{@recipe_name}.markdown")
23
+ end
24
+
25
+ after do
26
+ FileUtils.rm_rf(@recipe_name)
27
+ end
28
+ end
29
+
30
+ describe "removing a recipe" do
31
+ before do
32
+ @recipe_name = "flan"
33
+ Thor::Shell::Basic.any_instance.expects(:yes?).with("Warning: this will remove the directory #{@recipe_name} and all its contents. Proceed?").returns(true)
34
+ end
35
+
36
+ it "gives a warning that its about to delete the receipe dir and contents" do
37
+ capture_io { RecipeBox::CLI.start %w{ remove flan } }
38
+ end
39
+
40
+ it "removes the recipe's directory" do
41
+ FileUtils.mkdir(@recipe_name)
42
+ FileUtils.touch("#{@recipe_name}/#{@recipe_name}.markdown")
43
+ assert File.directory?(@recipe_name)
44
+ capture_io { RecipeBox::CLI.start %w{ remove flan } }
45
+ refute File.directory?(@recipe_name)
46
+ end
47
+
48
+ after do
49
+ FileUtils.rm_rf(@recipe_name)
50
+ end
51
+ end
@@ -0,0 +1,20 @@
1
+ module RecipeBox
2
+ class CLI < Thor
3
+ desc "recipe_box insert NAME", "create a recipe called NAME"
4
+ def insert(name)
5
+ CreateRecipe.start([name])
6
+ end
7
+
8
+ desc "recipe_box remove NAME", "removes a recipe called NAME"
9
+ def remove(name)
10
+ if yes?("Warning: this will remove the directory #{name} and all its contents. Proceed?")
11
+ RemoveRecipe.start([name])
12
+ end
13
+ end
14
+
15
+ desc "recipe_box new NAME", "creates a directory to hold the recipes"
16
+ def new(name)
17
+ CreateRecipeBox.start([name])
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,19 @@
1
+ module RecipeBox
2
+ class CreateRecipe < Thor::Group
3
+ include Thor::Actions
4
+
5
+ argument :name
6
+
7
+ def self.source_root
8
+ File.dirname(__FILE__)
9
+ end
10
+
11
+ def create_directory
12
+ empty_directory(name)
13
+ end
14
+
15
+ def create_recipe
16
+ template("../../templates/recipe.tt", "#{name}/#{name}.markdown")
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,15 @@
1
+ module RecipeBox
2
+ class CreateRecipeBox < Thor::Group
3
+ include Thor::Actions
4
+
5
+ argument :name
6
+
7
+ def self.source_root
8
+ File.dirname(__FILE__)
9
+ end
10
+
11
+ def create_directory
12
+ empty_directory(name)
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module RecipeBox
2
+ class RemoveRecipe < Thor::Group
3
+ include Thor::Actions
4
+
5
+ argument :name
6
+
7
+ def self.source_root
8
+ File.dirname(__FILE__)
9
+ end
10
+
11
+ def remove_directory
12
+ remove_dir(name)
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,3 @@
1
+ module RecipeBox
2
+ VERSION = "0.0.1"
3
+ end
data/lib/recipe_box.rb ADDED
@@ -0,0 +1,10 @@
1
+ require 'thor'
2
+
3
+ require_relative "recipe_box/version"
4
+ require_relative "recipe_box/create_recipe"
5
+ require_relative "recipe_box/create_recipe_box"
6
+ require_relative "recipe_box/remove_recipe"
7
+ require_relative "recipe_box/cli"
8
+
9
+ module RecipeBox
10
+ end
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'recipe_box/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "recipe_box"
8
+ spec.version = RecipeBox::VERSION
9
+ spec.authors = ["Josh Klina"]
10
+ spec.email = ["joshua.klina@gmail.com"]
11
+ spec.summary = %q{A command line app that helps manage a git repository of (cooking) recipes.}
12
+ spec.description = "A command line app that generates templates for make recipes."
13
+ # spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_runtime_dependency "thor", '~> 0.19'
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.5"
24
+ spec.add_development_dependency "rake", "~> 10.2"
25
+ spec.add_development_dependency "minitest", "~> 5.3"
26
+ spec.add_development_dependency "mocha", "~> 1.0"
27
+ end
@@ -0,0 +1,11 @@
1
+ # Placeholder
2
+
3
+ ## Ingredients
4
+
5
+ * _List your ingredients here_
6
+
7
+ ## Instructions
8
+
9
+ ## Sources
10
+
11
+ Put any references here.
data/test/helper.rb ADDED
@@ -0,0 +1,3 @@
1
+ require 'minitest/autorun'
2
+ require 'minitest/pride'
3
+ require_relative '../lib/recipe_box'
@@ -0,0 +1,11 @@
1
+ require_relative 'helper'
2
+
3
+ class TestRecipeBox < MiniTest::Unit::TestCase
4
+ def test_new_creates_directory
5
+ assert_equal true, RecipeBox.new("abba")
6
+ end
7
+
8
+ def test_sanitize_filename_replaces_spaces_w_underscores
9
+ assert_equal "hello_test", RecipeBox.sanitize_filename("hello test")
10
+ end
11
+ end
metadata ADDED
@@ -0,0 +1,137 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: recipe_box
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Josh Klina
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.19'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.19'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.5'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.5'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.2'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.2'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '5.3'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '5.3'
69
+ - !ruby/object:Gem::Dependency
70
+ name: mocha
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.0'
83
+ description: A command line app that generates templates for make recipes.
84
+ email:
85
+ - joshua.klina@gmail.com
86
+ executables:
87
+ - recipe_box
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - ".gitignore"
92
+ - Gemfile
93
+ - LICENSE.txt
94
+ - README.md
95
+ - Rakefile
96
+ - bin/recipe_box
97
+ - features/helper.rb
98
+ - features/recipe_box_spec.rb
99
+ - lib/recipe_box.rb
100
+ - lib/recipe_box/cli.rb
101
+ - lib/recipe_box/create_recipe.rb
102
+ - lib/recipe_box/create_recipe_box.rb
103
+ - lib/recipe_box/remove_recipe.rb
104
+ - lib/recipe_box/version.rb
105
+ - recipe_box.gemspec
106
+ - templates/recipe.tt
107
+ - test/helper.rb
108
+ - test/test_recipe_box.rb
109
+ homepage:
110
+ licenses:
111
+ - MIT
112
+ metadata: {}
113
+ post_install_message:
114
+ rdoc_options: []
115
+ require_paths:
116
+ - lib
117
+ required_ruby_version: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ required_rubygems_version: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ requirements: []
128
+ rubyforge_project:
129
+ rubygems_version: 2.2.2
130
+ signing_key:
131
+ specification_version: 4
132
+ summary: A command line app that helps manage a git repository of (cooking) recipes.
133
+ test_files:
134
+ - features/helper.rb
135
+ - features/recipe_box_spec.rb
136
+ - test/helper.rb
137
+ - test/test_recipe_box.rb