From 97ffdc78afcd5f0d7f0cc8dd4678fd0bda8a5228 Mon Sep 17 00:00:00 2001 From: RX14 Date: Thu, 21 Dec 2017 14:01:32 +0000 Subject: [PATCH] Use shards version in crystal init tool --- spec/compiler/crystal/tools/init_spec.cr | 13 +++---------- src/compiler/crystal/tools/init.cr | 1 - .../crystal/tools/init/template/example.cr.ecr | 4 ++-- .../crystal/tools/init/template/version.cr.ecr | 3 --- 4 files changed, 5 insertions(+), 16 deletions(-) delete mode 100644 src/compiler/crystal/tools/init/template/version.cr.ecr diff --git a/spec/compiler/crystal/tools/init_spec.cr b/spec/compiler/crystal/tools/init_spec.cr index fc582ba8a473..a90478f0db34 100644 --- a/spec/compiler/crystal/tools/init_spec.cr +++ b/spec/compiler/crystal/tools/init_spec.cr @@ -120,18 +120,11 @@ dependencies: end describe_file "example/src/example.cr" do |example| - example.should eq(%{require "./example/*" - -# TODO: Write documentation for `Example` + example.should eq(%{# TODO: Write documentation for `Example` module Example - # TODO: Put your code here -end -}) - end + VERSION = {{ `shards version \#{__DIR__}`.chomp.stringify }} - describe_file "example/src/example/version.cr" do |version| - version.should eq(%{module Example - VERSION = "0.1.0" + # TODO: Put your code here end }) end diff --git a/src/compiler/crystal/tools/init.cr b/src/compiler/crystal/tools/init.cr index 8759f761d40b..9b63e37bc904 100644 --- a/src/compiler/crystal/tools/init.cr +++ b/src/compiler/crystal/tools/init.cr @@ -200,7 +200,6 @@ module Crystal template ShardView, "shard.yml.ecr", "shard.yml" template SrcExampleView, "example.cr.ecr", "src/#{config.name}.cr" - template SrcVersionView, "version.cr.ecr", "src/#{config.name}/version.cr" template SpecHelperView, "spec_helper.cr.ecr", "spec/spec_helper.cr" template SpecExampleView, "example_spec.cr.ecr", "spec/#{config.name}_spec.cr" diff --git a/src/compiler/crystal/tools/init/template/example.cr.ecr b/src/compiler/crystal/tools/init/template/example.cr.ecr index 1e81ff16a1d5..cd95362a8f12 100644 --- a/src/compiler/crystal/tools/init/template/example.cr.ecr +++ b/src/compiler/crystal/tools/init/template/example.cr.ecr @@ -1,6 +1,6 @@ -require "./<%= config.name %>/*" - # TODO: Write documentation for `<%= module_name %>` module <%= module_name %> + VERSION = {{ `shards version #{__DIR__}`.chomp.stringify }} + # TODO: Put your code here end diff --git a/src/compiler/crystal/tools/init/template/version.cr.ecr b/src/compiler/crystal/tools/init/template/version.cr.ecr deleted file mode 100644 index 39bac79b7ba0..000000000000 --- a/src/compiler/crystal/tools/init/template/version.cr.ecr +++ /dev/null @@ -1,3 +0,0 @@ -module <%= module_name %> - VERSION = "0.1.0" -end