Class: Capricorn::Util::Internal
- Inherits:
-
Capricorn::Util
- Object
- Thor
- Capricorn::Util
- Capricorn::Util::Internal
- Defined in:
- lib/capricorn-util/internal.rb
Instance Method Summary collapse
Methods inherited from Capricorn::Util
banner, #help, #method_missing
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Capricorn::Util
Instance Method Details
#inspector ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/capricorn-util/internal.rb', line 24 def inspector Erlang do |path| unless File.extname(path) == ".gem" and File.file?(path) error :not_found end begin format = Gem::Format.from_file_by_path(path) rescue Exception => e error :gem_error, e. end spec = format.spec unless spec error :gem_error, "Invalid gem" end dependencies = spec.runtime_dependencies.collect do |dep| version_requirements = dep.version_requirements.as_list.collect do |req| op, version = *req.split(/\s+/, 2) BERT::Tuple[op, version] end BERT::Tuple[dep.name, version_requirements] end send BERT::Tuple[spec.name, spec.version.to_s, dependencies] end end |
#scaffolder ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/capricorn-util/internal.rb', line 8 def scaffolder Erlang do |cmd| case cmd.shift when :create recipe = cmd.shift app = convert_app(cmd.first) recipe_path = File.("../../lib/capricorn/recipes/#{recipe}.rb", __FILE__) ctx = Capricorn::SystemContext.run(recipe_path, :application => app) send t[true, t[ctx.www_user, ctx.www_group, ctx.root_path]] end end end |