fragile 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/.gitignore CHANGED
@@ -1,6 +1,54 @@
1
- *.gem
2
- .bundle
3
- Gemfile.lock
4
- pkg/*
5
- *.swp
6
-
1
+ # rcov generated
2
+ coverage
3
+ coverage.data
4
+
5
+ # rdoc generated
6
+ rdoc
7
+
8
+ # yard generated
9
+ doc
10
+ .yardoc
11
+
12
+ # bundler
13
+ .bundle
14
+
15
+ # jeweler generated
16
+ pkg
17
+
18
+ # Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
19
+ #
20
+ # * Create a file at ~/.gitignore
21
+ # * Include files you want ignored
22
+ # * Run: git config --global core.excludesfile ~/.gitignore
23
+ #
24
+ # After doing this, these files will be ignored in all your git projects,
25
+ # saving you from having to 'pollute' every project you touch with them
26
+ #
27
+ # Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
28
+ #
29
+ # For MacOS:
30
+ #
31
+ .DS_Store
32
+
33
+ # For TextMate
34
+ #*.tmproj
35
+ #tmtags
36
+
37
+ # For emacs:
38
+ #*~
39
+ #\#*
40
+ #.\#*
41
+
42
+ # For vim:
43
+ *.swp
44
+
45
+ # For redcar:
46
+ #.redcar
47
+
48
+ # For rubinius:
49
+ #*.rbc
50
+
51
+ vendor/bundle
52
+ Gemfile.lock
53
+ coverage/
54
+
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format documentation
@@ -0,0 +1,5 @@
1
+ script: "bundle exec rspec ./spec"
2
+ language: ruby
3
+ rvm:
4
+ - 1.9.3
5
+ - 2.0.0
data/Gemfile CHANGED
@@ -1,4 +1,7 @@
1
- source "http://rubygems.org"
2
-
3
- # Specify your gem's dependencies in fragile.gemspec
4
- gemspec
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fragile.gemspec
4
+ gemspec
5
+
6
+ gem 'coveralls', require: false
7
+
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 tnakamura
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,60 +1,61 @@
1
- #Fragile
2
-
3
- **Ruby Pipeline Framework**
4
-
5
- ##Description
6
-
7
- This is a pipeline framework which can extend the functionality by plug-ins.
8
-
9
- ##Get Started
10
-
11
- Installation.
12
-
13
- ```html
14
- gem install fragile
15
- ```
16
-
17
- Specify any recipe which -f option.
18
-
19
- ```html
20
- fragile -f <recipe>
21
- ```
22
-
23
- Example.
24
-
25
- ```html
26
- $ fragile -f recipe/example.rb
27
- ```
28
-
29
- ##What is Recipe?
30
-
31
- The "Recipe" is ruby script.
32
-
33
- ```ruby
34
- require "fragile/plugin/rss_input"
35
- require "fragile/plugin/select_filter"
36
- require "fragile/plugin/console_output"
37
-
38
- pipeline "foobar" do
39
- use "rss_input", :url => "http://d.hatena.ne.jp/griefworker/rss"
40
- use "select_filter", :proc => lambda{|x| x[:title].include?("[Ruby]")}
41
- use "console_output"
42
- end
43
- ```
44
-
45
- ##Environment
46
-
47
- After ruby 1.8.
48
-
49
- ##Author
50
-
51
- **tnakamura**
52
-
53
- + http://d.hatena.ne.jp/griefworker
54
- + https://github.com/tnakamura
55
-
56
- ##License
57
-
58
- Licensed under the MIT LICENSE
59
-
60
-
1
+ # Fragile [![Build Status](https://secure.travis-ci.org/tnakamura/fragile.png)](http://travis-ci.org/tnakamura/fragile) [![Code Climate](https://codeclimate.com/github/tnakamura/fragile.png)](https://codeclimate.com/github/tnakamura/fragile) [![Dependency Status](https://gemnasium.com/tnakamura/fragile.png)](https://gemnasium.com/tnakamura/fragile) [![Coverage Status](https://coveralls.io/repos/tnakamura/fragile/badge.png?branch=master)](https://coveralls.io/r/tnakamura/fragile)
2
+
3
+ Ruby Pipeline Framework
4
+
5
+ ## Description
6
+
7
+ This is a pipeline framework which can extend the functionality by plug-ins.
8
+
9
+ ## Get Started
10
+
11
+ Installation.
12
+
13
+ $ gem install fragile
14
+
15
+ Specify any recipe which -f option.
16
+
17
+ $ fragile -f <recipe> <target>
18
+
19
+ Example.
20
+
21
+ $ fragile -f recipe/example.rb console_sample
22
+
23
+ ## What is Recipe?
24
+
25
+ The "Recipe" is ruby script.
26
+
27
+ ```ruby
28
+ require "fragile/plugin/rss_input"
29
+ require "fragile/plugin/select_filter"
30
+ require "fragile/plugin/console_output"
31
+
32
+ pipeline "console_sample" do
33
+ use "rss_input", :url => "http://d.hatena.ne.jp/griefworker/rss"
34
+ use "select_filter", :proc => lambda{|x| x[:title].include?("[Ruby]")}
35
+ use "console_output"
36
+ end
37
+ ```
38
+
39
+ ## Environment
40
+
41
+ After ruby 1.8.
42
+
43
+ ## Author
44
+
45
+ **tnakamura**
46
+
47
+ * [Blog](http://tnakamura.hatenablog.com/)
48
+ * [GitHub](https://github.com/tnakamura)
49
+
50
+ ## License
51
+
52
+ Licensed under the MIT LICENSE
53
+
54
+ ## Contributing
55
+
56
+ 1. Fork it
57
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
58
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
59
+ 4. Push to the branch (`git push origin my-new-feature`)
60
+ 5. Create new Pull Request
61
+
data/Rakefile CHANGED
@@ -1 +1 @@
1
- require "bundler/gem_tasks"
1
+ require "bundler/gem_tasks"
@@ -1,19 +1,19 @@
1
- #!/usr/bin/env ruby
2
- # coding: utf-8
3
- # Name:: Fragile
4
- # Author:: tnakamura <http://d.hatena.ne.jp/griefworker>
5
- # Created:: Jun 15, 2012
6
- # Updated:: Jun 15, 2012
7
- # Copyright:: tnakamura Copyright (c) 2012
8
- # License:: Licensed under the MIT LICENSE.
9
-
10
- begin
11
- require "rubygems"
12
- gem "fragile"
13
- rescue LoadError
14
- end
15
-
16
- require "fragile"
17
-
18
- Fragile.application.run
19
-
1
+ #!/usr/bin/env ruby
2
+ # coding: utf-8
3
+ # Name:: Fragile
4
+ # Author:: tnakamura <http://d.hatena.ne.jp/griefworker>
5
+ # Created:: Jun 15, 2012
6
+ # Updated:: Jun 15, 2012
7
+ # Copyright:: tnakamura Copyright (c) 2012
8
+ # License:: Licensed under the MIT LICENSE.
9
+
10
+ begin
11
+ require "rubygems"
12
+ gem "fragile"
13
+ rescue LoadError
14
+ end
15
+
16
+ require "fragile"
17
+
18
+ Fragile.application.run
19
+
@@ -1,33 +1,47 @@
1
- # coding: utf-8
2
- require "fragile/plugin/rss_input"
3
- require "fragile/plugin/select_filter"
4
- require "fragile/plugin/map_filter"
5
- require "fragile/plugin/console_output"
6
- require "fragile/plugin/mail_output"
7
-
8
- pipeline :console_sample do
9
- retry_count 4
10
-
11
- use :rss_input, :url => "http://d.hatena.ne.jp/griefworker/rss"
12
- use :select_filter, :proc => lambda{|x| x[:title].include?("[Ruby]")}
13
- use :map_filter, :proc => lambda{|x| x[:title] = x[:title].encode("UTF-8")}
14
- use :console_output
15
- end
16
-
17
- pipeline :mail_sample do
18
- retry_count 4
19
-
20
- use :rss_input, :url => "http://d.hatena.ne.jp/griefworker/rss"
21
- use :select_filter, :proc => lambda{|x| x[:title].include?("[Ruby]")}
22
- use :mail_output, {
23
- :port => 587,
24
- :helo_domain => "gmail.com",
25
- :auth_type => :login,
26
- :smtp => "smtp.gmail.com",
27
- :account => "yourname@gmail.com",
28
- :password => "password",
29
- :from => "from@example.com",
30
- :to => "to@example.com"
31
- }
32
- end
33
-
1
+ # coding: utf-8
2
+ require "fragile/plugin/rss_input"
3
+ require "fragile/plugin/select_filter"
4
+ require "fragile/plugin/map_filter"
5
+ require "fragile/plugin/console_output"
6
+ require "fragile/plugin/mail_output"
7
+ require "fragile/plugin/im_kayac_output"
8
+
9
+ pipeline :console_sample do
10
+ retry_count 4
11
+
12
+ use :rss_input, :url => "http://d.hatena.ne.jp/griefworker/rss"
13
+ use :select_filter, :proc => lambda{|x| x[:title].include?("[Ruby]")}
14
+ use :map_filter, :proc => lambda{|x| x[:title] = x[:title].encode("UTF-8")}
15
+ use :console_output
16
+ end
17
+
18
+ pipeline :mail_sample do
19
+ retry_count 4
20
+
21
+ use :rss_input, :url => "http://d.hatena.ne.jp/griefworker/rss"
22
+ use :select_filter, :proc => lambda{|x| x[:title].include?("[Ruby]")}
23
+ use :mail_output, {
24
+ :port => 587,
25
+ :helo_domain => "gmail.com",
26
+ :auth_type => :login,
27
+ :smtp => "smtp.gmail.com",
28
+ :account => "yourname@gmail.com",
29
+ :password => "password",
30
+ :from => "from@example.com",
31
+ :to => "to@example.com"
32
+ }
33
+ end
34
+
35
+ pipeline :im_kayac_sample do
36
+ retry_count 4
37
+
38
+ use :rss_input, :url => "http://d.hatena.ne.jp/griefworker/rss"
39
+ use :select_filter, :proc => lambda{|x| x[:title].include?("[Ruby]")}
40
+ use :map_filter, :proc => lambda{|x| x[:title] = x[:title].encode("UTF-8"); x}
41
+ use :im_kayac_output, {
42
+ :secret_key => "your-secret-key",
43
+ :handler => "http://d.hatena.ne.jp/griefworker",
44
+ :username => "your-username",
45
+ }
46
+ end
47
+
@@ -1,24 +1,21 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "fragile/version"
4
-
5
- Gem::Specification.new do |s|
6
- s.name = "fragile"
7
- s.version = Fragile::VERSION
8
- s.authors = ["tnakamura"]
9
- s.email = ["griefworker@gmail.com"]
10
- s.homepage = "https://github.com/tnakamura/fragile"
11
- s.summary = %q{Ruby Pipeline Framework}
12
- s.description = %q{Ruby Pipeline Framework}
13
-
14
- s.rubyforge_project = "fragile"
15
-
16
- s.files = `git ls-files`.split("\n")
17
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
- s.require_paths = ["lib"]
20
-
21
- # specify any dependencies here; for example:
22
- # s.add_development_dependency "rspec"
23
- # s.add_runtime_dependency "rest-client"
24
- end
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'fragile/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "fragile"
8
+ gem.version = Fragile::VERSION
9
+ gem.authors = ["tnakamura"]
10
+ gem.email = ["griefworker@gmail.com"]
11
+ gem.description = %q{Ruby Pipeline Framework}
12
+ gem.summary = %q{Ruby Pipeline Framework}
13
+ gem.homepage = "https://github.com/tnakamura/fragile"
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+
20
+ gem.add_development_dependency "rspec"
21
+ end
@@ -1,14 +1,14 @@
1
- # coding: utf-8
2
- # Name:: Fragile
3
- # Author:: tnakamura <http://d.hatena.ne.jp/griefworker>
4
- # Created:: Jun 15, 2012
5
- # Updated:: Jun 15, 2012
6
- # Copyright:: tnakamura Copyright (c) 2012
7
- # License:: Licensed under the MIT LICENSE.
8
- require "fragile/version"
9
- require "fragile/plugin_manager"
10
- require "fragile/pipeline"
11
- require "fragile/pipeline_manager"
12
- require "fragile/dsl"
13
- require "fragile/application"
14
-
1
+ # coding: utf-8
2
+ # Name:: Fragile
3
+ # Author:: tnakamura <http://d.hatena.ne.jp/griefworker>
4
+ # Created:: Jun 15, 2012
5
+ # Updated:: Jun 15, 2012
6
+ # Copyright:: tnakamura Copyright (c) 2012
7
+ # License:: Licensed under the MIT LICENSE.
8
+ require "fragile/version"
9
+ require "fragile/plugin_manager"
10
+ require "fragile/pipeline"
11
+ require "fragile/pipeline_manager"
12
+ require "fragile/dsl"
13
+ require "fragile/application"
14
+
@@ -1,68 +1,68 @@
1
- # coding: utf-8
2
- # Name:: Fragile
3
- # Author:: tnakamura <http://d.hatena.ne.jp/griefworker>
4
- # Created:: Jun 15, 2012
5
- # Updated:: Jun 15, 2012
6
- # Copyright:: tnakamura Copyright (c) 2012
7
- # License:: Licensed under the MIT LICENSE.
8
- require "optparse"
9
- require "logger"
10
- require "fragile/version"
11
- require "fragile/pipeline_manager"
12
- require "fragile/plugin_manager"
13
-
14
- module Fragile
15
- class Application
16
- include Fragile::PipelineManager
17
- include Fragile::PluginManager
18
-
19
- attr_reader :logger
20
-
21
- def initialize
22
- @recipe_file = File.join(Dir.pwd, "Spcfile")
23
- @logger = Logger.new(STDOUT)
24
- @logger.level = Logger::WARN
25
- end
26
-
27
- def run
28
- handle_options
29
- load_recipe_file
30
- run_pipeline(ARGV)
31
- end
32
-
33
- def load_recipe_file
34
- load @recipe_file
35
- self.logger.info "#{@recipe_file} was loaded."
36
- end
37
-
38
- def handle_options
39
- opts = OptionParser.new do |opts|
40
- opts.version = Fragile::VERSION
41
- opts.banner = "fragile [-f RECIPE_FILE] {options} targets..."
42
- opts.separator ""
43
- opts.separator "Options are ..."
44
- opts.on_tail("-h", "--help", "-H", "Display this help message.") do
45
- puts opts
46
- exit
47
- end
48
- opts.on("-f", "--recipefile=RECIPE_FILE", "Recipe file path"){|v| @recipe_file = v}
49
- opts.on("-V", "--verbose", "Show detail log"){|v| @logger.level = Logger::DEBUG}
50
- end
51
- opts.parse!(ARGV)
52
-
53
- unless 0 < ARGV.count
54
- puts opts
55
- exit
56
- end
57
- end
58
- end
59
-
60
- def self.application
61
- @application ||= Application.new
62
- end
63
-
64
- def self.logger
65
- Fragile.application.logger
66
- end
67
- end
68
-
1
+ # coding: utf-8
2
+ # Name:: Fragile
3
+ # Author:: tnakamura <http://d.hatena.ne.jp/griefworker>
4
+ # Created:: Jun 15, 2012
5
+ # Updated:: Jun 15, 2012
6
+ # Copyright:: tnakamura Copyright (c) 2012
7
+ # License:: Licensed under the MIT LICENSE.
8
+ require "optparse"
9
+ require "logger"
10
+ require "fragile/version"
11
+ require "fragile/pipeline_manager"
12
+ require "fragile/plugin_manager"
13
+
14
+ module Fragile
15
+ class Application
16
+ include Fragile::PipelineManager
17
+ include Fragile::PluginManager
18
+
19
+ attr_reader :logger
20
+
21
+ def initialize
22
+ @recipe_file = File.join(Dir.pwd, "Spcfile")
23
+ @logger = Logger.new(STDOUT)
24
+ @logger.level = Logger::WARN
25
+ end
26
+
27
+ def run
28
+ handle_options
29
+ load_recipe_file
30
+ run_pipeline(ARGV)
31
+ end
32
+
33
+ def load_recipe_file
34
+ load @recipe_file
35
+ self.logger.info "#{@recipe_file} was loaded."
36
+ end
37
+
38
+ def handle_options
39
+ opts = OptionParser.new do |opts|
40
+ opts.version = Fragile::VERSION
41
+ opts.banner = "fragile [-f RECIPE_FILE] {options} targets..."
42
+ opts.separator ""
43
+ opts.separator "Options are ..."
44
+ opts.on_tail("-h", "--help", "-H", "Display this help message.") do
45
+ puts opts
46
+ exit
47
+ end
48
+ opts.on("-f", "--recipefile=RECIPE_FILE", "Recipe file path"){|v| @recipe_file = v}
49
+ opts.on("-V", "--verbose", "Show detail log"){|v| @logger.level = Logger::DEBUG}
50
+ end
51
+ opts.parse!(ARGV)
52
+
53
+ unless 0 < ARGV.count
54
+ puts opts
55
+ exit
56
+ end
57
+ end
58
+ end
59
+
60
+ def self.application
61
+ @application ||= Application.new
62
+ end
63
+
64
+ def self.logger
65
+ Fragile.application.logger
66
+ end
67
+ end
68
+