Module: Gordon::Cookery::Common
- Included in:
- DependencyResolver, HttpServer, Init, Standalone, WebServer, JavaStandaloneApp, JavaWebApp, RubyStandaloneApp, RubyWebApp
- Defined in:
- lib/gordon/cookery/common.rb
Constant Summary collapse
- MAIN_BLACKLIST_FILES =
%w(.git .gitignore .pki Vagrantfile cruise-output)
Class Method Summary collapse
Instance Method Summary collapse
- #all_files_except_blacklisted(*custom_blacklist_files) ⇒ Object
- #create_skeleton_type(type) ⇒ Object
- #get_skeleton_path_from_type(env_vars, type) ⇒ Object
Class Method Details
.included(base) ⇒ Object
6 7 8 |
# File 'lib/gordon/cookery/common.rb', line 6 def self.included(base) base.send(:extend, self) end |
Instance Method Details
#all_files_except_blacklisted(*custom_blacklist_files) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/gordon/cookery/common.rb', line 20 def all_files_except_blacklisted(*custom_blacklist_files) blacklist = (MAIN_BLACKLIST_FILES + custom_blacklist_files).flatten # TODO: create a way to make a performatic grep here to avoid undesired/directory/* files = Dir['{*,.*}'].sort[2..-1].reject do |entry| pattern = entry.gsub(/\./, '\.').gsub(/\//, '\/') found = blacklist.grep(/#{pattern}/i) found.any? end files end |
#create_skeleton_type(type) ⇒ Object
16 17 18 |
# File 'lib/gordon/cookery/common.rb', line 16 def create_skeleton_type(type) Skeleton::Factory.create(type) end |
#get_skeleton_path_from_type(env_vars, type) ⇒ Object
10 11 12 13 14 |
# File 'lib/gordon/cookery/common.rb', line 10 def get_skeleton_path_from_type(env_vars, type) skeleton_type = create_skeleton_type(type) appended_path = skeleton_type.requires_app_name? ? env_vars.app_name : '' skeleton_type.path(appended_path) end |