-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from imdrasil/add-crystal-0.35-support
Add crystal 0.35 support
- Loading branch information
Showing
18 changed files
with
349 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
language: crystal | ||
env: | ||
- TERM=xterm-256color | ||
before_script: | ||
- crystal examples/sam.cr -- setup | ||
- crystal examples/sam.cr setup | ||
script: ./bin/ameba && crystal spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
name: sam | ||
version: 0.3.2 | ||
version: 0.4.0 | ||
|
||
authors: | ||
- Roman Kalnytskyi <[email protected]> | ||
|
||
crystal: 0.30.1 | ||
crystal: 0.35.1 | ||
|
||
license: MIT | ||
|
||
development_dependencies: | ||
ameba: | ||
github: crystal-ameba/ameba | ||
version: "= 0.13.0" | ||
|
||
scripts: | ||
postinstall: "false | [ -f ../../sam.cr ] && true || cp -i examples/sam.template ../../sam.cr 2>/dev/null" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
require "./spec_helper" | ||
|
||
describe Sam::Makefile do | ||
makefile = Sam::Makefile.new("src/sam.cr") | ||
|
||
describe "#generate" do | ||
declaration_part = <<-FILE | ||
# === Sam shortcut | ||
# next lines are autogenerated and any changes will be discarded after regenerating | ||
CRYSTAL_BIN ?= `which crystal` | ||
SAM_PATH ?= "src/sam.cr" | ||
.PHONY: sam | ||
sam: | ||
\t$(CRYSTAL_BIN) $(SAM_PATH) $(filter-out $@,$(MAKECMDGOALS)) | ||
%: | ||
\t@: | ||
# === Sam shortcut\n | ||
FILE | ||
makefile_path = "Makefile" | ||
|
||
it "creates new makefile" do | ||
begin | ||
File.exists?(makefile_path).should eq(false) | ||
makefile.generate | ||
File.read(makefile_path).should eq(declaration_part) | ||
ensure | ||
File.delete(makefile_path) if File.exists?(makefile_path) | ||
end | ||
end | ||
|
||
it "correctly regenerates existing file" do | ||
begin | ||
File.exists?(makefile_path).should eq(false) | ||
File.write(makefile_path, "# before\n" + declaration_part + "# after\n") | ||
makefile.generate | ||
File.read(makefile_path).should eq("# before\n# after\n" + declaration_part) | ||
ensure | ||
File.delete(makefile_path) if File.exists?(makefile_path) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
require "./spec_helper" | ||
|
||
describe Sam::ShellTable do | ||
describe "#generate" do | ||
it "generates correct table" do | ||
fail "terminal should has width 80" if `tput cols`.to_i != 80 | ||
|
||
namespace = Sam::Namespace.new("name", nil) | ||
Sam::ShellTable.new([ | ||
Sam::Task.new( | ||
-> {}, | ||
%w[], | ||
namespace, | ||
"short_name", | ||
"but very long description, such long that it requires multiple lines to be written" | ||
), | ||
Sam::Task.new( | ||
-> {}, | ||
%w[], | ||
namespace, | ||
"very_long_task_name_such_long_that_it_requires_multiple_lines_to_be_written", | ||
"and short description" | ||
), | ||
]).generate.should eq( | ||
<<-TEXT | ||
Name Description | ||
-------------------------------------- | --------------------------------------- | ||
short_name | but very long description, such long th | ||
| at it requires multiple lines to be wri | ||
| tten | ||
very_long_task_name_such_long_that_it_ | and short description | ||
requires_multiple_lines_to_be_written | \n | ||
TEXT | ||
) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ end | |
|
||
Spec.before_each do | ||
Container.clear | ||
Sam.root_namespace.all_tasks.each(&.reenable) | ||
end | ||
|
||
# Tasks | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.