Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerize it #5

Merged
merged 1 commit into from
Apr 25, 2018
Merged

Dockerize it #5

merged 1 commit into from
Apr 25, 2018

Conversation

veelenga
Copy link
Member

@veelenga veelenga commented Apr 25, 2018

Since the shard supports only Linux environment, this PR adds a suggestion how to do the development on other environments (via the Docker). I'm on Mac OSX, so:

hardware git:feat/docker ❯ crystal spec                                                                                                                                                                  
E.

Failures:

  1) Hardware::CPU parses '/proc/stat'

       Error opening file '/proc/stat' with mode 'r': No such file or directory
       /usr/local/Cellar/crystal-lang/0.24.2_1/src/file.cr:33:5 in 'initialize'
       /usr/local/Cellar/crystal-lang/0.24.2_1/src/file.cr:25:3 in 'new'
       /usr/local/Cellar/crystal-lang/0.24.2_1/src/file.cr:427:5 in 'read'
       /usr/local/Cellar/crystal-lang/0.24.2_1/src/file.cr:441:3 in 'read'
       src/hardware/cpu.cr:3:11 in 'info'
       ~procProc(Nil)@spec/cpu_spec.cr:4
       /usr/local/Cellar/crystal-lang/0.24.2_1/src/spec/methods.cr:255:3 in 'it'
       ~procProc(Nil)@spec/cpu_spec.cr:3
       /usr/local/Cellar/crystal-lang/0.24.2_1/src/spec/context.cr:255:3 in 'describe'
       /usr/local/Cellar/crystal-lang/0.24.2_1/src/spec/methods.cr:16:5 in 'describe'
       spec/hardware_spec.cr:1:1 in '__crystal_main'
       /usr/local/Cellar/crystal-lang/0.24.2_1/src/crystal/main.cr:11:3 in '_crystal_main'
       /usr/local/Cellar/crystal-lang/0.24.2_1/src/crystal/main.cr:112:5 in 'main_user_code'
       /usr/local/Cellar/crystal-lang/0.24.2_1/src/crystal/main.cr:101:7 in 'main'
       /usr/local/Cellar/crystal-lang/0.24.2_1/src/crystal/main.cr:135:3 in 'main'

Finished in 175 microseconds
2 examples, 0 failures, 1 errors, 0 pending

Failed examples:

crystal spec spec/cpu_spec.cr:4 

hardware git:master ❯ docker-compose up                                                                                                                                                                 
Starting hardware_spec_1 ... done
Attaching to hardware_spec_1
spec_1  | ........
spec_1  |
spec_1  | Finished in 679 microseconds
spec_1  | 8 examples, 0 failures, 0 errors, 0 pending
hardware_spec_1 exited with code 0

hardware git:master ❯ docker-compose run spec                                                                                                                                                          
........

Finished in 578 microseconds
8 examples, 0 failures, 0 errors, 0 pending

Since the source files are mounted into the container, it is possible to edit the files as usual and run specs in docker.

@bararchy
Copy link
Collaborator

@veelenga How about we instead add support for Mac as well?
we can use compile time flags and wrap specific OS logic inside

@veelenga
Copy link
Member Author

We can. I was also thinking about it. But unless we don't support it, the development on OS X is problematic :/

@bararchy
Copy link
Collaborator

I see, we can start by having the docker (which always makes sense), and then we start working on adding MacOS support, I'll merge this and open an issue

@bararchy bararchy merged commit b118a59 into master Apr 25, 2018
@veelenga veelenga deleted the feat/docker branch April 25, 2018 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants