maiha-crb 0.1
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/MIT-LICENSE +20 -0
- data/README +0 -0
- data/Rakefile +57 -0
- data/bin/crb +4 -0
- data/lib/crb.rb +90 -0
- metadata +77 -0
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 [maiha@wota.jp]
|
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
ADDED
File without changes
|
data/Rakefile
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake/gempackagetask'
|
3
|
+
|
4
|
+
#require 'merb-core'
|
5
|
+
#require 'merb-core/tasks/merb'
|
6
|
+
|
7
|
+
GEM_NAME = "crb"
|
8
|
+
AUTHOR = "maiha"
|
9
|
+
EMAIL = "maiha@wota.jp"
|
10
|
+
HOMEPAGE = "http://github.com/maiha/crb"
|
11
|
+
SUMMARY = "A cucumber console that offers cucumber world enviroment on irb"
|
12
|
+
GEM_VERSION = "0.1"
|
13
|
+
|
14
|
+
spec = Gem::Specification.new do |s|
|
15
|
+
s.rubyforge_project = 'asakusarb'
|
16
|
+
s.executables = ["crb"]
|
17
|
+
s.name = GEM_NAME
|
18
|
+
s.version = GEM_VERSION
|
19
|
+
s.platform = Gem::Platform::RUBY
|
20
|
+
s.has_rdoc = true
|
21
|
+
s.extra_rdoc_files = ["README", "MIT-LICENSE"]
|
22
|
+
s.summary = SUMMARY
|
23
|
+
s.description = s.summary
|
24
|
+
s.author = AUTHOR
|
25
|
+
s.email = EMAIL
|
26
|
+
s.homepage = HOMEPAGE
|
27
|
+
s.add_dependency('cucumber', '>= 0.3.9')
|
28
|
+
s.add_dependency('webrat', '>= 0.4.4')
|
29
|
+
s.require_path = 'lib'
|
30
|
+
s.files = %w(MIT-LICENSE README Rakefile) + Dir.glob("{lib,spec,app,public,stubs}/**/*")
|
31
|
+
end
|
32
|
+
|
33
|
+
Rake::GemPackageTask.new(spec) do |pkg|
|
34
|
+
pkg.gem_spec = spec
|
35
|
+
end
|
36
|
+
|
37
|
+
desc "Install the gem"
|
38
|
+
task :install do
|
39
|
+
Merb::RakeHelper.install(GEM_NAME, :version => GEM_VERSION)
|
40
|
+
end
|
41
|
+
|
42
|
+
desc "Uninstall the gem"
|
43
|
+
task :uninstall do
|
44
|
+
Merb::RakeHelper.uninstall(GEM_NAME, :version => GEM_VERSION)
|
45
|
+
end
|
46
|
+
|
47
|
+
desc "Create a gemspec file"
|
48
|
+
task :gemspec do
|
49
|
+
File.open("#{GEM_NAME}.gemspec", "w") do |file|
|
50
|
+
file.puts spec.to_ruby
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
require 'spec/rake/spectask'
|
55
|
+
#require 'merb-core/test/tasks/spectasks'
|
56
|
+
desc 'Default: run spec examples'
|
57
|
+
task :default => 'spec'
|
data/bin/crb
ADDED
data/lib/crb.rb
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
|
2
|
+
require 'cucumber'
|
3
|
+
require 'cucumber/formatter/unicode'
|
4
|
+
require 'irb'
|
5
|
+
|
6
|
+
class CRB < Cucumber::Cli::Main
|
7
|
+
extend IRB
|
8
|
+
extend Cucumber::World
|
9
|
+
|
10
|
+
class << self
|
11
|
+
def world
|
12
|
+
step_mother.current_world
|
13
|
+
end
|
14
|
+
|
15
|
+
def start(args)
|
16
|
+
IRB.setup(__FILE__)
|
17
|
+
ws = WorkSpace.new(binding)
|
18
|
+
irb = Irb.new(ws)
|
19
|
+
IRB.module_eval do
|
20
|
+
@CONF[:MAIN_CONTEXT] = irb.context
|
21
|
+
end
|
22
|
+
|
23
|
+
execute(args)
|
24
|
+
step_mother.send(:new_world!)
|
25
|
+
|
26
|
+
alias_adverbs
|
27
|
+
enable_session
|
28
|
+
|
29
|
+
trap("SIGINT") do
|
30
|
+
irb.signal_handle
|
31
|
+
end
|
32
|
+
|
33
|
+
catch(:IRB_EXIT) do
|
34
|
+
irb.eval_input
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def enable_session(mode = nil)
|
39
|
+
require 'webrat'
|
40
|
+
require 'webrat/core/matchers'
|
41
|
+
|
42
|
+
extend ::Webrat::Methods
|
43
|
+
extend ::Webrat::Matchers
|
44
|
+
|
45
|
+
if mode || !Webrat.configure.mode
|
46
|
+
Webrat.configure.mode = (mode || :mechanize)
|
47
|
+
if Webrat.configure.mode == :mechanize
|
48
|
+
webrat_session.mechanize.user_agent_alias = 'Windows Mozilla'
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
%w{response post}.each do |m|
|
53
|
+
unless respond_to?(m, true)
|
54
|
+
instance_eval <<-EOF
|
55
|
+
def self.#{m}(*args, &blk)
|
56
|
+
webrat.#{m}(*args, &blk)
|
57
|
+
end
|
58
|
+
EOF
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def alias_adverbs
|
64
|
+
hash = Cucumber.keyword_hash
|
65
|
+
keywords = %w{given when then and but}.map{|keyword| hash[keyword].split('|')}.flatten
|
66
|
+
keywords.each do |name|
|
67
|
+
instance_eval <<-EOF
|
68
|
+
def CRB.#{name}(*args, &blk)
|
69
|
+
world.#{name}(*args, &blk)
|
70
|
+
end
|
71
|
+
EOF
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def execute!(step_mother)
|
77
|
+
configuration.load_language
|
78
|
+
step_mother.options = configuration.options
|
79
|
+
|
80
|
+
require_files
|
81
|
+
enable_diffing
|
82
|
+
|
83
|
+
features = load_plain_text_features
|
84
|
+
|
85
|
+
visitor = configuration.build_formatter_broadcaster(step_mother)
|
86
|
+
step_mother.visitor = visitor # Needed to support World#announce
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
CRB.step_mother = self
|
metadata
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: maiha-crb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: "0.1"
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- maiha
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-06-05 00:00:00 -07:00
|
13
|
+
default_executable: crb
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: cucumber
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.3.9
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: webrat
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.4.4
|
34
|
+
version:
|
35
|
+
description: A cucumber console that offers cucumber world enviroment on irb
|
36
|
+
email: maiha@wota.jp
|
37
|
+
executables:
|
38
|
+
- crb
|
39
|
+
extensions: []
|
40
|
+
|
41
|
+
extra_rdoc_files:
|
42
|
+
- README
|
43
|
+
- MIT-LICENSE
|
44
|
+
files:
|
45
|
+
- MIT-LICENSE
|
46
|
+
- README
|
47
|
+
- Rakefile
|
48
|
+
- lib/crb.rb
|
49
|
+
- bin/crb
|
50
|
+
has_rdoc: false
|
51
|
+
homepage: http://github.com/maiha/crb
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options: []
|
54
|
+
|
55
|
+
require_paths:
|
56
|
+
- lib
|
57
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: "0"
|
62
|
+
version:
|
63
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: "0"
|
68
|
+
version:
|
69
|
+
requirements: []
|
70
|
+
|
71
|
+
rubyforge_project: asakusarb
|
72
|
+
rubygems_version: 1.2.0
|
73
|
+
signing_key:
|
74
|
+
specification_version: 3
|
75
|
+
summary: A cucumber console that offers cucumber world enviroment on irb
|
76
|
+
test_files: []
|
77
|
+
|