Class: Yuzu::Command::PublicationCommand

Inherits:
Base show all
Includes:
Uploader
Defined in:
lib/yuzu/commands/base.rb

Overview

The base class for all commands regarding publishing contents, e.g. preview, stage, publish.

Direct Known Subclasses

Preview, Publish, Stage

Constant Summary

Constants included from Uploader

Uploader::ENDC, Uploader::GREEN

Instance Attribute Summary

Attributes inherited from Base

#args

Instance Method Summary collapse

Methods inherited from Base

help, #initialize, requires_config?, service_override, shell, #updater, #uploader, #uploader_config

Constructor Details

This class inherits a constructor from Yuzu::Command::Base

Instance Method Details

#allObject



85
86
87
88
# File 'lib/yuzu/commands/base.rb', line 85

def all
  updater.update_all
  updater.done
end

#assetsObject



117
118
119
120
# File 'lib/yuzu/commands/base.rb', line 117

def assets
  updater.upload_all_assets
  updater.done
end

#changedObject



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/yuzu/commands/base.rb', line 122

def changed
#  git_diff_output = `git diff --name-only --diff-filter=AMRX`
#  changed_files = git_diff_output.split("\n")
#  updatable_files = changed_files.reject {|f| File.extname(f).includes_one_of?( @config['extension_blacklist'] )}

#  puts "Found changes to these files:\n" + updatable_files.join("\n").to_s
#  puts

#  updater.update_these(updatable_files)

#  puts "Looking for new images to upload..."

#  # Traverse images and upload if new.
#  catalog = File.open("images-preview.yml","a+") rescue nil

#  unless catalog.nil?
#    catalog.rewind
#    image_paths = catalog.readlines
#    known_images = image_paths.collect {|img| img.strip}
#    new_images = updater.upload_new_images known_images
#    catalog.puts(new_images.join("\n"))
#    catalog.close
#  end

#  updater.done
end

#cssObject



101
102
103
104
105
# File 'lib/yuzu/commands/base.rb', line 101

def css
  $stderr.puts `compass compile` if @config.has_compass?
  updater.upload_all_css
  updater.done
end

#imagesObject



107
108
109
110
111
112
113
114
115
# File 'lib/yuzu/commands/base.rb', line 107

def images
  images = updater.upload_all_images

  catalog = File.open("_images.yml","w")
  catalog.puts(images.join("\n"))
  catalog.close

  updater.done
end

#indexObject



80
81
82
83
# File 'lib/yuzu/commands/base.rb', line 80

def index
  updater.update_these(@args)
  updater.done
end

#resourcesObject



95
96
97
98
99
# File 'lib/yuzu/commands/base.rb', line 95

def resources
  $stderr.puts `compass compile` if @config.has_compass?
  updater.upload_all_resources
  updater.done
end

#textObject



90
91
92
93
# File 'lib/yuzu/commands/base.rb', line 90

def text
  updater.update_text
  updater.done
end