Coder Social home page Coder Social logo

ylansegal / franklin.cr Goto Github PK

View Code? Open in Web Editor NEW
8.0 8.0 0.0 200 KB

CLI utility to search public libraries powered by Overdrive. Written in crystal (ported from my ruby version).

License: MIT License

Makefile 0.16% Crystal 5.05% HTML 94.79%

franklin.cr's Introduction

franklin.cr's People

Contributors

ylansegal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

franklin.cr's Issues

Error on any search

Any idea what "Unhandled exception in spawn" means? I can def dig into it any figure it out, but if it's something simple...

Thanks for contributing this code to the community!

$ make test
/opt/local/bin/crystal spec
......................................

Finished in 53.99 milliseconds
38 examples, 0 failures, 0 errors, 0 pending
$ bin/franklin chamber of secrets
Unhandled exception in spawn: Index out of bounds (IndexError)
  from ~procProc(Nil)@src/franklin/concurrent_search.cr:13
  from Fiber#run:(IO::FileDescriptor | Nil)
$ crystal -v
Crystal 0.27.0 (2019-01-05)

LLVM: 6.0.1
$ cat ~/.franklin 
libraries:
  - name: San Francisco Public Library
    url: http://sfpl.lib.overdrive.com
  - name: Berkeley Public
    url: https://berkeleypubliclibrary.overdrive.com
  - name: Alameda County
    url: https://aclibrary.overdrive.com
default_type: eBook # Optional, will show all types if not set.

I've never written any Crystal before. :-)
Next up: a PR to set exit code when nothing is found.

How to compile it correctly? (Errno is not a subclass of Exception)

This is an interesting project. But I'm new to crystal and can't compile it.

I installed crystal by using the documentation on https://crystal-lang.org.

$crystal -v
Crystal 0.35.1 [5999ae29b] (2020-06-19)

LLVM: 8.0.0
Default target: x86_64-unknown-linux-gnu

1. make test

Here I got the following error:

A total of 7 warnings were found.
Showing last frame. Use --error-trace for full trace.

In spec/spec_helper.cr:4:1

 4 | require "webmock"
     ^
Error: can't find file 'webmock'

If you're trying to require a shard:
- Did you remember to run `shards install`?
- Did you make sure you're running the compiler in the same directory as your shard.yml?
Makefile:5: recipe for target 'test' failed
make: *** [test] Error 1

Then I changed 0.9 to master shard.yml to:

development_dependencies:
  webmock:
    github: manastech/webmock.cr
    branch: master

I have no idea, if this is correct. But the test seems to run fine.

A total of 7 warnings were found.
.......................................

Finished in 19.3 milliseconds
39 examples, 0 failures, 0 errors, 0 pending
Makefile:5: recipe for target 'test' failed
make: *** [test] Error 1

2. build a binary

$ make bin/franklin
/usr/bin/crystal build --release --no-debug -o bin/franklin src/cli.cr 
In src/franklin/library.cr:5:10

 5 | YAML.mapping(
          ^------
Warning: Deprecated YAML.mapping. use YAML::Serializable instead (the legacy behaviour is also available in a shard at github:crystal-lang/yaml_mapping.cr)

In src/franklin/library.cr:5:5

 5 | YAML.mapping(
     ^
Warning: expanding macro


There was a problem expanding macro 'mapping'

Called macro defined in /usr/share/crystal/src/yaml/mapping.cr:222:3

 222 | macro mapping(**_properties_)

Which expanded to:

 > 1 |     ::YAML.mapping({name: String, url: String})
   2 |   
Warning: Deprecated YAML.mapping. use YAML::Serializable instead (the legacy behaviour is also available in a shard at github:crystal-lang/yaml_mapping.cr)

In src/franklin/config.cr:8:10

 8 | YAML.mapping(
          ^------
Warning: Deprecated YAML.mapping. use YAML::Serializable instead (the legacy behaviour is also available in a shard at github:crystal-lang/yaml_mapping.cr)

In src/franklin/overdrive.cr:6:12

 6 | JSON.mapping(
          ^------
Warning: Deprecated JSON.mapping. use JSON::Serializable instead (the legacy behaviour is also available in a shard at github:crystal-lang/json_mapping.cr)

In src/franklin/overdrive.cr:6:7

 6 | JSON.mapping(
     ^
Warning: expanding macro


There was a problem expanding macro 'mapping'

Called macro defined in /usr/share/crystal/src/json/mapping.cr:232:3

 232 | macro mapping(**_properties_)

Which expanded to:

 > 1 |     ::JSON.mapping({data: Hash(String, Overdrive::Entry)})
   2 |   
Warning: Deprecated JSON.mapping. use JSON::Serializable instead (the legacy behaviour is also available in a shard at github:crystal-lang/json_mapping.cr)

In src/franklin/overdrive.cr:12:12

 12 | JSON.mapping(
           ^------
Warning: Deprecated JSON.mapping. use JSON::Serializable instead (the legacy behaviour is also available in a shard at github:crystal-lang/json_mapping.cr)

In src/franklin/overdrive.cr:31:12

 31 | JSON.mapping(
           ^------
Warning: Deprecated JSON.mapping. use JSON::Serializable instead (the legacy behaviour is also available in a shard at github:crystal-lang/json_mapping.cr)

A total of 7 warnings were found.
Showing last frame. Use --error-trace for full trace.

In src/cli.cr:33:8

 33 | rescue Errno
             ^
Error: Errno is not a subclass of Exception
Makefile:20: recipe for target 'bin/franklin' failed
make: *** [bin/franklin] Error 1

Do you know how to solve this?

PS: It seems there is a change in v0.34 regarding Errno (https://crystal-lang.org/2020/04/06/crystal-0.34.0-released.html).

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.