erlbox 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,105 @@
1
+ ## -------------------------------------------------------------------
2
+ ##
3
+ ## Erlang Toolbox: Rake Utilities
4
+ ## Copyright (c) 2008 The Hive http://www.thehive.com/
5
+ ##
6
+ ## Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ ## of this software and associated documentation files (the "Software"), to deal
8
+ ## in the Software without restriction, including without limitation the rights
9
+ ## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ ## copies of the Software, and to permit persons to whom the Software is
11
+ ## furnished to do so, subject to the following conditions:
12
+ ##
13
+ ## The above copyright notice and this permission notice shall be included in
14
+ ## all copies or substantial portions of the Software.
15
+ ##
16
+ ## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ ## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ ## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ ## AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ ## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ ## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ ## THE SOFTWARE.
23
+ ##
24
+ ## -------------------------------------------------------------------
25
+
26
+ def debug?
27
+ !ENV['debug'].nil?
28
+ end
29
+
30
+ def verbose?
31
+ !ENV['verbose'].nil?
32
+ end
33
+
34
+ def print_flags(flags)
35
+ flags.join(' ')
36
+ end
37
+
38
+ def append_flags(flags, value)
39
+ flags << value
40
+ end
41
+
42
+ def abspath(path)
43
+ Pathname.new(path).realpath.to_s
44
+ end
45
+
46
+ def expand_path(path)
47
+ # erlc requires multiple -pa arguments and erl supports it
48
+ # so I am treating them the same here
49
+ path.empty? ? '' : "-pa #{path.join(' -pa ')}"
50
+ end
51
+
52
+ def erl_run(script, args = "", extra_args = {})
53
+ if extra_args[:erl_root]
54
+ cmd = File.join(extra_args[:erl_root], "bin", "erl")
55
+ else
56
+ cmd = "erl"
57
+ end
58
+ `#{cmd} -eval '#{script}' -s erlang halt #{args} -noshell 2>&1`.strip
59
+ end
60
+
61
+ def erl_where(lib, dir = 'include')
62
+ script = <<-ERL
63
+ io:format("~s\n", [filename:join(code:lib_dir(#{lib}), #{dir})])
64
+ ERL
65
+ erl_run(script)
66
+ end
67
+
68
+ def erl_app_version(app, extra_args = {})
69
+ script = <<-ERL
70
+ ok = application:load(#{app}),
71
+ {ok, Vsn} = application:get_key(#{app}, vsn),
72
+ io:format("~s\\n", [Vsn]).
73
+ ERL
74
+ output = erl_run(script, "-pa ebin", extra_args)
75
+ output.strip()
76
+ end
77
+
78
+ def erl_app_modules(app)
79
+ script = <<-ERL
80
+ ok = application:load(#{app}),
81
+ {ok, M} = application:get_key(#{app}, modules),
82
+ [io:format("~s\\n", [Mod]) || Mod <- M].
83
+ ERL
84
+
85
+ output = erl_run(script, "-pa ebin")
86
+ if output[/badmatch/]
87
+ puts "Error processing .app file: #{output}"
88
+ else
89
+ output.split("\n")
90
+ end
91
+ end
92
+
93
+ # Returns true if running on Linux
94
+ def linux?
95
+ platform? 'linux'
96
+ end
97
+
98
+ # Returns true if running on Darwin/MacOS X
99
+ def darwin?
100
+ platform? 'darwin'
101
+ end
102
+
103
+ def platform?(name)
104
+ RUBY_PLATFORM =~ /#{name}/i
105
+ end
data/lib/erlbox.rb ADDED
@@ -0,0 +1,43 @@
1
+ ## -------------------------------------------------------------------
2
+ ##
3
+ ## Erlang Toolbox: Bootstrap file
4
+ ## Copyright (c) 2008 The Hive http://www.thehive.com/
5
+ ##
6
+ ## Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ ## of this software and associated documentation files (the "Software"), to deal
8
+ ## in the Software without restriction, including without limitation the rights
9
+ ## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ ## copies of the Software, and to permit persons to whom the Software is
11
+ ## furnished to do so, subject to the following conditions:
12
+ ##
13
+ ## The above copyright notice and this permission notice shall be included in
14
+ ## all copies or substantial portions of the Software.
15
+ ##
16
+ ## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ ## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ ## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ ## AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ ## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ ## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ ## THE SOFTWARE.
23
+ ##
24
+ ## -------------------------------------------------------------------
25
+
26
+ require 'set'
27
+ require 'rake'
28
+ require 'rake/clean'
29
+ require 'pathname'
30
+
31
+ libdir = Pathname(__FILE__).dirname
32
+ $:.unshift(libdir) unless $:.include?(libdir) || $:.include?(libdir.expand_path)
33
+
34
+ verbose false
35
+
36
+ require 'erlbox/utils'
37
+ require 'erlbox/build'
38
+ require 'erlbox/test'
39
+ require 'erlbox/eunit'
40
+ require 'erlbox/edoc'
41
+ require 'erlbox/faxien'
42
+ require 'erlbox/dialyzer'
43
+ require 'erlbox/install'
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: erlbox
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.5.1
5
+ platform: ruby
6
+ authors:
7
+ - Phillip Toland
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-06-22 00:00:00 -05:00
13
+ default_executable: erlbox
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rake
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.8.4
24
+ version:
25
+ description: Rake tasks and helper scripts for building Erlang applications.
26
+ email: phil.toland@gmail.com
27
+ executables:
28
+ - erlbox
29
+ extensions: []
30
+
31
+ extra_rdoc_files:
32
+ - LICENSE
33
+ - README.txt
34
+ files:
35
+ - .gitignore
36
+ - LICENSE
37
+ - README.txt
38
+ - Rakefile
39
+ - VERSION.yml
40
+ - bin/erlbox
41
+ - erlbox.gemspec
42
+ - lib/erlbox.rb
43
+ - lib/erlbox/build.rb
44
+ - lib/erlbox/dialyzer.rb
45
+ - lib/erlbox/driver.rb
46
+ - lib/erlbox/edoc.rb
47
+ - lib/erlbox/eunit
48
+ - lib/erlbox/eunit.rb
49
+ - lib/erlbox/faxien.rb
50
+ - lib/erlbox/install.rb
51
+ - lib/erlbox/recurse.rb
52
+ - lib/erlbox/release.rb
53
+ - lib/erlbox/snmp.rb
54
+ - lib/erlbox/test.rb
55
+ - lib/erlbox/utils.rb
56
+ has_rdoc: false
57
+ homepage: http://github.com/toland/erlbox
58
+ licenses: []
59
+
60
+ post_install_message:
61
+ rdoc_options:
62
+ - --charset=UTF-8
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: "0"
70
+ version:
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: "0"
76
+ version:
77
+ requirements: []
78
+
79
+ rubyforge_project: erlbox
80
+ rubygems_version: 1.3.2
81
+ signing_key:
82
+ specification_version: 3
83
+ summary: Erlang Toolbox
84
+ test_files: []
85
+