moro-miso 0.0.3
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/ChangeLog +13 -0
- data/README.rdoc +32 -0
- data/Rakefile +153 -0
- data/bin/miso-cheat +44 -0
- data/lib/miso.rb +4 -0
- data/rails_generators/miso/miso_generator.rb +22 -0
- data/rails_generators/miso/templates/web_extra_ja_steps.rb +25 -0
- data/rails_generators/miso/templates/webrat_ja_steps.rb +116 -0
- metadata +72 -0
data/ChangeLog
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
== 0.0.3 / 2009-05-24
|
2
|
+
|
3
|
+
* add cheat command miso-cheat, display provided steps.
|
4
|
+
|
5
|
+
== 0.0.2 / 2009-05-24
|
6
|
+
|
7
|
+
* add optional web steps to web_ext_ja_steps.rb
|
8
|
+
|
9
|
+
== 0.0.1 / 2009-05-24
|
10
|
+
|
11
|
+
* initial release
|
12
|
+
* generates japanese translated webrat_steps.rb as webrat_steps_ja.rb
|
13
|
+
|
data/README.rdoc
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
|
2
|
+
= miso
|
3
|
+
|
4
|
+
|
5
|
+
== Description
|
6
|
+
|
7
|
+
Dip cucumber into me.
|
8
|
+
|
9
|
+
rails generator which generate Japanese translated 'webrat_steps.rb' and some usefull steps.
|
10
|
+
|
11
|
+
miso is a japanese popular seasoning.
|
12
|
+
Many japanese eat fresh cucumber with miso, soybean paste.
|
13
|
+
|
14
|
+
== Installation
|
15
|
+
|
16
|
+
=== Archive Installation
|
17
|
+
|
18
|
+
rake install
|
19
|
+
|
20
|
+
=== Gem Installation
|
21
|
+
|
22
|
+
gem install moro-miso
|
23
|
+
|
24
|
+
== Synopsis
|
25
|
+
|
26
|
+
ruby script/generate miso
|
27
|
+
|
28
|
+
== Copyright
|
29
|
+
|
30
|
+
Author:: MOROHASHI Kyosuke <moronatural@gmail.com>
|
31
|
+
Copyright:: Copyright (c) 2009 MOROHASHI Kyosuke
|
32
|
+
License:: MIT
|
data/Rakefile
ADDED
@@ -0,0 +1,153 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'rake/clean'
|
4
|
+
require 'rake/testtask'
|
5
|
+
require 'rake/packagetask'
|
6
|
+
require 'rake/gempackagetask'
|
7
|
+
require 'rake/rdoctask'
|
8
|
+
require 'fileutils'
|
9
|
+
require 'spec/rake/spectask'
|
10
|
+
require 'lib/miso'
|
11
|
+
include FileUtils
|
12
|
+
|
13
|
+
use_rubyforge = false
|
14
|
+
NAME = "miso"
|
15
|
+
AUTHOR = "MOROHASHI Kyosuke"
|
16
|
+
EMAIL = "moronatural@gmail.com"
|
17
|
+
DESCRIPTION = "dip cukes into me."
|
18
|
+
|
19
|
+
if use_rubyforge
|
20
|
+
require 'rake/contrib/rubyforgepublisher'
|
21
|
+
require 'rake/contrib/sshpublisher'
|
22
|
+
RUBYFORGE_PROJECT = "miso"
|
23
|
+
HOMEPAGE = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
|
24
|
+
else
|
25
|
+
HOMEPAGE = "http://github.com/moro/#{NAME}/"
|
26
|
+
end
|
27
|
+
BIN_FILES = %w(miso-cheat )
|
28
|
+
|
29
|
+
VERS = Miso::Version
|
30
|
+
REV = File.read(".svn/entries")[/committed-rev="(d+)"/, 1] rescue nil
|
31
|
+
CLEAN.include ['**/.*.sw?', '*.gem', '.config']
|
32
|
+
RDOC_OPTS = [
|
33
|
+
'--title', "#{NAME} documentation",
|
34
|
+
"--charset", "utf-8",
|
35
|
+
"--opname", "index.html",
|
36
|
+
"--line-numbers",
|
37
|
+
"--main", "README.rdoc",
|
38
|
+
"--inline-source",
|
39
|
+
]
|
40
|
+
|
41
|
+
task :default => [:spec]
|
42
|
+
task :package => [:clean]
|
43
|
+
|
44
|
+
desc "Run all specs in spec directory"
|
45
|
+
Spec::Rake::SpecTask.new(:spec) do |t|
|
46
|
+
t.spec_opts = %w[--colour --format progress --loadby --reverse]
|
47
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
48
|
+
end
|
49
|
+
|
50
|
+
spec = Gem::Specification.new do |s|
|
51
|
+
s.name = NAME
|
52
|
+
s.version = VERS
|
53
|
+
s.platform = Gem::Platform::RUBY
|
54
|
+
s.has_rdoc = true
|
55
|
+
s.extra_rdoc_files = ["README.rdoc", "ChangeLog"]
|
56
|
+
s.rdoc_options += RDOC_OPTS + ['--exclude', '^(examples|extras)/']
|
57
|
+
s.summary = DESCRIPTION
|
58
|
+
s.description = DESCRIPTION
|
59
|
+
s.author = AUTHOR
|
60
|
+
s.email = EMAIL
|
61
|
+
s.homepage = HOMEPAGE
|
62
|
+
s.executables = BIN_FILES
|
63
|
+
s.rubyforge_project = RUBYFORGE_PROJECT if use_rubyforge
|
64
|
+
s.bindir = "bin"
|
65
|
+
s.require_path = "lib"
|
66
|
+
s.test_files = Dir["test/*_test.rb"]
|
67
|
+
|
68
|
+
#s.add_dependency('activesupport', '>=1.3.1')
|
69
|
+
#s.required_ruby_version = '>= 1.8.2'
|
70
|
+
|
71
|
+
s.files = %w(README.rdoc ChangeLog Rakefile) +
|
72
|
+
Dir.glob("{bin,doc,test,lib,templates,generator,extras,website,script,rails_generators}/**/*.rb") +
|
73
|
+
Dir.glob("ext/**/*.{h,c,rb}") +
|
74
|
+
Dir.glob("examples/**/*.rb") +
|
75
|
+
Dir.glob("tools/*.rb") +
|
76
|
+
Dir.glob("rails/*.rb")
|
77
|
+
|
78
|
+
s.extensions = FileList["ext/**/extconf.rb"].to_a
|
79
|
+
end
|
80
|
+
|
81
|
+
Rake::GemPackageTask.new(spec) do |p|
|
82
|
+
p.need_tar = true
|
83
|
+
p.gem_spec = spec
|
84
|
+
end
|
85
|
+
|
86
|
+
task :install do
|
87
|
+
name = "#{NAME}-#{VERS}.gem"
|
88
|
+
sh %{rake package}
|
89
|
+
sh %{gem install pkg/#{name}}
|
90
|
+
end
|
91
|
+
|
92
|
+
task :uninstall => [:clean] do
|
93
|
+
sh %{gem uninstall #{NAME}}
|
94
|
+
end
|
95
|
+
|
96
|
+
desc 'Show information about the gem.'
|
97
|
+
task :debug_gem do
|
98
|
+
puts spec.to_ruby
|
99
|
+
end
|
100
|
+
|
101
|
+
desc 'Update gem spec'
|
102
|
+
task :gemspec do
|
103
|
+
open("#{NAME}.gemspec", 'w').write spec.to_ruby
|
104
|
+
end
|
105
|
+
|
106
|
+
|
107
|
+
Rake::RDocTask.new do |rdoc|
|
108
|
+
rdoc.rdoc_dir = 'html'
|
109
|
+
rdoc.options += RDOC_OPTS
|
110
|
+
rdoc.template = "resh"
|
111
|
+
#rdoc.template = "#{ENV['template']}.rb" if ENV['template']
|
112
|
+
if ENV['DOC_FILES']
|
113
|
+
rdoc.rdoc_files.include(ENV['DOC_FILES'].split(/,\s*/))
|
114
|
+
else
|
115
|
+
rdoc.rdoc_files.include('README', 'ChangeLog')
|
116
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
117
|
+
rdoc.rdoc_files.include('ext/**/*.c')
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
if use_rubyforge
|
122
|
+
desc "Publish to RubyForge"
|
123
|
+
task :rubyforge => [:rdoc, :package] do
|
124
|
+
require 'rubyforge'
|
125
|
+
Rake::RubyForgePublisher.new(RUBYFORGE_PROJECT, 'moro').upload
|
126
|
+
end
|
127
|
+
|
128
|
+
desc 'Package and upload the release to rubyforge.'
|
129
|
+
task :release => [:clean, :package] do |t|
|
130
|
+
v = ENV["VERSION"] or abort "Must supply VERSION=x.y.z"
|
131
|
+
abort "Versions don't match #{v} vs #{VERS}" unless v == VERS
|
132
|
+
pkg = "pkg/#{NAME}-#{VERS}"
|
133
|
+
|
134
|
+
require 'rubyforge'
|
135
|
+
rf = RubyForge.new.configure
|
136
|
+
puts "Logging in"
|
137
|
+
rf.login
|
138
|
+
|
139
|
+
c = rf.userconfig
|
140
|
+
# c["release_notes"] = description if description
|
141
|
+
# c["release_changes"] = changes if changes
|
142
|
+
c["preformatted"] = true
|
143
|
+
|
144
|
+
files = [
|
145
|
+
"#{pkg}.tgz",
|
146
|
+
"#{pkg}.gem"
|
147
|
+
].compact
|
148
|
+
|
149
|
+
puts "Releasing #{NAME} v. #{VERS}"
|
150
|
+
rf.add_release RUBYFORGE_PROJECT, NAME, VERS, *files
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
data/bin/miso-cheat
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
#!/bin/env ruby
|
2
|
+
# coding: utf-8
|
3
|
+
# vim:set ft=ruby:
|
4
|
+
|
5
|
+
if RUBY_VERSION < "1.9.0"
|
6
|
+
$KCODE = "u"
|
7
|
+
end
|
8
|
+
|
9
|
+
module Miso
|
10
|
+
class Cheat
|
11
|
+
def initialize
|
12
|
+
@container = {:Given => [], :Then => [], :When => []}
|
13
|
+
end
|
14
|
+
|
15
|
+
def require(*noop); end
|
16
|
+
|
17
|
+
def Given(re, *noop); @container[:Given] << re; end
|
18
|
+
def When(re, *noop); @container[:When] << re; end
|
19
|
+
def Then(re, *noop); @container[:Then] << re; end
|
20
|
+
|
21
|
+
def display
|
22
|
+
[:Given, :When, :Then].each do |type|
|
23
|
+
@container[type].each{|step_re| puts format(type, step_re) }
|
24
|
+
puts # blank line
|
25
|
+
end
|
26
|
+
end
|
27
|
+
private
|
28
|
+
def cleanup(regexp)
|
29
|
+
regexp.to_s.sub(/\A\(\?-mix:(.+)\)\Z/){ $1 }
|
30
|
+
end
|
31
|
+
|
32
|
+
def format(type, re)
|
33
|
+
" #{type.to_s}\t #{cleanup(re)}"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
Dir.glob( File.expand_path("../rails_generators/miso/templates/*_steps.rb", File.dirname(__FILE__)) ) do |step|
|
39
|
+
cheat = Miso::Cheat.new
|
40
|
+
cheat.instance_eval File.read(step)
|
41
|
+
puts "in `%s`:" % step
|
42
|
+
cheat.display
|
43
|
+
end
|
44
|
+
|
data/lib/miso.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
# This generates Japanized useful step definithions for Cucumber with Rails.
|
3
|
+
class MisoGenerator < Rails::Generator::Base
|
4
|
+
def manifest
|
5
|
+
record do |m|
|
6
|
+
m.directory 'features/step_definitions'
|
7
|
+
%w[webrat_ja_steps.rb web_extra_ja_steps.rb].each do |step|
|
8
|
+
m.file step, File.join('features/step_definitions', step)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
protected
|
14
|
+
|
15
|
+
def banner
|
16
|
+
"Usage: #{$0} miso"
|
17
|
+
end
|
18
|
+
|
19
|
+
def add_options!(opt)
|
20
|
+
# do nothing at now
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
Given /^言語は"([^\"]*)"$/ do |lang|
|
2
|
+
header("ACCEPT_LANGUAGE", lang)
|
3
|
+
end
|
4
|
+
|
5
|
+
When /^"([^\"]*)"としてファイル"([^\"]*)"をContent\-Type"([^\"]*)"として添付する$/ do |field, path, content_type|
|
6
|
+
attach_file(field, path, content_type)
|
7
|
+
end
|
8
|
+
|
9
|
+
When /"([^\"]*)"中の"([^\"]*)"リンクをクリックする$/ do |element, label|
|
10
|
+
click_link_within(element, label)
|
11
|
+
end
|
12
|
+
|
13
|
+
When /^テーブル"([^\"]*)"の"([^\"]*)"行目の"([^\"]*)"リンクをクリックする$/ do |css, nth, label|
|
14
|
+
selector = "table.#{css} tbody tr:nth(#{nth})"
|
15
|
+
click_link_within(selector, label)
|
16
|
+
end
|
17
|
+
|
18
|
+
When /^デバッグのため$/ do
|
19
|
+
save_and_open_page
|
20
|
+
end
|
21
|
+
|
22
|
+
Then /^テキストフィールドに"([^\"]*)"と表示されていること$/ do |text|
|
23
|
+
response.should have_tag("input[type=text][value=#{text}]")
|
24
|
+
end
|
25
|
+
|
@@ -0,0 +1,116 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
|
2
|
+
|
3
|
+
# Commonly used webrat steps
|
4
|
+
# http://github.com/brynary/webrat
|
5
|
+
|
6
|
+
visit = lambda{|page_name| visit path_to(page_name) }
|
7
|
+
|
8
|
+
Given(/^"([^\"]*)"ページを表示している$/, &visit)
|
9
|
+
When(/^"([^\"]*)"ページを表示する$/, &visit)
|
10
|
+
|
11
|
+
When /^"([^\"]*)"ボタンをクリックする$/ do |button|
|
12
|
+
click_button(button)
|
13
|
+
end
|
14
|
+
|
15
|
+
When /^"([^\"]*)"リンクをクリックする$/ do |link|
|
16
|
+
click_link(link)
|
17
|
+
end
|
18
|
+
|
19
|
+
When /^"([^\"]*)"に"([^\"]*)"と入力する$/ do |field, value|
|
20
|
+
fill_in(field, :with => value)
|
21
|
+
end
|
22
|
+
|
23
|
+
# opposite order from Engilsh one(original)
|
24
|
+
When /^"([^\"]*)"から"([^\"]*)"を選択する$/ do |field, value|
|
25
|
+
select(value, :from => field)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Use this step in conjunction with Rail's datetime_select helper. For example:
|
29
|
+
# When I select "December 25, 2008 10:00" as the date and time
|
30
|
+
# TODO 日本語が変だ
|
31
|
+
When /^日時として"([^\"]*)"を選択する$/ do |time|
|
32
|
+
select_datetime(time)
|
33
|
+
end
|
34
|
+
|
35
|
+
# Use this step when using multiple datetime_select helpers on a page or
|
36
|
+
# you want to specify which datetime to select. Given the following view:
|
37
|
+
# <%= f.label :preferred %><br />
|
38
|
+
# <%= f.datetime_select :preferred %>
|
39
|
+
# <%= f.label :alternative %><br />
|
40
|
+
# <%= f.datetime_select :alternative %>
|
41
|
+
# The following steps would fill out the form:
|
42
|
+
# When I select "November 23, 2004 11:20" as the "Preferred" date and time
|
43
|
+
# And I select "November 25, 2004 10:30" as the "Alternative" date and time
|
44
|
+
When /^"([^\"]*)"の日時として"([^\"]*)"を選択する$/ do |datetime_label, datetime|
|
45
|
+
select_datetime(datetime, :from => datetime_label)
|
46
|
+
end
|
47
|
+
|
48
|
+
# Use this step in conjunction with Rail's time_select helper. For example:
|
49
|
+
# When I select "2:20PM" as the time
|
50
|
+
# Note: Rail's default time helper provides 24-hour time-- not 12 hour time. Webrat
|
51
|
+
# will convert the 2:20PM to 14:20 and then select it.
|
52
|
+
When /^日付として"([^\"]*)"を選択する$/ do |time|
|
53
|
+
select_time(time)
|
54
|
+
end
|
55
|
+
|
56
|
+
# Use this step when using multiple time_select helpers on a page or you want to
|
57
|
+
# specify the name of the time on the form. For example:
|
58
|
+
# When I select "7:30AM" as the "Gym" time
|
59
|
+
When /^"([^\"]*)"の日付として"([^\"]*)"を選択する$/ do |time_label, time|
|
60
|
+
select_time(time, :from => time_label)
|
61
|
+
end
|
62
|
+
|
63
|
+
# Use this step in conjunction with Rail's date_select helper. For example:
|
64
|
+
# When I select "February 20, 1981" as the date
|
65
|
+
When /^時間として"([^\"]*)"を選択する$/ do |date|
|
66
|
+
select_date(date)
|
67
|
+
end
|
68
|
+
|
69
|
+
# Use this step when using multiple date_select helpers on one page or
|
70
|
+
# you want to specify the name of the date on the form. For example:
|
71
|
+
# When I select "April 26, 1982" as the "Date of Birth" date
|
72
|
+
When /^"([^\"]*)"の時間として"([^\"]*)"を選択する$/ do |date_label, date|
|
73
|
+
select_date(date, :from => date_label)
|
74
|
+
end
|
75
|
+
|
76
|
+
When /^"([^\"]*)"をチェックする$/ do |field|
|
77
|
+
check(field)
|
78
|
+
end
|
79
|
+
|
80
|
+
When /^"([^\"]*)"のチェックを外す$/ do |field|
|
81
|
+
uncheck(field)
|
82
|
+
end
|
83
|
+
|
84
|
+
When /^"([^\"]*)"を選択する$/ do |field|
|
85
|
+
choose(field)
|
86
|
+
end
|
87
|
+
|
88
|
+
# opposite order from Engilsh one(original)
|
89
|
+
When /^"([^\"]*)"としてファイル"([^\"]*)"を選択する$/ do |field, path|
|
90
|
+
attach_file(field, path)
|
91
|
+
end
|
92
|
+
|
93
|
+
Then /^"([^\"]*)"と表示されていること$/ do |text|
|
94
|
+
response.should contain(text)
|
95
|
+
end
|
96
|
+
|
97
|
+
Then /^"([^\"]*)"と表示されていないこと$/ do |text|
|
98
|
+
response.should_not contain(text)
|
99
|
+
end
|
100
|
+
|
101
|
+
Then /^入力項目"([^\"]*)"に"([^\"]*)"と表示されていること$/ do |field, value|
|
102
|
+
field_labeled(field).value.should =~ /#{value}/
|
103
|
+
end
|
104
|
+
|
105
|
+
Then /^入力項目"([^\"]*)"に"([^\"]*)"と表示されていないこと$/ do |field, value|
|
106
|
+
field_labeled(field).value.should_not =~ /#{value}/
|
107
|
+
end
|
108
|
+
|
109
|
+
Then /^"([^\"]*)"がチェックされていること$/ do |label|
|
110
|
+
field_labeled(label).should be_checked
|
111
|
+
end
|
112
|
+
|
113
|
+
Then /^"([^\"]*)"ページを表示していること$/ do |page_name|
|
114
|
+
URI.parse(current_url).path.should == path_to(page_name)
|
115
|
+
end
|
116
|
+
|
metadata
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: moro-miso
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- MOROHASHI Kyosuke
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-05-25 00:00:00 -07:00
|
13
|
+
default_executable: miso-cheat
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: dip cukes into me.
|
17
|
+
email: moronatural@gmail.com
|
18
|
+
executables:
|
19
|
+
- miso-cheat
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README.rdoc
|
24
|
+
- ChangeLog
|
25
|
+
files:
|
26
|
+
- README.rdoc
|
27
|
+
- ChangeLog
|
28
|
+
- Rakefile
|
29
|
+
- lib/miso.rb
|
30
|
+
- rails_generators/miso/miso_generator.rb
|
31
|
+
- rails_generators/miso/templates/web_extra_ja_steps.rb
|
32
|
+
- rails_generators/miso/templates/webrat_ja_steps.rb
|
33
|
+
- bin/miso-cheat
|
34
|
+
has_rdoc: true
|
35
|
+
homepage: http://github.com/moro/miso/
|
36
|
+
post_install_message:
|
37
|
+
rdoc_options:
|
38
|
+
- --title
|
39
|
+
- miso documentation
|
40
|
+
- --charset
|
41
|
+
- utf-8
|
42
|
+
- --opname
|
43
|
+
- index.html
|
44
|
+
- --line-numbers
|
45
|
+
- --main
|
46
|
+
- README.rdoc
|
47
|
+
- --inline-source
|
48
|
+
- --exclude
|
49
|
+
- ^(examples|extras)/
|
50
|
+
require_paths:
|
51
|
+
- lib
|
52
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: "0"
|
57
|
+
version:
|
58
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: "0"
|
63
|
+
version:
|
64
|
+
requirements: []
|
65
|
+
|
66
|
+
rubyforge_project:
|
67
|
+
rubygems_version: 1.2.0
|
68
|
+
signing_key:
|
69
|
+
specification_version: 2
|
70
|
+
summary: dip cukes into me.
|
71
|
+
test_files: []
|
72
|
+
|