Magma 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/magma.rb +49 -0
  3. metadata +51 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c58f4f508f525510b7b3d8de186a15b54b58cb93
4
+ data.tar.gz: 70b1cdd87fca4a20c58a7c92d569adb174ece3ba
5
+ SHA512:
6
+ metadata.gz: 021b565da04677aa56fa3d0b6e381556663925576b5143fab3b7690e8c8bfef454f5d11ae912cf93590c337a7609c99f9be2e2af6a162d17fd386ea0183dc355
7
+ data.tar.gz: 41e1a9ee5fe685a7cbffcc4291dcae7ac6fc3ac48a93f49c8a238bed626626a4c1e7f2ab2598c854072d1709023b20bc5f0b8dbeed27edb190ed7370134accad
data/lib/magma.rb ADDED
@@ -0,0 +1,49 @@
1
+ def magmaversion
2
+ return '0.1'
3
+ end
4
+ def magtutor
5
+ tutorline=<<-'FINISH'
6
+ Hello there, and welcome to Magma. This is Magma tutor. It is a built-in tutorial to help you understand Magma. Let us begin.
7
+
8
+ =============1. Setup=============
9
+ To start up Magma in a Ruby script, add a line to the top of the script, like this:
10
+ require "magma"; #< Semicolon unnessary, but helps in .min.rb files
11
+ After that line, we must test magma. Check the value of the Magma? environment variable to do so. If the value returned is true, then magma is ready. If the value returned is nil, then Magma has an error, and is not ready. Use this code to get a boolean (true or false) value for if Magma is ready:
12
+ if (ENV["magma?"]==true) then;return true; else; return false; end
13
+ Now that we know that magma is ready, we can start! Proceed to part 2.
14
+ =============2. CommandLine========
15
+ It is important to know that Magma is completely Ruby code. But using Magma, you can run shell scripts! Using magma, you can execute shell script commands, and see and check their outcomes. A built-in object called CommandLine exists when Magma is ready. This object contains methods for accessing command line info. Try running this:
16
+ CommandLine.execute('ls')
17
+ If you are familiar with the Unix ls command, remember that it lists all files in the current directory. When running the code above, you will see the files, in Ruby! It will also return the files, [but in an unorganized string, which can be organized into an array later]. Also, if you would like to find what Command Line Viewer program (aka Command Prompt, Mac Terminal, iTerm, etc) the user is running, use this command:
18
+ CommandLine.program()
19
+
20
+
21
+
22
+
23
+ FINISH
24
+ puts tutorline; puts "\n\n"; return tutorLine
25
+ end
26
+
27
+ def exec(execution)
28
+ execc=(eval("`"+execution+"`") or eval("%x("+execution+")")
29
+ puts execc
30
+ return execc
31
+ end
32
+ module CommandLine
33
+ def execute(execution)
34
+ execc=(eval("`"+execution+"`") or eval("%x("+execution+")")
35
+ puts execc
36
+ return execc
37
+ end
38
+ def program
39
+ return ENV["TERM_PROGRAM"]
40
+ end
41
+ end
42
+ module Bedrock
43
+ def operatingsystem
44
+ return [ ENV["_system_name"],ENV["_system_version"],ENV["_system_arch"],ENV["_system_type"],ENV["COMMAND_MODE"]]
45
+ end
46
+ def commandline
47
+ return Commandline
48
+ end
49
+ end
metadata ADDED
@@ -0,0 +1,51 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: Magma
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.1
5
+ platform: ruby
6
+ authors:
7
+ - ThinkLikeGeek
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-02-21 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: An advanced pure Ruby tool extension, with special tools primarily hidden
14
+ in normal Ruby, but exposed in MagmaRB
15
+ email: tt2d@icloud.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/magma.rb
21
+ homepage: ''
22
+ licenses:
23
+ - MIT
24
+ metadata: {}
25
+ post_install_message: |-
26
+ Thank you for installing Magma! After first requiring magma, youcan use it's incredible features. To use magma in Ruby scripts, type this:
27
+ require 'magma'
28
+
29
+ Thanks!
30
+ rdoc_options: []
31
+ require_paths:
32
+ - lib
33
+ required_ruby_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - '>='
36
+ - !ruby/object:Gem::Version
37
+ version: 1.8.7
38
+ required_rubygems_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - '>='
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ requirements:
44
+ - Ruby (on macs this is pre-installed) version 1.8.7 or later
45
+ - A computer with an Intel processor (not required but will help)
46
+ rubyforge_project:
47
+ rubygems_version: 2.2.1
48
+ signing_key:
49
+ specification_version: 4
50
+ summary: Some top-level underground tools you thought Ruby never had
51
+ test_files: []