fragile 0.0.3 → 0.0.4
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/.coveralls.yml +1 -0
 - data/.gitignore +54 -6
 - data/.rspec +2 -0
 - data/.travis.yml +5 -0
 - data/Gemfile +7 -4
 - data/LICENSE.txt +22 -0
 - data/README.md +61 -60
 - data/Rakefile +1 -1
 - data/bin/fragile +19 -19
 - data/examples/example.rb +47 -33
 - data/fragile.gemspec +21 -24
 - data/lib/fragile.rb +14 -14
 - data/lib/fragile/application.rb +68 -68
 - data/lib/fragile/dsl.rb +18 -18
 - data/lib/fragile/pipeline.rb +54 -54
 - data/lib/fragile/pipeline_manager.rb +36 -36
 - data/lib/fragile/plugin/console_output.rb +17 -17
 - data/lib/fragile/plugin/im_kayac_output.rb +56 -0
 - data/lib/fragile/plugin/mail_output.rb +50 -50
 - data/lib/fragile/plugin/map_filter.rb +18 -18
 - data/lib/fragile/plugin/rss_input.rb +36 -21
 - data/lib/fragile/plugin/select_filter.rb +18 -18
 - data/lib/fragile/plugin_manager.rb +38 -38
 - data/lib/fragile/version.rb +11 -11
 - data/{test/dsl_test.rb → spec/dsl_spec.rb} +17 -18
 - data/{test/pipeline_manager_test.rb → spec/pipeline_manager_spec.rb} +94 -94
 - data/{test/pipeline_test.rb → spec/pipeline_spec.rb} +108 -106
 - data/spec/plugin/im_kayac_output_spec.rb +65 -0
 - data/spec/plugin_manager_spec.rb +49 -0
 - data/spec/spec_helper.rb +15 -0
 - metadata +39 -12
 - data/MIT-LICENSE +0 -23
 - data/test/plugin_manager_test.rb +0 -57
 - data/test/test_helper.rb +0 -14
 
    
        data/.coveralls.yml
    ADDED
    
    | 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            service_name: travis-ci
         
     | 
    
        data/.gitignore
    CHANGED
    
    | 
         @@ -1,6 +1,54 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       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
    
    
    
        data/.travis.yml
    ADDED
    
    
    
        data/Gemfile
    CHANGED
    
    
    
        data/LICENSE.txt
    ADDED
    
    | 
         @@ -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 
     | 
    
         
            -
             
     | 
| 
       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 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
            ```
         
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
      
 1 
     | 
    
         
            +
            # Fragile [](http://travis-ci.org/tnakamura/fragile) [](https://codeclimate.com/github/tnakamura/fragile) [](https://gemnasium.com/tnakamura/fragile) [](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"
         
     | 
    
        data/bin/fragile
    CHANGED
    
    | 
         @@ -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 
     | 
    
         
            +
             
     | 
    
        data/examples/example.rb
    CHANGED
    
    | 
         @@ -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 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
              use : 
     | 
| 
       13 
     | 
    
         
            -
              use : 
     | 
| 
       14 
     | 
    
         
            -
              use : 
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
              use : 
     | 
| 
       22 
     | 
    
         
            -
              use : 
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
                : 
     | 
| 
       25 
     | 
    
         
            -
                : 
     | 
| 
       26 
     | 
    
         
            -
                : 
     | 
| 
       27 
     | 
    
         
            -
                : 
     | 
| 
       28 
     | 
    
         
            -
                : 
     | 
| 
       29 
     | 
    
         
            -
                : 
     | 
| 
       30 
     | 
    
         
            -
                : 
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       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 
     | 
    
         
            +
             
     | 
    
        data/fragile.gemspec
    CHANGED
    
    | 
         @@ -1,24 +1,21 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # -*- encoding: utf-8 -*-
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
               
     | 
| 
       8 
     | 
    
         
            -
               
     | 
| 
       9 
     | 
    
         
            -
               
     | 
| 
       10 
     | 
    
         
            -
               
     | 
| 
       11 
     | 
    
         
            -
               
     | 
| 
       12 
     | 
    
         
            -
               
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
               
     | 
| 
       17 
     | 
    
         
            -
               
     | 
| 
       18 
     | 
    
         
            -
               
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       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
         
     | 
    
        data/lib/fragile.rb
    CHANGED
    
    | 
         @@ -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 
     | 
    
         
            +
             
     | 
    
        data/lib/fragile/application.rb
    CHANGED
    
    | 
         @@ -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 
     | 
    
         
            +
             
     |