ariete 0.1.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +4 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +7 -0
  5. data/Gemfile +4 -0
  6. data/Gemfile.lock +31 -0
  7. data/{LICENSE → LICENSE.txt} +1 -1
  8. data/README.md +56 -55
  9. data/Rakefile +4 -16
  10. data/ariete.gemspec +23 -0
  11. data/lib/ariete.rb +6 -26
  12. data/lib/ariete/version.rb +3 -0
  13. data/spec/ariete_spec.rb +37 -0
  14. data/spec/spec_helper.rb +2 -0
  15. metadata +70 -80
  16. data/CHANGELOG.md +0 -7
  17. data/CHANGELOG_jp.md +0 -7
  18. data/README_jp.md +0 -74
  19. data/doc/Ariete.html +0 -230
  20. data/doc/CaptureStdTest.html +0 -254
  21. data/doc/LICENSE.html +0 -105
  22. data/doc/Rakefile.html +0 -106
  23. data/doc/created.rid +0 -5
  24. data/doc/images/add.png +0 -0
  25. data/doc/images/brick.png +0 -0
  26. data/doc/images/brick_link.png +0 -0
  27. data/doc/images/bug.png +0 -0
  28. data/doc/images/bullet_black.png +0 -0
  29. data/doc/images/bullet_toggle_minus.png +0 -0
  30. data/doc/images/bullet_toggle_plus.png +0 -0
  31. data/doc/images/date.png +0 -0
  32. data/doc/images/delete.png +0 -0
  33. data/doc/images/find.png +0 -0
  34. data/doc/images/loadingAnimation.gif +0 -0
  35. data/doc/images/macFFBgHack.png +0 -0
  36. data/doc/images/package.png +0 -0
  37. data/doc/images/page_green.png +0 -0
  38. data/doc/images/page_white_text.png +0 -0
  39. data/doc/images/page_white_width.png +0 -0
  40. data/doc/images/plugin.png +0 -0
  41. data/doc/images/ruby.png +0 -0
  42. data/doc/images/tag_blue.png +0 -0
  43. data/doc/images/tag_green.png +0 -0
  44. data/doc/images/transparent.png +0 -0
  45. data/doc/images/wrench.png +0 -0
  46. data/doc/images/wrench_orange.png +0 -0
  47. data/doc/images/zoom.png +0 -0
  48. data/doc/index.html +0 -82
  49. data/doc/js/darkfish.js +0 -153
  50. data/doc/js/jquery.js +0 -18
  51. data/doc/js/navigation.js +0 -142
  52. data/doc/js/search.js +0 -94
  53. data/doc/js/search_index.js +0 -1
  54. data/doc/js/searcher.js +0 -228
  55. data/doc/rdoc.css +0 -543
  56. data/doc/table_of_contents.html +0 -69
  57. data/test/tb_capture_std.rb +0 -24
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 67e5520cfbf95af12618034a3f9d792cafd393c4
4
+ data.tar.gz: 87e1641f107b1a79e9fea63b842079fefaa1b236
5
+ SHA512:
6
+ metadata.gz: 93c9ea004d9382bf677d727b4db87cb9de837330241a6527b2c4a1534888c44556408429ba8deb08c34aae0f78afee6988bd0b48c9c7b6636415c22cd8995913
7
+ data.tar.gz: 1b7cd7145f59092778ada592d9133999221fab96410c3884fb307ab1aab2b9cd7c873ede9eed0eea182f1ee072dd3f2342026d8279565b857d4e791e00a79b66
@@ -0,0 +1,4 @@
1
+ pkg/
2
+ doc/
3
+ vendor/bundle
4
+ .DS_Store
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.3
4
+ notifications:
5
+ on_success: change
6
+ on_failure: change
7
+ on_start: false
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rbtclk.gemspec
4
+ gemspec
@@ -0,0 +1,31 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ariete (0.3.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ diff-lcs (1.2.5)
10
+ rake (10.3.2)
11
+ rspec (3.1.0)
12
+ rspec-core (~> 3.1.0)
13
+ rspec-expectations (~> 3.1.0)
14
+ rspec-mocks (~> 3.1.0)
15
+ rspec-core (3.1.7)
16
+ rspec-support (~> 3.1.0)
17
+ rspec-expectations (3.1.2)
18
+ diff-lcs (>= 1.2.0, < 2.0)
19
+ rspec-support (~> 3.1.0)
20
+ rspec-mocks (3.1.3)
21
+ rspec-support (~> 3.1.0)
22
+ rspec-support (3.1.2)
23
+
24
+ PLATFORMS
25
+ ruby
26
+
27
+ DEPENDENCIES
28
+ ariete!
29
+ bundler (~> 1.7)
30
+ rake (~> 10.0)
31
+ rspec
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012 Moza USANE
1
+ Copyright (c) 2014 Moza USANE
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
4
 
data/README.md CHANGED
@@ -1,74 +1,75 @@
1
- Ariete STDOUT & STDERR Capture Module
2
- =======================================
1
+ # Ariete
3
2
 
4
- ## Introduction
3
+ Ariete is a module that captures $stdout($stderr) and return as String.
4
+ It is useful on an unit test.
5
5
 
6
- Ariete STDOUT & STDERR Capture Module is a module that captures $stdout($stderr) and return as String. Ariete is useful on unit test.
6
+ ## Requirement
7
7
 
8
- **usage**
8
+ - Ruby 2.0 or later.
9
9
 
10
- require "test/unit"
11
- require "ariete"
12
- require_relative "klass"
10
+ ## Installation
13
11
 
14
- class KlassTest < Test::Unit::TestCase
15
- include Ariete
12
+ ```shell
13
+ $ (sudo) gem install 'ariete'
14
+ ```
16
15
 
17
- def test_stdout
18
- result = capture_stdout {Klass.output_out("Ariete")}
19
- assert_equal("Ariete is a kind of rabbit.", result)
20
- end
16
+ ## Usage
21
17
 
22
- def test_stderr
23
- result = capture_stderr {Klass.output_err("Ariete")}
24
- assert_equal("Ariete means 'Lop' in Italian.", result)
25
- end
26
- end
18
+ ### rspec
27
19
 
28
- ## Operation Environment
20
+ #### klass.rb
29
21
 
30
- We checked good operation within following environment.
22
+ ```ruby
23
+ class Klass
24
+ class << self
25
+ def output_out
26
+ puts "Ariete is a kind of rabbit."
27
+ end
31
28
 
32
- - Linux(openSUSE 12.2)・Mac OS X 10.8.2
33
- - Ruby 1.9.3
29
+ def output_err
30
+ warn "Ariete means 'Lop' in Italian."
31
+ end
32
+ end
33
+ end
34
+ ```
34
35
 
35
- ## Architectonics
36
+ #### klass_spec.rb
36
37
 
37
- - **bin**
38
- - **doc** :: Documents generated by rdoc
39
- - **lib**
40
- - **ariete.rb** :: Main unit of Ariete
41
- - **LICENSE**
42
- - **Rakefile** :: Rakefile that is used to generate gem file
43
- - **README.md**
44
- - **README_jp.md**
45
- - **test** :: Unit tests
46
- - **tb_capture_std.rb** :: Unit test for Ariete
47
-
48
- ## Install
38
+ ```ruby
39
+ require "ariete"
40
+ require_relative "klass"
49
41
 
50
- Download ariete-x.y.z.gem, then execute following command to install Ariete.
42
+ RSpec.describe Klass do
43
+ include Ariete
51
44
 
52
- `$ sudo gem install ariete-x.y.z.gem`
45
+ # You can use without 'Ariete.' if you include Ariete.
46
+ describe ".output_out" do
47
+ subject { capture_stdout { Klass.output_out } }
48
+ it { expect(subject).to eq "Ariete is a kind of rabbit.\n" }
49
+ end
53
50
 
54
- On the other hand, you can install from RubyGems.org to use following command.
51
+ describe ".output_err" do
52
+ subject { capture_stderr { Klass.output_err } }
53
+ it { expect(subject).to eq "Ariete means 'Lop' in Italian.\n" }
54
+ end
55
55
 
56
- `$ sudo gem install ariete`
56
+ # Also you can use as 'Ariete.capture_xxx'
57
+ describe ".output_out" do
58
+ subject { Ariete.capture_stdout { Klass.output_out } }
59
+ it { expect(subject).to eq "Ariete is a kind of rabbit.\n" }
60
+ end
57
61
 
58
- ## Sample code
62
+ describe ".output_err" do
63
+ subject { Ariete.capture_stderr { Klass.output_err } }
64
+ it { expect(subject).to eq "Ariete means 'Lop' in Italian.\n" }
65
+ end
66
+ end
67
+ ```
59
68
 
60
- See tb_capture_std.rb file. It is an unit test code, and it doubles with sample code.
69
+ ## Contributing
61
70
 
62
- ## API document
63
-
64
- See following website: [http://quellencode.org/ariete-doc/](http://quellencode.org/ariete-doc/ "")
65
-
66
- ## License
67
-
68
- Hakto is distributed with MIT License. See the LICENSE file to read the detail of license.
69
-
70
- ## About Author
71
-
72
- Moza USANE
73
- [http://blog.quellencode.org/](http://blog.quellencode.org/ "")
74
- mozamimy@quellencode.org
71
+ 1. Fork it ( https://github.com/mozamimy/ariete/fork )
72
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
73
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
74
+ 4. Push to the branch (`git push origin my-new-feature`)
75
+ 5. Create a new Pull Request
data/Rakefile CHANGED
@@ -1,18 +1,6 @@
1
- require "rake/gempackagetask"
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
2
3
 
3
- spec = Gem::Specification.new do |s|
4
- s.name = "ariete"
5
- s.summary = "Ariete STDOUT & STDERR Capture Module."
6
- s.description = File.read(File.join(File.dirname(__FILE__), "README.md"))
7
- s.version = "0.1.0"
8
- s.author = "Moza USANE"
9
- s.email = "mozamimy@quellencode.org"
10
- s.homepage = "http://quellencode.org/"
11
- s.platform = Gem::Platform::RUBY
12
- s.required_ruby_version = ">=1.9"
13
- s.files = Dir["**/**"]
14
- s.test_files = Dir["test/test*.rb"]
15
- s.has_rdoc = true
16
- end
4
+ RSpec::Core::RakeTask.new(:spec)
17
5
 
18
- Rake::GemPackageTask.new(spec).define
6
+ task default: :spec
@@ -0,0 +1,23 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'ariete/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "ariete"
7
+ spec.version = Ariete::VERSION
8
+ spec.authors = ["Moza USANE"]
9
+ spec.email = ["mozamimy@quellencode.org"]
10
+ spec.summary = %q{Ariete is capturing module for STDOUT & STDERR.}
11
+ spec.description = %q{Ariete is capturing module for STDOUT & STDERR.}
12
+ spec.homepage = "http://quellencode.org/"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.7"
21
+ spec.add_development_dependency "rake", "~> 10.0"
22
+ spec.add_development_dependency "rspec"
23
+ end
@@ -1,33 +1,12 @@
1
- #!/usr/bin/env ruby
2
- # encoding: utf-8
1
+ # Ariete
2
+ # Copyright (c) 2014 Moza USANE
3
+ # This software is released under the MIT License.
4
+ # http://opensource.org/licenses/mit-license.php
3
5
 
4
6
  require "stringio"
5
7
 
6
- # Ariete STDOUT & STDERR Capture Module
7
- # Author:: Moza USANE (mailto:mozamimy@quellencode.org)
8
- # Copyright:: Copyright (c) 2012 Moza USANE
9
- # License:: MIT License (see the LICENSE file)
10
8
  module Ariete
11
-
12
9
  ["stdout", "stderr"].each do |name|
13
- ##
14
- # :method: capture_stdout
15
- # Capture STDOUT's output and return as String.
16
- # ==== Args
17
- # &block :: a block that you want to capture
18
- # ==== Return
19
- # Captured string
20
-
21
- ##
22
- # :method: capture_stderr
23
- # Capture STDERR's output and return as String.
24
- # ==== Args
25
- # &block :: a block that you want to capture
26
- # ==== Return
27
- # Captured string
28
-
29
- ##
30
-
31
10
  define_method("capture_#{name}") do |*args, &block|
32
11
  original = eval("$#{name}")
33
12
  eval("$#{name} = StringIO.new")
@@ -41,6 +20,7 @@ module Ariete
41
20
 
42
21
  ret_str
43
22
  end
44
- end
45
23
 
24
+ module_function "capture_#{name}"
25
+ end
46
26
  end
@@ -0,0 +1,3 @@
1
+ module Ariete
2
+ VERSION = "0.3.0"
3
+ end
@@ -0,0 +1,37 @@
1
+ # Ariete
2
+ # Copyright (c) 2014 Moza USANE
3
+ # This software is released under the MIT License.
4
+ # http://opensource.org/licenses/mit-license.php
5
+
6
+ require "spec_helper"
7
+
8
+ RSpec.describe Ariete do
9
+ include Ariete
10
+
11
+ def output
12
+ puts "Ariete is a kind of rabbit."
13
+ warn "Ariete means 'Lop' in Italian."
14
+ end
15
+
16
+ describe "#capture_stdout" do
17
+ subject { capture_stdout { output } }
18
+ it { expect(subject).to eq "Ariete is a kind of rabbit.\n" }
19
+ end
20
+
21
+ describe "#capture_stderr" do
22
+ subject { capture_stderr { output } }
23
+ it { expect(subject).to eq "Ariete means 'Lop' in Italian.\n" }
24
+ end
25
+
26
+ describe "module_function" do
27
+ describe "#capture_stdout" do
28
+ subject { Ariete.capture_stdout { output } }
29
+ it { expect(subject).to eq "Ariete is a kind of rabbit.\n" }
30
+ end
31
+
32
+ describe "#capture_stderr" do
33
+ subject { Ariete.capture_stderr { output } }
34
+ it { expect(subject).to eq "Ariete means 'Lop' in Italian.\n" }
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,2 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'ariete'
metadata CHANGED
@@ -1,111 +1,101 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ariete
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
5
- prerelease:
4
+ version: 0.3.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Moza USANE
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-12-12 00:00:00.000000000 Z
13
- dependencies: []
14
- description: ! "Ariete STDOUT & STDERR Capture Module\n=======================================\n\n##
15
- Introduction\n\nAriete STDOUT & STDERR Capture Module is a module that captures
16
- $stdout($stderr) and return as String. Ariete is useful on unit test.\n\n**usage**\n\n
17
- \ require \"test/unit\"\n require \"ariete\"\n require_relative \"klass\"\n\n
18
- \ class KlassTest < Test::Unit::TestCase\n include Ariete\n\n def test_stdout\n
19
- \ result = capture_stdout {Klass.output_out(\"Ariete\")}\n assert_equal(\"Ariete
20
- is a kind of rabbit.\", result)\n end\n\n def test_stderr\n result
21
- = capture_stderr {Klass.output_err(\"Ariete\")}\n assert_equal(\"Ariete means
22
- 'Lop' in Italian.\", result)\n end\n end \n\n## Operation Environment\n\nWe
23
- checked good operation within following environment.\n\n- Linux(openSUSE 12.2)・Mac
24
- OS X 10.8.2\n- Ruby 1.9.3\n\n## Architectonics\n\n- **bin**\n- **doc** :: Documents
25
- generated by rdoc\n- **lib**\n - **ariete.rb** :: Main unit of Ariete\n- **LICENSE**\n-
26
- **Rakefile** :: Rakefile that is used to generate gem file\n- **README.md**\n- **README_jp.md**\n-
27
- **test** :: Unit tests\n - **tb_capture_std.rb** :: Unit test for Ariete\n \n##
28
- Install\n\nDownload ariete-x.y.z.gem, then execute following command to install
29
- Ariete.\n\n`$ sudo gem install ariete-x.y.z.gem`\n\nOn the other hand, you can install
30
- from RubyGems.org to use following command.\n\n`$ sudo gem install ariete`\n\n##
31
- Sample code\n\nSee tb_capture_std.rb file. It is an unit test code, and it doubles
32
- with sample code.\n\n## API document\n\nSee following website: [http://quellencode.org/ariete-doc/](http://quellencode.org/ariete-doc/
33
- \"\")\n\n## License\n\nHakto is distributed with MIT License. See the LICENSE file
34
- to read the detail of license.\n\n## About Author\n\nMoza USANE \n[http://blog.quellencode.org/](http://blog.quellencode.org/
35
- \"\") \nmozamimy@quellencode.org"
36
- email: mozamimy@quellencode.org
11
+ date: 2014-11-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Ariete is capturing module for STDOUT & STDERR.
56
+ email:
57
+ - mozamimy@quellencode.org
37
58
  executables: []
38
59
  extensions: []
39
60
  extra_rdoc_files: []
40
61
  files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - ".travis.yml"
65
+ - Gemfile
66
+ - Gemfile.lock
67
+ - LICENSE.txt
41
68
  - README.md
42
- - CHANGELOG_jp.md
43
69
  - Rakefile
44
- - test/tb_capture_std.rb
45
- - README_jp.md
70
+ - ariete.gemspec
46
71
  - lib/ariete.rb
47
- - doc/created.rid
48
- - doc/rdoc.css
49
- - doc/Ariete.html
50
- - doc/CaptureStdTest.html
51
- - doc/images/plugin.png
52
- - doc/images/zoom.png
53
- - doc/images/page_green.png
54
- - doc/images/bullet_toggle_plus.png
55
- - doc/images/wrench.png
56
- - doc/images/brick.png
57
- - doc/images/delete.png
58
- - doc/images/transparent.png
59
- - doc/images/bug.png
60
- - doc/images/ruby.png
61
- - doc/images/loadingAnimation.gif
62
- - doc/images/page_white_width.png
63
- - doc/images/macFFBgHack.png
64
- - doc/images/bullet_black.png
65
- - doc/images/wrench_orange.png
66
- - doc/images/brick_link.png
67
- - doc/images/package.png
68
- - doc/images/tag_blue.png
69
- - doc/images/bullet_toggle_minus.png
70
- - doc/images/page_white_text.png
71
- - doc/images/date.png
72
- - doc/images/find.png
73
- - doc/images/add.png
74
- - doc/images/tag_green.png
75
- - doc/js/searcher.js
76
- - doc/js/navigation.js
77
- - doc/js/darkfish.js
78
- - doc/js/search_index.js
79
- - doc/js/search.js
80
- - doc/js/jquery.js
81
- - doc/LICENSE.html
82
- - doc/table_of_contents.html
83
- - doc/Rakefile.html
84
- - doc/index.html
85
- - CHANGELOG.md
86
- - LICENSE
72
+ - lib/ariete/version.rb
73
+ - spec/ariete_spec.rb
74
+ - spec/spec_helper.rb
87
75
  homepage: http://quellencode.org/
88
- licenses: []
76
+ licenses:
77
+ - MIT
78
+ metadata: {}
89
79
  post_install_message:
90
80
  rdoc_options: []
91
81
  require_paths:
92
82
  - lib
93
83
  required_ruby_version: !ruby/object:Gem::Requirement
94
- none: false
95
84
  requirements:
96
- - - ! '>='
85
+ - - ">="
97
86
  - !ruby/object:Gem::Version
98
- version: '1.9'
87
+ version: '0'
99
88
  required_rubygems_version: !ruby/object:Gem::Requirement
100
- none: false
101
89
  requirements:
102
- - - ! '>='
90
+ - - ">="
103
91
  - !ruby/object:Gem::Version
104
92
  version: '0'
105
93
  requirements: []
106
94
  rubyforge_project:
107
- rubygems_version: 1.8.23
95
+ rubygems_version: 2.2.2
108
96
  signing_key:
109
- specification_version: 3
110
- summary: Ariete STDOUT & STDERR Capture Module.
111
- test_files: []
97
+ specification_version: 4
98
+ summary: Ariete is capturing module for STDOUT & STDERR.
99
+ test_files:
100
+ - spec/ariete_spec.rb
101
+ - spec/spec_helper.rb