summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorFredrik Vihlborg <frvi@transmode.se>2014-08-28 18:13:12 +0200
committerFredrik Vihlborg <frvi@transmode.se>2014-08-28 18:13:12 +0200
commite42fc5d3b48b1dfe7d7ca9d60342727245842627 (patch)
tree73fc1747310de7332340de83538589efa212a1db /lib
parent6c6d71cee1056be596af40921761eeebee368828 (diff)
Possible to skip overwrites when installing widget.
Diffstat (limited to 'lib')
-rw-r--r--lib/dashing/cli.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/dashing/cli.rb b/lib/dashing/cli.rb
index 27d8f6b..4b93f89 100644
--- a/lib/dashing/cli.rb
+++ b/lib/dashing/cli.rb
@@ -38,12 +38,12 @@ module Dashing
puts "Invalid generator. Either use widget, dashboard, or job"
end
- desc "install GIST_ID", "Installs a new widget from a gist."
- def install(gist_id)
+ desc "install GIST_ID [--skip]", "Installs a new widget from a gist (skip overwrite)."
+ def install(gist_id, *args)
gist = Downloader.get_gist(gist_id)
public_url = "https://gist.github.com/#{gist_id}"
- install_widget_from_gist(gist)
+ install_widget_from_gist(gist, args.include?('--skip'))
print set_color("Don't forget to edit the ", :yellow)
print set_color("Gemfile ", :yellow, :bold)
@@ -89,15 +89,15 @@ module Dashing
system(command)
end
- def install_widget_from_gist(gist)
+ def install_widget_from_gist(gist, skip_overwrite)
gist['files'].each do |file, details|
if file =~ /\.(html|coffee|scss)\z/
widget_name = File.basename(file, '.*')
new_path = File.join(Dir.pwd, 'widgets', widget_name, file)
- create_file(new_path, details['content'])
+ create_file(new_path, details['content'], :skip => skip_overwrite)
elsif file.end_with?('.rb')
new_path = File.join(Dir.pwd, 'jobs', file)
- create_file(new_path, details['content'])
+ create_file(new_path, details['content'], :skip => skip_overwrite)
end
end
end