fuzzake 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
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 fuzzake.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Denis Lutz
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,29 @@
1
+ # Fuzzake
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'fuzzake'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install fuzzake
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
data/fuzzake.gemspec ADDED
@@ -0,0 +1,17 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/fuzzake/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Denis Lutz"]
6
+ gem.email = ["denis.lutz@gmail.com"]
7
+ gem.description = %q{Fuzzake is a small library to integrate it with your rake file to be able to run rake taks in a fuzzy way.}
8
+ gem.summary = %q{Fuzzake makes it possible to run your rake tasks in a fuzzy way.}
9
+ gem.homepage = ""
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "fuzzake"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = Fuzzake::VERSION
17
+ end
@@ -0,0 +1,3 @@
1
+ module Fuzzake
2
+ VERSION = "0.0.1"
3
+ end
data/lib/fuzzake.rb ADDED
@@ -0,0 +1,60 @@
1
+ require "fuzzake/version"
2
+
3
+ module Fuzzake
4
+ namespace :fuzzake do
5
+ desc "Task to give ask the user for a pattern name and then suggest the possible names. If the name is exactly fitting then the task will be executed."
6
+ task :call do
7
+ fuzzy_name = take_property_or_ask("task_pattern", "Write the full name or just a part of the task you want to call:")
8
+ fitting_tasks = []
9
+ Rake::Task.tasks.each do |t|
10
+ if t.name == fuzzy_name
11
+ return Rake::Task[fuzzy_name].execute
12
+ elsif t.name =~ Regexp.new(fuzzy_name)
13
+ fitting_tasks << t.name
14
+ end
15
+ end
16
+ if fitting_tasks.empty?
17
+ Rake::Task.tasks.each do |t|
18
+ unless t.name =~ /default/ || t.name =~ /fuzzy/
19
+ fitting_tasks << t.name
20
+ end
21
+ end
22
+ end
23
+ puts "There are the following tasks to execute:"
24
+ fitting_tasks.each_with_index do |task,index|
25
+ puts "#{index} for #{task}"
26
+ end
27
+ execution_task_index = ask("So what is the index of the task you want to call?")
28
+ Rake::Task[fitting_tasks[execution_task_index.to_i]].execute
29
+ end
30
+
31
+ task :fuzzake, :arg1 do |t, args|
32
+ Rake::Task["fuzzake:call"].execute("task_pattern" => args[:arg1])
33
+ end
34
+
35
+ def ask(message, default="")
36
+ unless default.empty?
37
+ message << " (type 'default' for #{default})"
38
+ end
39
+ print message
40
+ answer = STDIN.gets.chomp
41
+ if answer.strip.downcase == "default"
42
+ default
43
+ else
44
+ answer
45
+ end
46
+ end
47
+
48
+ def take_property_or_ask(property, question, default="")
49
+ if ENV[property].nil?
50
+ property_answer = ask(question, default)
51
+ if property_answer == "default"
52
+ property_answer = default
53
+ end
54
+ else
55
+ property_answer = ENV[property]
56
+ end
57
+ property_answer
58
+ end
59
+ end
60
+ end
metadata ADDED
@@ -0,0 +1,54 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fuzzake
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Denis Lutz
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-06-24 00:00:00.000000000Z
13
+ dependencies: []
14
+ description: Fuzzake is a small library to integrate it with your rake file to be
15
+ able to run rake taks in a fuzzy way.
16
+ email:
17
+ - denis.lutz@gmail.com
18
+ executables: []
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - .gitignore
23
+ - Gemfile
24
+ - LICENSE
25
+ - README.md
26
+ - Rakefile
27
+ - fuzzake.gemspec
28
+ - lib/fuzzake.rb
29
+ - lib/fuzzake/version.rb
30
+ homepage: ''
31
+ licenses: []
32
+ post_install_message:
33
+ rdoc_options: []
34
+ require_paths:
35
+ - lib
36
+ required_ruby_version: !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ! '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ required_rubygems_version: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ requirements: []
49
+ rubyforge_project:
50
+ rubygems_version: 1.8.10
51
+ signing_key:
52
+ specification_version: 3
53
+ summary: Fuzzake makes it possible to run your rake tasks in a fuzzy way.
54
+ test_files: []