Module: RoCommands

Defined in:
lib/ro_commands/base.rb,
lib/ro_commands.rb,
lib/ro_commands/gem.rb,
lib/ro_commands/git.rb,
lib/ro_commands/try.rb,
lib/ro_commands_bin.rb,
lib/ro_commands/info.rb,
lib/ro_commands/init.rb,
lib/ro_commands/misc.rb,
lib/ro_commands/zeus.rb,
lib/ro_commands/rails.rb,
lib/ro_commands/video.rb,
lib/ro_commands/crawler.rb,
lib/ro_commands/ro_gist.rb,
lib/ro_commands/version.rb,
lib/ro_commands/generate.rb,
lib/ro_commands/git_flow.rb,
lib/ro_commands/navigate.rb,
lib/ro_commands/refactor.rb,
lib/ro_commands/ro_procs.rb,
lib/ro_commands/rubymine.rb,
lib/ro_commands/processes.rb,
lib/ro_commands/shortcuts.rb,
lib/ro_commands/typography.rb,
lib/ro_commands/file_actions.rb,
lib/ro_commands/generators/ex.rb,
lib/ro_commands/generators/rodebug.rb,
lib/ro_commands/generators/spec_file.rb,
lib/ro_helpers/all_ro_commands_files.rb,
lib/ro_commands/generators/rails_new_app.rb,
lib/ro_commands/generators/base_generator.rb,
lib/ro_commands/generators/rails_generator.rb

Overview

Thor.class_eval do

def self.desc(usage, description, options={})
  if options[:for]
    command = find_and_refresh_command(options[:for])
    command.usage = usage if usage
    command.description = description if description
  else
    @usage, @desc, @hide = "#{$ro_commands_argument} #{usage}", description, options[:hide] || false
  end
end

end

Defined Under Namespace

Modules: Generators Classes: Base, Crawler, FileActions, Gem, Generate, Git, GitFlow, Info, Init, Misc, Navigate, Processes, Rails, Refactor, RoGist, RoProcs, Rubymine, Shortcuts, Try, Typography, Video, Zeus

Constant Summary collapse

VERSION =
"0.0.4"

Class Method Summary collapse

Class Method Details

.autoload_files_in(dir) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/ro_commands.rb', line 11

def self.autoload_files_in(dir)
  Dir[File.join File.expand_path("../#{dir}", __FILE__), "**"].each do |file|
    if file[/\.rb$/]
      module_name = File.basename(file).gsub(/\.rb/, '').camelize
      autoload module_name.to_sym, file
      autoload module_name.upcase, file
    end
  end
end

.file_mapObject



6
7
8
9
10
# File 'lib/ro_helpers/all_ro_commands_files.rb', line 6

def file_map
  @meth_map.flatten! if @meth_map.respond_to?(:flatten!)
  @meth_map.uniq! if @meth_map.respond_to?(:uniq!)
  @meth_map ||= {}
end

.get_files(project_root) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ro_helpers/all_ro_commands_files.rb', line 19

def get_files(project_root)
  ro_commands_dir = Dir[File.join(project_root, "lib/ro_commands/**")]

  if ro_commands_dir.empty?
    Out.warn("can't find ro_commands dir in #{project_root}", "file:#{File.basename __FILE__} line:#{__LINE__}")
    []
  else
    files = ro_commands_dir.select do |f|
      test(?f, f) and f.match(%r{(.+)\.rb$})
    end.delete_if do |f|
      f = File.basename(f)
      f.match(%r{(all|version|ro_helper|hook|out)\.rb$})
    end
  end
end

.set_file_map(project_root, port_prefix) ⇒ Object



12
13
14
15
16
17
# File 'lib/ro_helpers/all_ro_commands_files.rb', line 12

def set_file_map(project_root, port_prefix)
  files = get_files(project_root)
  unless files.empty?
    set_port(files, port_prefix)
  end
end

.set_port(files, port_prefix) ⇒ Object



35
36
37
38
39
# File 'lib/ro_helpers/all_ro_commands_files.rb', line 35

def set_port(files, port_prefix)
  files.each_with_index do |file, i|
    file_map[file.to_sym] = "#{port_prefix}00".to_i + i
  end
end