Class: Shard::Saver
- Inherits:
-
Object
- Object
- Shard::Saver
- Includes:
- ShardDirectory
- Defined in:
- lib/shard/saver.rb
Constant Summary collapse
- SHA_LENGTH =
8
Instance Attribute Summary collapse
-
#full_gist ⇒ Object
readonly
Returns the value of attribute full_gist.
-
#gist ⇒ Object
readonly
Returns the value of attribute gist.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#ref ⇒ Object
readonly
Returns the value of attribute ref.
Class Method Summary collapse
-
.save(shard_line, options = {}) ⇒ Object
# Class Methods # #.
Instance Method Summary collapse
-
#initialize(shard_line_or_ref, options = {}) ⇒ Saver
constructor
# Constructor # #.
-
#save! ⇒ Object
# Instance Methods # #.
Methods included from ShardDirectory
#create_shard_dir, #directory, #file_path, #find_file_path, #find_file_paths, #root_path, #shard_dir_exists?
Constructor Details
Instance Attribute Details
#full_gist ⇒ Object (readonly)
Returns the value of attribute full_gist.
13 14 15 |
# File 'lib/shard/saver.rb', line 13 def full_gist @full_gist end |
#gist ⇒ Object (readonly)
Returns the value of attribute gist.
13 14 15 |
# File 'lib/shard/saver.rb', line 13 def gist @gist end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
13 14 15 |
# File 'lib/shard/saver.rb', line 13 def @options end |
#ref ⇒ Object (readonly)
Returns the value of attribute ref.
13 14 15 |
# File 'lib/shard/saver.rb', line 13 def ref @ref end |
Class Method Details
.save(shard_line, options = {}) ⇒ Object
# Class Methods #
#
34 35 36 |
# File 'lib/shard/saver.rb', line 34 def self.save(shard_line, = {}) new(shard_line, ).save! end |
Instance Method Details
#save! ⇒ Object
# Instance Methods #
#
44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/shard/saver.rb', line 44 def save! return if shard_dir_exists?(ref) && [:lazy] create_shard_dir(ref) fetch_shard_contents gist.all_files.each do |file| write_file(file) end if [:verbose] puts "VERSION #{ version }..." end end |