crystalruby 0.1.10 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0499023eb26e35e6db77566876a96357202c0e6cdfafbb49d2aaa67e070c38cd'
4
- data.tar.gz: 4e5f185097b4ad5091b079fc87b43d8d950119c7fbe659a7d76fe473d8cc7cd9
3
+ metadata.gz: 3cf95b936e86d15e4cbfc45d38ee8ec4bf81a2db762fde8bcfc848d5c73dc3d6
4
+ data.tar.gz: 05d21217238b8a82b809005de6bed2af202b1d1f4fbd5f4da67588cd83f45428
5
5
  SHA512:
6
- metadata.gz: 0d27665a59a9ecc7345bcca13c5e057d71166684350d54bc158bcefe82655025fc6a8c7fd08069f92c17abe849ad465ee995f223b32391e3f49f2ff7f30c8b92
7
- data.tar.gz: ee56f2aead72e533e989b3e80c9550a65fcf78b2677dc070f697d656b1293eefecf0782fa43ac45255fced794a6a54040c32e21571723a1208b3d27babe71851
6
+ metadata.gz: 88306803e6fe56de62ceb826128767879f0cf46d1656e852deb3e98519d8dd304f151ca03ba8c505915ecc164c8663a19bdb5ea28d751e47e32cc4e8fc555902
7
+ data.tar.gz: 6b0621a641bf771a9313b652e1d503bfb734942ee1135188ad7baf68d08850577b581cb76a941861c5e2270744e289c32ce720ea4500729483ca50bd365d927f
data/README.md CHANGED
@@ -501,7 +501,7 @@ Or install it yourself as:
501
501
  $ gem install crystalruby
502
502
  ```
503
503
 
504
- `crystalruby` requires some basic initialization options inside a crystalruby.yaml file in the root of your project.
504
+ `crystalruby` supports some basic configuration options, which can be specified inside a crystalruby.yaml file in the root of your project.
505
505
  You can run `crystalruby init` to generate a configuration file with sane defaults.
506
506
 
507
507
  ```bash
@@ -513,6 +513,21 @@ crystal_src_dir: "./crystalruby/src"
513
513
  crystal_lib_dir: "./crystalruby/lib"
514
514
  crystal_main_file: "main.cr"
515
515
  crystal_lib_name: "crlib"
516
+ crystal_codegen_dir: "generated"
517
+ debug: true
518
+ ```
519
+
520
+ Alternatively, these can be set programmatically:
521
+
522
+ ```ruby
523
+ CrystalRuby.configure do |config|
524
+ config.crystal_src_dir = "./crystalruby/src"
525
+ config.crystal_lib_dir = "./crystalruby/lib"
526
+ config.crystal_main_file = "main.cr"
527
+ config.crystal_lib_name = "crlib"
528
+ config.crystal_codegen_dir = "generated"
529
+ config.debug = true
530
+ end
516
531
  ```
517
532
 
518
533
  ## Development
data/exe/crystalruby CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "bundler/setup"
4
4
  require "crystalruby"
5
- require 'fileutils'
5
+ require "fileutils"
6
6
 
7
7
  # Define the actions for the commands
8
8
  def init
@@ -14,20 +14,20 @@ def init
14
14
  crystal_main_file: "main.cr"
15
15
  crystal_lib_name: "crlib"
16
16
  crystal_codegen_dir: "generated"
17
+ debug: true
17
18
  YAML
18
19
 
19
20
  # Create the file at the root of the current directory
20
- File.write('crystalruby.yaml', yaml_content)
21
- puts 'Initialized crystalruby.yaml file with dummy content.'
21
+ File.write("crystalruby.yaml", yaml_content)
22
+ puts "Initialized crystalruby.yaml file with dummy content."
22
23
  end
23
24
 
24
-
25
25
  def install
26
26
  Dir.chdir("#{CrystalRuby.config.crystal_src_dir}") do
27
- if system('shards update')
28
- puts 'Shards installed successfully.'
27
+ if system("shards update")
28
+ puts "Shards installed successfully."
29
29
  else
30
- puts 'Error installing shards.'
30
+ puts "Error installing shards."
31
31
  end
32
32
  end
33
33
  clean
@@ -40,7 +40,7 @@ end
40
40
 
41
41
  def build
42
42
  # This is a stub for the build command
43
- puts 'Build command is not implemented yet.'
43
+ puts "Build command is not implemented yet."
44
44
  end
45
45
 
46
46
  # Main program
@@ -9,25 +9,26 @@ module CrystalRuby
9
9
  # Define a nested Config class
10
10
  class Config
11
11
  include Singleton
12
- attr_accessor :debug, :crystal_src_dir, :crystal_lib_dir, :crystal_main_file, :crystal_lib_name, :crystal_codegen_dir
12
+ attr_accessor :debug, :crystal_src_dir, :crystal_lib_dir, :crystal_main_file,
13
+ :crystal_lib_name, :crystal_codegen_dir
13
14
 
14
15
  def initialize
15
16
  @debug = true
16
- config = if File.exist?("crystalruby.yaml")
17
- YAML.safe_load(IO.read("crystalruby.yaml")) rescue {}
18
- else
19
- {}
20
- end
17
+ config = File.exist?("crystalruby.yaml") && begin
18
+ YAML.safe_load(IO.read("crystalruby.yaml"))
19
+ rescue StandardError
20
+ nil
21
+ end || {}
21
22
  @crystal_src_dir = config.fetch("crystal_src_dir", "./crystalruby/src")
22
23
  @crystal_lib_dir = config.fetch("crystal_lib_dir", "./crystalruby/lib")
23
24
  @crystal_main_file = config.fetch("crystal_main_file", "main.cr")
24
25
  @crystal_lib_name = config.fetch("crystal_lib_name", "crlib")
25
26
  @crystal_codegen_dir = config.fetch("crystal_codegen_dir", "generated")
27
+ @debug = config.fetch("debug", "true")
26
28
  end
27
29
  end
28
30
 
29
31
  def self.configure
30
- setup
31
32
  yield(config)
32
33
  end
33
34
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Crystalruby
4
- VERSION = "0.1.10"
4
+ VERSION = "0.1.11"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crystalruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wouter Coppieters