samueleaton / sentry

Build/Runs your crystal application, watches files, and rebuilds/restarts app on file changes
MIT License
286 stars 27 forks source link

undefined method 'to_unix' for Time #37

Closed philipjscott closed 5 years ago

philipjscott commented 6 years ago

When I run

curl -fsSLo- https://raw.githubusercontent.com/samueleaton/sentry/master/install.cr | crystal eval

I get the following output:

Error in dev/sentry_cli.cr:104: instantiating 'Sentry::ProcessRunner#run()'

  process_runner.run
                 ^~~

in dev/sentry.cr:283: instantiating 'loop()'

      loop do
      ^~~~

in dev/sentry.cr:283: instantiating 'loop()'

      loop do
      ^~~~

in dev/sentry.cr:288: instantiating 'scan_files()'

        scan_files
        ^~~~~~~~~~

in dev/sentry.cr:254: instantiating 'get_timestamp(String)'

        timestamp = get_timestamp(file)
                    ^~~~~~~~~~~~~

in dev/sentry.cr:230: undefined method 'to_unix' for Time

      File.info(file).modification_time.to_unix.to_s
                                        ^~~~~~~

Rerun with --error-trace to show a complete error trace.

crystal -v output:

Crystal 0.26.1 (2018-09-27)

LLVM: 6.0.1
Default target: x86_64-pc-linux-gnu

After doing some research, I figured out that Time.epoch was renamed to Time.to_unix in version 0.27.0:

https://github.com/crystal-lang/crystal/pull/6662

I've fixed the problem by upgrading to Crystal 0.27.0, but I'm creating this issue for troubleshooting purposes, in case somebody experiences the same problem.

Feel free to close this. I recommend updating the README to remind users to use the most up to date Crystal compiler. It might also be worthwhile to make a crystal-v0.26.1 branch.

samueleaton commented 6 years ago

yeah i've been trying to create a branch for every breaking change so people can still download for their version but didn't get around to it for this latest release. Thanks for reminding me.

ramon-sg commented 5 years ago

hi, for crystal 0.26.1:

curl -fsSLo- https://gist.githubusercontent.com/clouw/ebe02f47fb42ffe5151fd5093fbc5e10/raw/51ea4a79c5e2d3938510a4f604a4e75d64a2ba59/sentry-crystal-0.26.1.cr | crystal eval

Jens0512 commented 5 years ago

Hey, I'm creating an AUR package for this, and building from master is no good. The latest release ATM is 0.3.0 which is broken due to this undefined method epoch for Time. Seeing this was just fixed with https://github.com/samueleaton/sentry/commit/64b6931424f50dd070158d56a8ad50d8efc557a3, can you just create a new release with this commit included? Then sentry will be even more easily available to all linux distros using the AUR.

Thanks for sentry!

samueleaton commented 5 years ago

@Jens0512 Just pushed new tag. Thats awesome!

Jens0512 commented 5 years ago

Thanks for that! Package on AUR

philipjscott commented 5 years ago

Closing this issue since it's been addressed; thanks!