beaver-build 0.1.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/beaver +79 -0
  3. data/lib/beaver.rb +1 -1
  4. metadata +8 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a00331b274e731341ca50bccc73fa013c5449673ee30a9beea5b0a01259ffac7
4
- data.tar.gz: 209d69ad346136143bbc4c612f10fd22e04db7eb55b602dd02d189ef48bd6947
3
+ metadata.gz: ace78ab68116b7ea0748f4afd8afa6fc5a7419dce452b2eac63c8f5f88a2e383
4
+ data.tar.gz: '09ca079efe80ff36931176d874020ef987fd2ec645136bb56c10f410f59223f1'
5
5
  SHA512:
6
- metadata.gz: 5580ebbb545b2e2a45d05db57827aaacb3bd4fd712f4f45adece1bcf8bc6600c32f207c32de0edb8c90c66286fb827052aef1fe47652f5962af34a502c19c985
7
- data.tar.gz: 98a08e5c318ad7700b49a5362bd7f891363538f12230db73cac35eec0496a7a54d4345c04345906a97ec398cb9ab8ce095e527c7c96007046227c4839e597ba3
6
+ metadata.gz: 0acc179794281ac8c06f63ec953ccbf08f5ae80bc248657bb20d80844dd344c6295fae2c5d6cf4ee15a4444f5932e42f004bd94f2190a406d62de8f9790e2f04
7
+ data.tar.gz: d01832c2d0ee507f5a716459e97c4920ac30411d92c0796366aa15f0035d5709ab8e4ad58bccde0a1caf46f0dab3c492a4f17696a9b4663ff4680832749a8484
data/bin/beaver ADDED
@@ -0,0 +1,79 @@
1
+ #!/usr/bin/env ruby
2
+ require 'beaver'
3
+
4
+ class ArgumentParser
5
+ def collect
6
+ if ARGV[0] == nil
7
+ @clargs = [:help]
8
+ else
9
+ @clargs = ARGV
10
+ end
11
+ end
12
+
13
+ def args
14
+ return @clargs
15
+ end
16
+ end
17
+
18
+ class BeaverCLI
19
+ def initialize(arguments)
20
+ @args = arguments
21
+ end
22
+
23
+ def exec
24
+ case @args[0].to_sym
25
+ when :help
26
+ puts %{usage: \e[32mbeaver\e[0m \e[33m[command] [args]\e[0m
27
+ \e[32minit\e[0m \e[33m[name]\e[0m
28
+ Initialize a new beaver project with an optional \e[33mname\e[0m for the beaver file.
29
+ }
30
+ when :init
31
+ if (@args[1] != nil)
32
+ @_init_beaverFileName = @args[1]
33
+ else
34
+ @_init_beaverFileName = "make"
35
+ end
36
+ self._init
37
+ end
38
+ end
39
+
40
+ def _init
41
+ # gitignore file
42
+ openType = nil
43
+ if File.file?(".gitignore")
44
+ openType = 'a'
45
+ else
46
+ openType = 'w'
47
+ end
48
+
49
+ File.open(".gitignore", openType) do |f|
50
+ if openType == 'a'
51
+ f << "\n"
52
+ end
53
+ f.puts ".beaver"
54
+ end
55
+
56
+ # Make beaver file
57
+ contents = %{#!/usr/bin/env ruby
58
+ require 'beaver'
59
+
60
+ command :example do
61
+ puts "Hello Beaver!"
62
+ end
63
+
64
+ $beaver.end}
65
+
66
+ File.open("#{@_init_beaverFileName}.rb", "w") do |f|
67
+ f.write contents
68
+ end
69
+
70
+ system "chmod +x #{@_init_beaverFileName}.rb"
71
+
72
+ puts "New Beaver project initialized."
73
+ end
74
+ end
75
+
76
+ arg_parser = ArgumentParser.new
77
+ arg_parser.collect
78
+ cli = BeaverCLI.new(arg_parser.args)
79
+ cli.exec
data/lib/beaver.rb CHANGED
@@ -56,5 +56,5 @@ class Beaver
56
56
  end
57
57
  end
58
58
 
59
- # Global beaverr object@
59
+ # Global beaver object
60
60
  $beaver = Beaver.new
metadata CHANGED
@@ -1,21 +1,25 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaver-build
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Everaert
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-15 00:00:00.000000000 Z
11
+ date: 2022-08-16 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description:
13
+ description: |-
14
+ Beaver is an easy to understand build tool with a lot of capabilities.
15
+ Documentation and examples on [github](https://github.com/jomy10/beaver) (https://github.com/jomy10/beaver).
14
16
  email:
15
- executables: []
17
+ executables:
18
+ - beaver
16
19
  extensions: []
17
20
  extra_rdoc_files: []
18
21
  files:
22
+ - bin/beaver
19
23
  - lib/FileInfo.rb
20
24
  - lib/alias.rb
21
25
  - lib/beaver.rb