crystal-repl 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 +80 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +6 -0
- data/Rakefile +2 -0
- data/bin/crepl +41 -0
- data/crystal-repl.gemspec +23 -0
- data/lib/crystal/repl.rb +7 -0
- data/lib/crystal/repl/version.rb +5 -0
- metadata +83 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 71fdaa961aa1dec52b5c7b271351ce547869c0f3
|
4
|
+
data.tar.gz: 81639e27c994c1a99639d7b325e93f46d0405c09
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 34bc222a2dbf3f9ebf2b07479bcbba64ebbfc65df81528017cfeff7f175e55303b80d516a344fe304b2a7c0a522f09c02118dd76b2eaac2e9e4a0ffd8e41a200
|
7
|
+
data.tar.gz: dbfdac99eda912d7b23cf678ff332c41c4f748f4cb6a93fe4f473868e69768a3eed125e4a731e63c7b633d3c8065342b1fa6b4f53beabd6e6f67b606a6bd2a80
|
data/.gitignore
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
#----------------------------------------------------------------------------
|
2
|
+
# Ignore these files when commiting to a git repository.
|
3
|
+
#
|
4
|
+
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
5
|
+
#
|
6
|
+
# The original version of this file is found here:
|
7
|
+
# https://github.com/RailsApps/rails-composer/blob/master/files/gitignore.txt
|
8
|
+
#
|
9
|
+
# Corrections? Improvements? Create a GitHub issue:
|
10
|
+
# http://github.com/RailsApps/rails-composer/issues
|
11
|
+
#----------------------------------------------------------------------------
|
12
|
+
|
13
|
+
# bundler state
|
14
|
+
/.bundle
|
15
|
+
/vendor/bundle/
|
16
|
+
/vendor/ruby/
|
17
|
+
|
18
|
+
# minimal Rails specific artifacts
|
19
|
+
db/*.sqlite3
|
20
|
+
/log/*
|
21
|
+
/tmp/*
|
22
|
+
public/uploads/*
|
23
|
+
|
24
|
+
# various artifacts
|
25
|
+
**.war
|
26
|
+
*.rbc
|
27
|
+
*.sassc
|
28
|
+
.rspec
|
29
|
+
.redcar/
|
30
|
+
.sass-cache
|
31
|
+
/coverage.data
|
32
|
+
/coverage/
|
33
|
+
/db/*.javadb/
|
34
|
+
/db/*.sqlite3
|
35
|
+
/doc/api/
|
36
|
+
/doc/app/
|
37
|
+
/doc/features.html
|
38
|
+
/doc/specs.html
|
39
|
+
/public/cache
|
40
|
+
/public/stylesheets/compiled
|
41
|
+
/public/system/*
|
42
|
+
/spec/tmp/*
|
43
|
+
/cache
|
44
|
+
/capybara*
|
45
|
+
/capybara-*.html
|
46
|
+
/gems
|
47
|
+
/spec/requests
|
48
|
+
/spec/routing
|
49
|
+
/spec/views
|
50
|
+
/specifications
|
51
|
+
rerun.txt
|
52
|
+
pickle-email-*.html
|
53
|
+
|
54
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
55
|
+
# or operating system, you probably want to add a global ignore instead:
|
56
|
+
# git config --global core.excludesfile ~/.gitignore_global
|
57
|
+
#
|
58
|
+
# Here are some files you may want to ignore globally:
|
59
|
+
|
60
|
+
# scm revert files
|
61
|
+
**.orig
|
62
|
+
|
63
|
+
# Mac finder artifacts
|
64
|
+
.DS_Store
|
65
|
+
|
66
|
+
# Netbeans project directory
|
67
|
+
/nbproject/
|
68
|
+
|
69
|
+
# RubyMine project files
|
70
|
+
.idea
|
71
|
+
|
72
|
+
# Textmate project files
|
73
|
+
/*.tmproj
|
74
|
+
|
75
|
+
# vim artifacts
|
76
|
+
**.swp
|
77
|
+
>>>>>>> development
|
78
|
+
.crystal
|
79
|
+
pkg
|
80
|
+
Gemfile.lock
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Karthik T
|
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
data/Rakefile
ADDED
data/bin/crepl
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
#!env ruby
|
2
|
+
puts "Crystal REPL"
|
3
|
+
# require "pry"
|
4
|
+
require "readline"
|
5
|
+
require "tempfile"
|
6
|
+
require "open3"
|
7
|
+
PRINT_WARNINGS = false
|
8
|
+
|
9
|
+
def crystal_eval(crystal, scratch)
|
10
|
+
scratch.write("p(#{crystal})")
|
11
|
+
scratch.flush
|
12
|
+
Open3.popen3("crystal #{scratch.path}") do |stdin, stdout, stderr, wait_thr|
|
13
|
+
begin
|
14
|
+
err = stderr.read
|
15
|
+
if !err.empty?
|
16
|
+
if wait_thr.value.exitstatus == 0
|
17
|
+
puts err if PRINT_WARNINGS
|
18
|
+
else
|
19
|
+
raise err
|
20
|
+
end
|
21
|
+
end
|
22
|
+
return stdout.read
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def handle_input(input, scratch)
|
28
|
+
if input == "exit"
|
29
|
+
exit
|
30
|
+
end
|
31
|
+
scratch.truncate(0)
|
32
|
+
scratch.rewind
|
33
|
+
result = crystal_eval(input, scratch)
|
34
|
+
puts("=> #{result}")
|
35
|
+
end
|
36
|
+
|
37
|
+
Tempfile.open("crystal") do |scratch|
|
38
|
+
loop do
|
39
|
+
handle_input(Readline.readline(">> ", true), scratch)
|
40
|
+
end
|
41
|
+
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 'crystal/repl/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "crystal-repl"
|
8
|
+
spec.version = Crystal::Repl::VERSION
|
9
|
+
spec.authors = ["Karthik T"]
|
10
|
+
spec.email = ["karthikt.holmes+github@gmail.com"]
|
11
|
+
spec.summary = %q{A very simple REPL for crystal (crystal-lang.org)}
|
12
|
+
spec.description = %q{Crystal's design does not allow for a full traditional REPL. This one treats each line as indepentant crystal programs}
|
13
|
+
spec.homepage = "https://github.com/ktaragorn/crepl"
|
14
|
+
spec.license = "MIT"
|
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"
|
23
|
+
end
|
data/lib/crystal/repl.rb
ADDED
metadata
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: crystal-repl
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Karthik T
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-09-18 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: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Crystal's design does not allow for a full traditional REPL. This one
|
42
|
+
treats each line as indepentant crystal programs
|
43
|
+
email:
|
44
|
+
- karthikt.holmes+github@gmail.com
|
45
|
+
executables:
|
46
|
+
- crepl
|
47
|
+
extensions: []
|
48
|
+
extra_rdoc_files: []
|
49
|
+
files:
|
50
|
+
- ".gitignore"
|
51
|
+
- Gemfile
|
52
|
+
- LICENSE.txt
|
53
|
+
- README.md
|
54
|
+
- Rakefile
|
55
|
+
- bin/crepl
|
56
|
+
- crystal-repl.gemspec
|
57
|
+
- lib/crystal/repl.rb
|
58
|
+
- lib/crystal/repl/version.rb
|
59
|
+
homepage: https://github.com/ktaragorn/crepl
|
60
|
+
licenses:
|
61
|
+
- MIT
|
62
|
+
metadata: {}
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options: []
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
requirements: []
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 2.2.2
|
80
|
+
signing_key:
|
81
|
+
specification_version: 4
|
82
|
+
summary: A very simple REPL for crystal (crystal-lang.org)
|
83
|
+
test_files: []
|