termlib-helper 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +2 -0
- data/lib/termlib/base.rb +44 -0
- data/lib/termlib/helper.rb +52 -0
- data/lib/termlib/helper/version.rb +5 -0
- data/lib/termlib/railtie.rb +14 -0
- data/termlib-helper.gemspec +23 -0
- metadata +82 -0
    
        checksums.yaml
    ADDED
    
    | @@ -0,0 +1,7 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            SHA1:
         | 
| 3 | 
            +
              metadata.gz: 6b5880bdf7e291dfb581174b72c229b906fa0d59
         | 
| 4 | 
            +
              data.tar.gz: a4e249c37665cfe7e5f2bd2700fddb213a1fdd7d
         | 
| 5 | 
            +
            SHA512:
         | 
| 6 | 
            +
              metadata.gz: b5d3ae3112bc133b322ef00a205e823803ed41c8aa835d4e18db9ef02944215be814dbae99041e42c18949c586ecd36a072089737bf656497db3a960cfeb7ab3
         | 
| 7 | 
            +
              data.tar.gz: 45c5fbe9cbc7430ceae33ff6d3e41d89131afd1cadc2e72685f1c404bce2c22ce646c283dcf5b1a2c760bdb571eca9d9e51129081907551e6177c53f3b44835d
         | 
    
        data/.gitignore
    ADDED
    
    | @@ -0,0 +1,22 @@ | |
| 1 | 
            +
            *.gem
         | 
| 2 | 
            +
            *.rbc
         | 
| 3 | 
            +
            .bundle
         | 
| 4 | 
            +
            .config
         | 
| 5 | 
            +
            .yardoc
         | 
| 6 | 
            +
            Gemfile.lock
         | 
| 7 | 
            +
            InstalledFiles
         | 
| 8 | 
            +
            _yardoc
         | 
| 9 | 
            +
            coverage
         | 
| 10 | 
            +
            doc/
         | 
| 11 | 
            +
            lib/bundler/man
         | 
| 12 | 
            +
            pkg
         | 
| 13 | 
            +
            rdoc
         | 
| 14 | 
            +
            spec/reports
         | 
| 15 | 
            +
            test/tmp
         | 
| 16 | 
            +
            test/version_tmp
         | 
| 17 | 
            +
            tmp
         | 
| 18 | 
            +
            *.bundle
         | 
| 19 | 
            +
            *.so
         | 
| 20 | 
            +
            *.o
         | 
| 21 | 
            +
            *.a
         | 
| 22 | 
            +
            mkmf.log
         | 
    
        data/Gemfile
    ADDED
    
    
    
        data/LICENSE.txt
    ADDED
    
    | @@ -0,0 +1,22 @@ | |
| 1 | 
            +
            Copyright (c) 2014 cravista
         | 
| 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
    ADDED
    
    | @@ -0,0 +1,29 @@ | |
| 1 | 
            +
            # Termlib::Helper
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            TODO: Write a gem description
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            ## Installation
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            Add this line to your application's Gemfile:
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                gem 'termlib-helper'
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            And then execute:
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                $ bundle
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            Or install it yourself as:
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                $ gem install termlib-helper
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            ## Usage
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            TODO: Write usage instructions here
         | 
| 22 | 
            +
             | 
| 23 | 
            +
            ## Contributing
         | 
| 24 | 
            +
             | 
| 25 | 
            +
            1. Fork it ( https://github.com/[my-github-username]/termlib-helper/fork )
         | 
| 26 | 
            +
            2. Create your feature branch (`git checkout -b my-new-feature`)
         | 
| 27 | 
            +
            3. Commit your changes (`git commit -am 'Add some feature'`)
         | 
| 28 | 
            +
            4. Push to the branch (`git push origin my-new-feature`)
         | 
| 29 | 
            +
            5. Create a new Pull Request
         | 
    
        data/Rakefile
    ADDED
    
    
    
        data/lib/termlib/base.rb
    ADDED
    
    | @@ -0,0 +1,44 @@ | |
| 1 | 
            +
            module Termlib
         | 
| 2 | 
            +
              module Helper
         | 
| 3 | 
            +
             | 
| 4 | 
            +
                module Base
         | 
| 5 | 
            +
                  DEFAULT_COLOR ="#3d31a2"
         | 
| 6 | 
            +
                  DEFAULT_TEXT_COLOR = "#7c70da"
         | 
| 7 | 
            +
             
         | 
| 8 | 
            +
                  @@term_commands = {
         | 
| 9 | 
            +
                    :clear => {
         | 
| 10 | 
            +
                      :exec =>"this.clear()",
         | 
| 11 | 
            +
                      :help => "clear terminal"
         | 
| 12 | 
            +
                    },
         | 
| 13 | 
            +
                    :exit  => {
         | 
| 14 | 
            +
                      :exec => "this.type('# By!')\n      this.close()",
         | 
| 15 | 
            +
                      :help => "kill terminal"
         | 
| 16 | 
            +
                    },
         | 
| 17 | 
            +
                    :id => {
         | 
| 18 | 
            +
                      :exec => "this.type this.id", 
         | 
| 19 | 
            +
                      :help => "show terminal id"
         | 
| 20 | 
            +
                    }
         | 
| 21 | 
            +
                  }
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                  protected
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                  def define_commands(o)
         | 
| 26 | 
            +
                    o.each_pair{|k, v|
         | 
| 27 | 
            +
                      @@term_commands[k] = v
         | 
| 28 | 
            +
                    }
         | 
| 29 | 
            +
                  end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                  def hook_commands
         | 
| 32 | 
            +
                    src = ""
         | 
| 33 | 
            +
                    help = "this.write(["
         | 
| 34 | 
            +
                    @@term_commands.each_pair{|key, value|
         | 
| 35 | 
            +
                      src << "#\n    if cmd=='#{key}'\n      #{value[:exec]}"
         | 
| 36 | 
            +
                      help << "'#{key} ... #{value[:help]}',"  
         | 
| 37 | 
            +
                    }
         | 
| 38 | 
            +
                    help << "])\n"
         | 
| 39 | 
            +
                    src << "\n    if cmd=='help'\n      #{help}"
         | 
| 40 | 
            +
                  end
         | 
| 41 | 
            +
             | 
| 42 | 
            +
                end
         | 
| 43 | 
            +
              end
         | 
| 44 | 
            +
            end
         | 
| @@ -0,0 +1,52 @@ | |
| 1 | 
            +
            require "termlib/helper/version"
         | 
| 2 | 
            +
            require "termlib/base"
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            module Termlib
         | 
| 5 | 
            +
              module Helper
         | 
| 6 | 
            +
                module Builder
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                  include Base
         | 
| 9 | 
            +
                  include ActionView::Helpers::JavaScriptHelper
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                  def termlib(opt)
         | 
| 12 | 
            +
                   define_commands(opt[:custom_commands]) if opt[:custom_commands]
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                    string = """term =  window.terminal = new Terminal
         | 
| 15 | 
            +
              rows: #{opt[:rows]}
         | 
| 16 | 
            +
              ps: '$ >'
         | 
| 17 | 
            +
              greeting: '#{opt[:id]} Terminal ready'
         | 
| 18 | 
            +
              id: '#{opt[:id]}_#{Time.now}'
         | 
| 19 | 
            +
              termDiv: '#{opt[:id]}'
         | 
| 20 | 
            +
              crsrBlinkMode: true
         | 
| 21 | 
            +
              handler: ->
         | 
| 22 | 
            +
                this.newLine()
         | 
| 23 | 
            +
                cmd = this.lineBuffer
         | 
| 24 | 
            +
                #{hook_commands}
         | 
| 25 | 
            +
                this.prompt()
         | 
| 26 | 
            +
              exitHandler: -> if term.closed==true then term.close()
         | 
| 27 | 
            +
              textColor: '#00FF00'
         | 
| 28 | 
            +
             | 
| 29 | 
            +
            onHover = 
         | 
| 30 | 
            +
              terminal: ->
         | 
| 31 | 
            +
                TermGlobals.keylock = false
         | 
| 32 | 
            +
                term.focus()
         | 
| 33 | 
            +
              editor: ->
         | 
| 34 | 
            +
                TermGlobals.keylock = true
         | 
| 35 | 
            +
                window.editor.focus()
         | 
| 36 | 
            +
             | 
| 37 | 
            +
            onExit = 
         | 
| 38 | 
            +
              terminal: -> TermGlobals.setFocus false
         | 
| 39 | 
            +
              editor: -> window.editor.blur()
         | 
| 40 | 
            +
             | 
| 41 | 
            +
            $('##{opt[:id]}').hover onHover.terminal, onExit.terminal
         | 
| 42 | 
            +
             | 
| 43 | 
            +
            $('##{opt[:editor]}').hover onHover.editor, onExit.editor
         | 
| 44 | 
            +
             | 
| 45 | 
            +
            term.open()"""
         | 
| 46 | 
            +
                    js = CoffeeScript.compile(string, :bare => true)
         | 
| 47 | 
            +
                    javascript_tag(js)
         | 
| 48 | 
            +
                  end
         | 
| 49 | 
            +
             | 
| 50 | 
            +
                end
         | 
| 51 | 
            +
              end
         | 
| 52 | 
            +
            end
         | 
| @@ -0,0 +1,23 @@ | |
| 1 | 
            +
            # coding: utf-8
         | 
| 2 | 
            +
            lib = File.expand_path('../lib', __FILE__)
         | 
| 3 | 
            +
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         | 
| 4 | 
            +
            require 'termlib/helper/version'
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            Gem::Specification.new do |spec|
         | 
| 7 | 
            +
              spec.name          = "termlib-helper"
         | 
| 8 | 
            +
              spec.version       = Termlib::Helper::VERSION
         | 
| 9 | 
            +
              spec.authors       = ["jahpd"]
         | 
| 10 | 
            +
              spec.email         = ["gcravista@gmail.com"]
         | 
| 11 | 
            +
              spec.summary       = %q{Helper for termlib.js}
         | 
| 12 | 
            +
              spec.description   = %q{Helper for termlib.js for Rails}
         | 
| 13 | 
            +
              spec.homepage      = "https://www.github.com/jahpd/termlib-helper"
         | 
| 14 | 
            +
              spec.license       = "CC-BY-SA 3.0"
         | 
| 15 | 
            +
             | 
| 16 | 
            +
              spec.files         = `git ls-files -z`.split("\x0")
         | 
| 17 | 
            +
              spec.executables   = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
         | 
| 18 | 
            +
              spec.test_files    = spec.files.grep(%r{^(test|spec|features)/})
         | 
| 19 | 
            +
              spec.require_paths = ["lib"]
         | 
| 20 | 
            +
             | 
| 21 | 
            +
              spec.add_development_dependency "bundler", "~> 1.6"
         | 
| 22 | 
            +
              spec.add_development_dependency "rake", "~> 10.3"
         | 
| 23 | 
            +
            end
         | 
    
        metadata
    ADDED
    
    | @@ -0,0 +1,82 @@ | |
| 1 | 
            +
            --- !ruby/object:Gem::Specification
         | 
| 2 | 
            +
            name: termlib-helper
         | 
| 3 | 
            +
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            +
              version: 0.0.1
         | 
| 5 | 
            +
            platform: ruby
         | 
| 6 | 
            +
            authors:
         | 
| 7 | 
            +
            - jahpd
         | 
| 8 | 
            +
            autorequire: 
         | 
| 9 | 
            +
            bindir: bin
         | 
| 10 | 
            +
            cert_chain: []
         | 
| 11 | 
            +
            date: 2014-07-07 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.6'
         | 
| 20 | 
            +
              type: :development
         | 
| 21 | 
            +
              prerelease: false
         | 
| 22 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 | 
            +
                requirements:
         | 
| 24 | 
            +
                - - "~>"
         | 
| 25 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            +
                    version: '1.6'
         | 
| 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.3'
         | 
| 34 | 
            +
              type: :development
         | 
| 35 | 
            +
              prerelease: false
         | 
| 36 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 | 
            +
                requirements:
         | 
| 38 | 
            +
                - - "~>"
         | 
| 39 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            +
                    version: '10.3'
         | 
| 41 | 
            +
            description: Helper for termlib.js for Rails
         | 
| 42 | 
            +
            email:
         | 
| 43 | 
            +
            - gcravista@gmail.com
         | 
| 44 | 
            +
            executables: []
         | 
| 45 | 
            +
            extensions: []
         | 
| 46 | 
            +
            extra_rdoc_files: []
         | 
| 47 | 
            +
            files:
         | 
| 48 | 
            +
            - ".gitignore"
         | 
| 49 | 
            +
            - Gemfile
         | 
| 50 | 
            +
            - LICENSE.txt
         | 
| 51 | 
            +
            - README.md
         | 
| 52 | 
            +
            - Rakefile
         | 
| 53 | 
            +
            - lib/termlib/base.rb
         | 
| 54 | 
            +
            - lib/termlib/helper.rb
         | 
| 55 | 
            +
            - lib/termlib/helper/version.rb
         | 
| 56 | 
            +
            - lib/termlib/railtie.rb
         | 
| 57 | 
            +
            - termlib-helper.gemspec
         | 
| 58 | 
            +
            homepage: https://www.github.com/jahpd/termlib-helper
         | 
| 59 | 
            +
            licenses:
         | 
| 60 | 
            +
            - CC-BY-SA 3.0
         | 
| 61 | 
            +
            metadata: {}
         | 
| 62 | 
            +
            post_install_message: 
         | 
| 63 | 
            +
            rdoc_options: []
         | 
| 64 | 
            +
            require_paths:
         | 
| 65 | 
            +
            - lib
         | 
| 66 | 
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 67 | 
            +
              requirements:
         | 
| 68 | 
            +
              - - ">="
         | 
| 69 | 
            +
                - !ruby/object:Gem::Version
         | 
| 70 | 
            +
                  version: '0'
         | 
| 71 | 
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 72 | 
            +
              requirements:
         | 
| 73 | 
            +
              - - ">="
         | 
| 74 | 
            +
                - !ruby/object:Gem::Version
         | 
| 75 | 
            +
                  version: '0'
         | 
| 76 | 
            +
            requirements: []
         | 
| 77 | 
            +
            rubyforge_project: 
         | 
| 78 | 
            +
            rubygems_version: 2.2.2
         | 
| 79 | 
            +
            signing_key: 
         | 
| 80 | 
            +
            specification_version: 4
         | 
| 81 | 
            +
            summary: Helper for termlib.js
         | 
| 82 | 
            +
            test_files: []
         |