rake-sh 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.document +5 -0
- data/.rspec +1 -0
- data/Gemfile +13 -0
- data/Gemfile.lock +28 -0
- data/LICENSE.txt +20 -0
- data/README.md +31 -0
- data/Rakefile +50 -0
- data/VERSION +1 -0
- data/bin/rake-sh +5 -0
- data/lib/rake/sh.rb +56 -0
- data/lib/rake/sh/command.rb +31 -0
- data/lib/rake/sh/commands.rb +29 -0
- data/spec/rake-sh_spec.rb +7 -0
- data/spec/spec_helper.rb +12 -0
- metadata +117 -0
data/.document
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
|
6
|
+
# Add dependencies to develop your gem here.
|
7
|
+
# Include everything needed to run rake, tests, features, etc.
|
8
|
+
group :development do
|
9
|
+
gem "rspec", "~> 2.3.0"
|
10
|
+
gem "bundler", "~> 1.0.0"
|
11
|
+
gem "jeweler", "~> 1.5.2"
|
12
|
+
gem "rcov", ">= 0"
|
13
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
diff-lcs (1.1.2)
|
5
|
+
git (1.2.5)
|
6
|
+
jeweler (1.5.2)
|
7
|
+
bundler (~> 1.0.0)
|
8
|
+
git (>= 1.2.5)
|
9
|
+
rake
|
10
|
+
rake (0.8.7)
|
11
|
+
rcov (0.9.9)
|
12
|
+
rspec (2.3.0)
|
13
|
+
rspec-core (~> 2.3.0)
|
14
|
+
rspec-expectations (~> 2.3.0)
|
15
|
+
rspec-mocks (~> 2.3.0)
|
16
|
+
rspec-core (2.3.1)
|
17
|
+
rspec-expectations (2.3.0)
|
18
|
+
diff-lcs (~> 1.1.2)
|
19
|
+
rspec-mocks (2.3.0)
|
20
|
+
|
21
|
+
PLATFORMS
|
22
|
+
ruby
|
23
|
+
|
24
|
+
DEPENDENCIES
|
25
|
+
bundler (~> 1.0.0)
|
26
|
+
jeweler (~> 1.5.2)
|
27
|
+
rcov
|
28
|
+
rspec (~> 2.3.0)
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 jugyo
|
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/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
rake-sh
|
2
|
+
====
|
3
|
+
|
4
|
+
The Rake Shell.
|
5
|
+
|
6
|
+
Install
|
7
|
+
----
|
8
|
+
|
9
|
+
gem install rake-sh
|
10
|
+
|
11
|
+
Usage
|
12
|
+
----
|
13
|
+
|
14
|
+
rake-sh
|
15
|
+
|
16
|
+
Invoke a rake taks:
|
17
|
+
|
18
|
+
rake> rake spec
|
19
|
+
|
20
|
+
Print rake tasks:
|
21
|
+
|
22
|
+
rake> tasks
|
23
|
+
|
24
|
+
or specify a pattern:
|
25
|
+
|
26
|
+
rake> tasks db
|
27
|
+
|
28
|
+
Copyright
|
29
|
+
----
|
30
|
+
|
31
|
+
Copyright (c) 2011 jugyo. See LICENSE.txt for further details.
|
data/Rakefile
ADDED
@@ -0,0 +1,50 @@
|
|
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 'rake'
|
11
|
+
|
12
|
+
require 'jeweler'
|
13
|
+
Jeweler::Tasks.new do |gem|
|
14
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
15
|
+
gem.name = "rake-sh"
|
16
|
+
gem.homepage = "http://github.com/jugyo/rake-sh"
|
17
|
+
gem.license = "MIT"
|
18
|
+
gem.summary = %Q{The Rake Shell.}
|
19
|
+
gem.description = %Q{Rake-sh is The Rake Shell.}
|
20
|
+
gem.email = "jugyo.org@gmail.com"
|
21
|
+
gem.authors = ["jugyo"]
|
22
|
+
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
23
|
+
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
24
|
+
# gem.add_runtime_dependency 'jabber4r', '> 0.1'
|
25
|
+
# gem.add_development_dependency 'rspec', '> 1.2.3'
|
26
|
+
end
|
27
|
+
Jeweler::RubygemsDotOrgTasks.new
|
28
|
+
|
29
|
+
require 'rspec/core'
|
30
|
+
require 'rspec/core/rake_task'
|
31
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
32
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
33
|
+
end
|
34
|
+
|
35
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
36
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
37
|
+
spec.rcov = true
|
38
|
+
end
|
39
|
+
|
40
|
+
task :default => :spec
|
41
|
+
|
42
|
+
require 'rake/rdoctask'
|
43
|
+
Rake::RDocTask.new do |rdoc|
|
44
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
45
|
+
|
46
|
+
rdoc.rdoc_dir = 'rdoc'
|
47
|
+
rdoc.title = "rake-sh #{version}"
|
48
|
+
rdoc.rdoc_files.include('README*')
|
49
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
50
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
data/bin/rake-sh
ADDED
data/lib/rake/sh.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'readline'
|
2
|
+
require 'rake'
|
3
|
+
require 'rake/sh/command'
|
4
|
+
require 'rake/sh/commands'
|
5
|
+
|
6
|
+
module Rake
|
7
|
+
module Sh
|
8
|
+
class << self
|
9
|
+
def start
|
10
|
+
rake_init
|
11
|
+
setup_readline
|
12
|
+
while buf = Readline.readline("rake> ", true)
|
13
|
+
line = buf.strip
|
14
|
+
next if line.empty?
|
15
|
+
begin
|
16
|
+
execute(line)
|
17
|
+
rescue SystemExit
|
18
|
+
raise
|
19
|
+
rescue Exception => e
|
20
|
+
puts "\e[41m#{e.message}\n#{e.backtrace.join("\n")}\e[0m"
|
21
|
+
end
|
22
|
+
setup_readline
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def execute(line)
|
27
|
+
if command = Command.find(line)
|
28
|
+
arg = line.split(/\s+/, 2)[1] rescue nil
|
29
|
+
command.call(arg)
|
30
|
+
else
|
31
|
+
invoke(line.strip)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def setup_readline
|
36
|
+
Readline.basic_word_break_characters = ""
|
37
|
+
Readline.completion_proc = lambda do |word|
|
38
|
+
(
|
39
|
+
Command.command_names.map { |name| name.to_s } +
|
40
|
+
Rake.application.tasks.map{ |t| t.name }
|
41
|
+
).grep(/#{Regexp.quote(word)}/)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def rake_init
|
46
|
+
Rake.application = Rake::Application.new
|
47
|
+
Rake.application.init
|
48
|
+
Rake.application.load_rakefile
|
49
|
+
end
|
50
|
+
|
51
|
+
def invoke(name)
|
52
|
+
Process.waitpid(fork { ::Rake.application[name].invoke })
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Rake
|
2
|
+
module Sh
|
3
|
+
module Command
|
4
|
+
class << self
|
5
|
+
def commands
|
6
|
+
@commands ||= {}
|
7
|
+
end
|
8
|
+
|
9
|
+
def define(name, &block)
|
10
|
+
commands[name.to_sym] = block
|
11
|
+
end
|
12
|
+
|
13
|
+
def find(line)
|
14
|
+
if name = line.split(/\s+/, 2)[0]
|
15
|
+
commands[name.to_sym]
|
16
|
+
else
|
17
|
+
nil
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def command_names
|
22
|
+
commands.keys
|
23
|
+
end
|
24
|
+
|
25
|
+
def [](name)
|
26
|
+
commands[name]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
include Rake::Sh
|
2
|
+
|
3
|
+
Command.define 'help' do
|
4
|
+
puts <<HELP
|
5
|
+
.tasks print tasks
|
6
|
+
.exit exit from rake-sh
|
7
|
+
HELP
|
8
|
+
end
|
9
|
+
|
10
|
+
Command.define 'tasks' do |arg|
|
11
|
+
Rake.application.options.show_task_pattern = arg ? Regexp.new(arg) : //
|
12
|
+
Rake.application.display_tasks_and_comments
|
13
|
+
end
|
14
|
+
|
15
|
+
Command.define 'exit' do
|
16
|
+
exit
|
17
|
+
end
|
18
|
+
|
19
|
+
Command.define 'rake' do |arg|
|
20
|
+
Rake::Sh.invoke(arg || :default)
|
21
|
+
end
|
22
|
+
|
23
|
+
Command.define 'system' do |arg|
|
24
|
+
system arg
|
25
|
+
end
|
26
|
+
|
27
|
+
Command.define '!' do |arg|
|
28
|
+
Command[:system].call(arg)
|
29
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
require 'rspec'
|
4
|
+
require 'rake-sh'
|
5
|
+
|
6
|
+
# Requires supporting files with custom matchers and macros, etc,
|
7
|
+
# in ./support/ and its subdirectories.
|
8
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
|
12
|
+
end
|
metadata
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rake-sh
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 1.0.0
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- jugyo
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-02-02 00:00:00 +09:00
|
14
|
+
default_executable: rake-sh
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: rspec
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ~>
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 2.3.0
|
24
|
+
type: :development
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - ~>
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 1.0.0
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: jeweler
|
40
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.5.2
|
46
|
+
type: :development
|
47
|
+
prerelease: false
|
48
|
+
version_requirements: *id003
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: rcov
|
51
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: "0"
|
57
|
+
type: :development
|
58
|
+
prerelease: false
|
59
|
+
version_requirements: *id004
|
60
|
+
description: Rake-sh is The Rake Shell.
|
61
|
+
email: jugyo.org@gmail.com
|
62
|
+
executables:
|
63
|
+
- rake-sh
|
64
|
+
extensions: []
|
65
|
+
|
66
|
+
extra_rdoc_files:
|
67
|
+
- LICENSE.txt
|
68
|
+
- README.md
|
69
|
+
files:
|
70
|
+
- .document
|
71
|
+
- .rspec
|
72
|
+
- Gemfile
|
73
|
+
- Gemfile.lock
|
74
|
+
- LICENSE.txt
|
75
|
+
- README.md
|
76
|
+
- Rakefile
|
77
|
+
- VERSION
|
78
|
+
- bin/rake-sh
|
79
|
+
- lib/rake/sh.rb
|
80
|
+
- lib/rake/sh/command.rb
|
81
|
+
- lib/rake/sh/commands.rb
|
82
|
+
- spec/rake-sh_spec.rb
|
83
|
+
- spec/spec_helper.rb
|
84
|
+
has_rdoc: true
|
85
|
+
homepage: http://github.com/jugyo/rake-sh
|
86
|
+
licenses:
|
87
|
+
- MIT
|
88
|
+
post_install_message:
|
89
|
+
rdoc_options: []
|
90
|
+
|
91
|
+
require_paths:
|
92
|
+
- lib
|
93
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
hash: -3306021911438142679
|
99
|
+
segments:
|
100
|
+
- 0
|
101
|
+
version: "0"
|
102
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
+
none: false
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: "0"
|
108
|
+
requirements: []
|
109
|
+
|
110
|
+
rubyforge_project:
|
111
|
+
rubygems_version: 1.5.0
|
112
|
+
signing_key:
|
113
|
+
specification_version: 3
|
114
|
+
summary: The Rake Shell.
|
115
|
+
test_files:
|
116
|
+
- spec/rake-sh_spec.rb
|
117
|
+
- spec/spec_helper.rb
|