auto-terminal 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,18 @@
1
+ Copyright (c) 2009 Winton Welsh
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7
+ the Software, and to permit persons to whom the Software is furnished to do so,
8
+ subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,13 @@
1
+ Terminal
2
+ ========
3
+
4
+ Use Auto from the command line.
5
+
6
+ Install
7
+ -------
8
+
9
+ This plugin is automatically installed when you install the auto gem.
10
+
11
+ <pre>
12
+ sudo gem install auto --source http://gemcutter.org
13
+ </pre>
@@ -0,0 +1,52 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'rake/gempackagetask'
4
+ require 'spec/rake/spectask'
5
+ require 'gemspec'
6
+
7
+ desc "Generate gemspec"
8
+ task :gemspec do
9
+ File.open("#{Dir.pwd}/#{GEM_NAME}.gemspec", 'w') do |f|
10
+ f.write(GEM_SPEC.to_ruby)
11
+ end
12
+ end
13
+
14
+ desc "Install gem"
15
+ task :install do
16
+ Rake::Task['gem'].invoke
17
+ `sudo gem uninstall #{GEM_NAME} -x`
18
+ `sudo gem install pkg/#{GEM_NAME}*.gem`
19
+ `rm -Rf pkg`
20
+ end
21
+
22
+ desc "Package gem"
23
+ Rake::GemPackageTask.new(GEM_SPEC) do |pkg|
24
+ pkg.gem_spec = GEM_SPEC
25
+ end
26
+
27
+ desc "Rename project"
28
+ task :rename do
29
+ name = ENV['NAME'] || File.basename(Dir.pwd)
30
+ begin
31
+ dir = Dir['**/gem_template*']
32
+ from = dir.pop
33
+ if from
34
+ rb = from.include?('.rb')
35
+ to = File.dirname(from) + "/#{name}#{'.rb' if rb}"
36
+ FileUtils.mv(from, to)
37
+ end
38
+ end while dir.length > 0
39
+ Dir["**/*"].each do |path|
40
+ next if path.include?('Rakefile')
41
+ if File.file?(path)
42
+ `sed -i "" 's/gem_template/#{name}/g' #{path}`
43
+ end
44
+ end
45
+ end
46
+
47
+ desc "Run specs"
48
+ Spec::Rake::SpecTask.new do |t|
49
+ t.rcov = true
50
+ t.spec_opts = ["--format", "specdoc", "--colour"]
51
+ t.spec_files = FileList["spec/**/*_spec.rb"]
52
+ end
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'auto/require'
5
+
6
+ Auto::Runner.new do
7
+ terminal(ARGV)
8
+ end
@@ -0,0 +1,18 @@
1
+ GEM_NAME = 'auto-terminal'
2
+ GEM_FILES = FileList['**/*'] - FileList['coverage', 'coverage/**/*', 'pkg', 'pkg/**/*']
3
+ GEM_SPEC = Gem::Specification.new do |s|
4
+ # == CONFIGURE ==
5
+ s.author = "Winton Welsh"
6
+ s.email = "mail@wintoni.us"
7
+ s.homepage = "http://github.com/winton/#{GEM_NAME}"
8
+ s.summary = "Use Auto from the command line"
9
+ # == CONFIGURE ==
10
+ s.executables << 'auto'
11
+ s.extra_rdoc_files = [ "README.markdown" ]
12
+ s.files = GEM_FILES.to_a
13
+ s.has_rdoc = false
14
+ s.name = GEM_NAME
15
+ s.platform = Gem::Platform::RUBY
16
+ s.require_path = "lib"
17
+ s.version = "0.0.1"
18
+ end
@@ -0,0 +1,40 @@
1
+ module Auto
2
+ module Terminal
3
+
4
+ def terminal(args)
5
+ Terminal.instance(self, args)
6
+ end
7
+
8
+ class Terminal
9
+
10
+ cattr_accessor :runner
11
+
12
+ class <<self
13
+
14
+ def instance(runner, args)
15
+ @@runner = runner
16
+ if args.empty?
17
+ Plugins.tasks.each do |task|
18
+ puts task[:name]
19
+ end
20
+ else
21
+ args.each do |task|
22
+ run(task)
23
+ end
24
+ end
25
+ end
26
+
27
+ def run(task)
28
+ @@runner.before_question do |key, value|
29
+ puts value.first
30
+ @@runner.instance_eval do
31
+ answers[key] = STDIN.gets
32
+ eval("@#{key} = answers[key]")
33
+ end
34
+ end
35
+ @@runner.run(task)
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,16 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+
3
+ module Auto
4
+ describe Auto::Terminal do
5
+
6
+ before(:each) do
7
+ @r = Runner.new
8
+ end
9
+
10
+ it 'should expose a terminal method' do
11
+ @r.run do
12
+ self.class.instance_methods.include?('terminal').should == true
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1 @@
1
+ --color
@@ -0,0 +1,18 @@
1
+ $testing = true
2
+ SPEC = File.dirname(__FILE__)
3
+ $:.unshift File.expand_path("#{SPEC}/../lib")
4
+
5
+ require 'rubygems'
6
+ require 'auto/require'
7
+ require 'auto/terminal'
8
+ require 'pp'
9
+
10
+ Spec::Runner.configure do |config|
11
+ end
12
+
13
+ # For use with rspec textmate bundle
14
+ def debug(object)
15
+ puts "<pre>"
16
+ puts object.pretty_inspect.gsub('<', '&lt;').gsub('>', '&gt;')
17
+ puts "</pre>"
18
+ end
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: auto-terminal
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Winton Welsh
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-11-15 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description:
17
+ email: mail@wintoni.us
18
+ executables:
19
+ - auto
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README.markdown
24
+ files:
25
+ - bin/auto
26
+ - gemspec.rb
27
+ - lib/auto/terminal.rb
28
+ - MIT-LICENSE
29
+ - Rakefile
30
+ - README.markdown
31
+ - spec/auto/terminal_spec.rb
32
+ - spec/spec.opts
33
+ - spec/spec_helper.rb
34
+ has_rdoc: true
35
+ homepage: http://github.com/winton/auto-terminal
36
+ licenses: []
37
+
38
+ post_install_message:
39
+ rdoc_options: []
40
+
41
+ require_paths:
42
+ - lib
43
+ required_ruby_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: "0"
48
+ version:
49
+ required_rubygems_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: "0"
54
+ version:
55
+ requirements: []
56
+
57
+ rubyforge_project:
58
+ rubygems_version: 1.3.5
59
+ signing_key:
60
+ specification_version: 3
61
+ summary: Use Auto from the command line
62
+ test_files: []
63
+