Coder Social home page Coder Social logo

seamless's Introduction

seamless

Python allows you to signal the end of a code block with indentation. Ruby suffers from an extremely verbose and tedious block terminator, "end". Much like Lisps end up with dozens of close-parens, Ruby files that use modules and classes heavily end up with a plethora of "ends" that just aren't necessary.

Write a Ruby file, but skip all the "ends". Line up your code blocks like in Python. Then just call it 'your_file.rbe', require 'seamless', and require 'your_file'. Seamless does the rest.

Should this ever see widespread use? I don't know. But it's pretty fun!

Example

module Hello
  module World
    class Runner
      def initialize(user)
        @user = user
      def run
        puts "Hello, #{@user}"

Much cleaner! Sure, a bit contrived, but no more ends!

Note on Patches/Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add tests for it. This is important so I don't break it in a future version unintentionally.
  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
  • Send me a pull request. Bonus points for topic branches.

Copyright

Copyright (c) 2010 Michael Edgar. See LICENSE for details.

seamless's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

rzel matzfan

seamless's Issues

spec/rake/spectask error

I get the following error when running rake or rake spec:

bash-4.1$ rake spec
(in /Users/user/Documents/seamless)
rake aborted!
no such file to load -- spec/rake/spectask
:29:in `require'
:29:in `require'
/Users/user/Documents/seamless/Rakefile:31:in `'
/usr/local/Cellar/ruby/1.9.2-p136/lib/ruby/1.9.1/rake.rb:2373:in `load'
/usr/local/Cellar/ruby/1.9.2-p136/lib/ruby/1.9.1/rake.rb:2373:in `raw_load_rakefile'
/usr/local/Cellar/ruby/1.9.2-p136/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile'
/usr/local/Cellar/ruby/1.9.2-p136/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
/usr/local/Cellar/ruby/1.9.2-p136/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile'
/usr/local/Cellar/ruby/1.9.2-p136/lib/ruby/1.9.1/rake.rb:1991:in `run'
/usr/local/bin/rake:31:in `'

install questions

Hi Michael. Nice work.

A few problems/questions on my own install end here...

This is me trying to run it against a simple test script like

class A
 def go
  1. seems to have a dependency on rails (?)

  2. seems to be missing a require 'thread'

  3. has a require 'md5' -- did it want require 'digest/md5'?

  4. seems to have a dependency on the cached_model gem?

  5. installing cached_model gem still left me with this error, even with an extra
    gem 'rails' in my driver file:

C:\dev\ruby\low_prio\vaos>ruby -v driver.rb
ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-mingw32]
C:/Ruby19/lib/ruby/gems/1.9.1/gems/activesupport-2.3.8/lib/active_support/vendor.rb:32: warning: method redefined; discarding old normalize_translation_keys
C:/Ruby19/lib/ruby/1.9.1/pathname.rb:270: warning: `*' interpreted as argument prefix
C:/Ruby19/lib/ruby/gems/1.9.1/gems/activesupport-2.3.8/lib/active_support/core_ext/string/output_safety.rb:29: warning: method redefined; discarding old html_escape
C:/Ruby19/lib/ruby/gems/1.9.1/gems/activesupport-2.3.8/lib/active_support/core_ext/string/output_safety.rb:30: warning: method redefined; discarding old h
C:/Ruby19/lib/ruby/gems/1.9.1/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:105:in `rescue in const_missing': uninitialized constant CachedModel::Rails (NameError)
        from C:/Ruby19/lib/ruby/gems/1.9.1/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:94:in `const_missing'
        from C:/Ruby19/lib/ruby/gems/1.9.1/gems/cached_model-1.3.1/lib/cached_model.rb:77:in `'
        from C:/Ruby19/lib/ruby/gems/1.9.1/gems/cached_model-1.3.1/lib/cached_model.rb:21:in `'
        from C:/Ruby19/lib/ruby/gems/1.9.1/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'

Any ideas?
Thanks.
-r

fails with 1.9.2

Wasn't sure if this is a polyglot problem, or not, but with a file
./go.rbe existing

with 1.9.2, doing a
require './go'
fails (with 1.8.6 it worked as expected, with 1.9.1 it appeared to find the file, with 1.9.2 it fails thus).

Thanks.
-r

Bunch of errors

bash-4.1$ rake --trace
(in /Users/dev/Documents/seamless)
** Invoke default (first_time)
** Invoke spec (first_time)
** Invoke check_dependencies (first_time)
** Execute check_dependencies
All dependencies seem to be installed.
** Execute spec
.FFF

1)
RuntimeError in 'Seamless loads a class in endless form'
implicit argument passing of super from method defined by define_method() is not supported. Specify all arguments explicitly.
/Users/dev/Documents/seamless/lib/seamless/endless.rb:139:in `block (2 levels) in '
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rubylexer-0.7.7/lib/rubylexer.rb:1001:in `parse_keywords'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rubylexer-0.7.7/lib/rubylexer.rb:482:in `identifier'
(eval):25:in `identifier'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rubylexer-0.7.7/lib/rubylexer/charhandler.rb:86:in `go'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rubylexer-0.7.7/lib/rubylexer/rulexer.rb:88:in `get1token'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rubylexer-0.7.7/lib/rubylexer.rb:270:in `get1token'
/Users/dev/Documents/seamless/lib/seamless/endless.rb:211:in `preprocess'
/Users/dev/Documents/seamless/lib/seamless/endless.rb:192:in `block (2 levels) in load'
/Users/dev/Documents/seamless/lib/seamless/endless.rb:191:in `block in load'
/Users/dev/Documents/seamless/lib/seamless/endless.rb:186:in `each'
/Users/dev/Documents/seamless/lib/seamless/endless.rb:186:in `load'
/Users/dev/Documents/seamless/lib/seamless.rb:6:in `load'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/polyglot-0.3.1/lib/polyglot.rb:48:in `load'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/polyglot-0.3.1/lib/polyglot.rb:67:in `rescue in require'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `require'
spec/seamless_spec.rb:5:in `load_example'
spec/seamless_spec.rb:14:in `block (2 levels) in '

2)
RuntimeError in 'Seamless loads endlessly formed rescues'
implicit argument passing of super from method defined by define_method() is not supported. Specify all arguments explicitly.
/Users/dev/Documents/seamless/lib/seamless/endless.rb:139:in `block (2 levels) in '
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rubylexer-0.7.7/lib/rubylexer.rb:1001:in `parse_keywords'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rubylexer-0.7.7/lib/rubylexer.rb:482:in `identifier'
(eval):25:in `identifier'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rubylexer-0.7.7/lib/rubylexer/charhandler.rb:86:in `go'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rubylexer-0.7.7/lib/rubylexer/rulexer.rb:88:in `get1token'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rubylexer-0.7.7/lib/rubylexer.rb:270:in `get1token'
/Users/dev/Documents/seamless/lib/seamless/endless.rb:211:in `preprocess'
/Users/dev/Documents/seamless/lib/seamless/endless.rb:192:in `block (2 levels) in load'
/Users/dev/Documents/seamless/lib/seamless/endless.rb:191:in `block in load'
/Users/dev/Documents/seamless/lib/seamless/endless.rb:186:in `each'
/Users/dev/Documents/seamless/lib/seamless/endless.rb:186:in `load'
/Users/dev/Documents/seamless/lib/seamless.rb:6:in `load'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/polyglot-0.3.1/lib/polyglot.rb:48:in `load'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/polyglot-0.3.1/lib/polyglot.rb:67:in `rescue in require'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `require'
spec/seamless_spec.rb:5:in `load_example'
spec/seamless_spec.rb:19:in `block (2 levels) in '

3)
RuntimeError in 'Seamless loads endless files with no newline at the end'
implicit argument passing of super from method defined by define_method() is not supported. Specify all arguments explicitly.
/Users/dev/Documents/seamless/lib/seamless/endless.rb:139:in `block (2 levels) in '
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rubylexer-0.7.7/lib/rubylexer.rb:1001:in `parse_keywords'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rubylexer-0.7.7/lib/rubylexer.rb:482:in `identifier'
(eval):25:in `identifier'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rubylexer-0.7.7/lib/rubylexer/charhandler.rb:86:in `go'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rubylexer-0.7.7/lib/rubylexer/rulexer.rb:88:in `get1token'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rubylexer-0.7.7/lib/rubylexer.rb:270:in `get1token'
/Users/dev/Documents/seamless/lib/seamless/endless.rb:211:in `preprocess'
/Users/dev/Documents/seamless/lib/seamless/endless.rb:192:in `block (2 levels) in load'
/Users/dev/Documents/seamless/lib/seamless/endless.rb:191:in `block in load'
/Users/dev/Documents/seamless/lib/seamless/endless.rb:186:in `each'
/Users/dev/Documents/seamless/lib/seamless/endless.rb:186:in `load'
/Users/dev/Documents/seamless/lib/seamless.rb:6:in `load'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/polyglot-0.3.1/lib/polyglot.rb:48:in `load'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/polyglot-0.3.1/lib/polyglot.rb:67:in `rescue in require'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `require'
spec/seamless_spec.rb:5:in `load_example'
spec/seamless_spec.rb:24:in `block (2 levels) in '

Finished in 0.029797 seconds

4 examples, 3 failures
rake aborted!
Command /usr/local/rvm/rubies/ruby-1.9.2-p136/bin/ruby -I"lib:lib:spec"  "/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rspec-1.3.1/bin/spec" "spec/seamless_spec.rb"  failed
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rspec-1.3.1/lib/spec/rake/spectask.rb:177:in `block (2 levels) in define'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:1112:in `verbose'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rspec-1.3.1/lib/spec/rake/spectask.rb:153:in `block in define'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:636:in `block in execute'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:597:in `block in invoke_with_call_chain'
/usr/local/rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:607:in `block in invoke_prerequisites'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:596:in `block in invoke_with_call_chain'
/usr/local/rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:2029:in `block (2 levels) in top_level'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:2029:in `block in top_level'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:2001:in `block in run'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/bin/rake:31:in `'
/usr/local/rvm/gems/ruby-1.9.2-p136/bin/rake:19:in `load'
/usr/local/rvm/gems/ruby-1.9.2-p136/bin/rake:19:in `'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.