From 9bbdfdce598daa12fbb3916bc270957ad4b5b3db Mon Sep 17 00:00:00 2001 From: Chad Perrin Date: Sat, 25 Jan 2014 12:17:29 -0700 Subject: [PATCH 01/11] moving executable and config into appropriate directories --- cons => bin/cons | 0 config.default => etc/config.default | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename cons => bin/cons (100%) rename config.default => etc/config.default (100%) diff --git a/cons b/bin/cons similarity index 100% rename from cons rename to bin/cons diff --git a/config.default b/etc/config.default similarity index 100% rename from config.default rename to etc/config.default From a5421bbfadb0f3f33487cb1bcc8ee0121ed37888 Mon Sep 17 00:00:00 2001 From: Chad Perrin Date: Sat, 25 Jan 2014 12:32:16 -0700 Subject: [PATCH 02/11] added setup functionality to cons executable --- bin/cons | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/bin/cons b/bin/cons index 26472ee..17992c4 100755 --- a/bin/cons +++ b/bin/cons @@ -6,6 +6,30 @@ # see README.org for instructions +if (ARGV[0] == 'config') + unless File.exists? (configfile = File.join(ENV['HOME'], '.cons_config.rb')) + File.new(configfile, 'w') + end + + File.open(configfile, 'w') do |f| + [ + %q{LIBRARY_DIR = (ENV["CONS_LIBRARY_DIR"] or realpath "~/Desktop/cons/"}, + %q{DOWNLOADER = "wget -c -P"}, + %q{# DOWNLOADER = "aria2c -c -d"}, + %q{YDL = "~/src/youtube-dl/youtube-dl -t -c --no-part"}, + %q{PLAYBACK_SPEED = (ENV["CONS_PLAYBACK_SPEED"] or "1.0")}, + %q{PDF_APP="xdg-open"}, + %q{VIDEO_APP="mplayer -speed #{PLAYBACK_SPEED}"}, + %q{AUDIO_APP="mplayer -speed #{PLAYBACK_SPEED}"}, + %q{OTHER_APP="xdg-open"}, + %q{# OTHER_APP="gnome-open"}, + %q{UI_APP="dmenu -l 30 -b -i -nf '#888888' -nb '#222222' -sf '#ffffff' -sb 'MediumPurple3'"} + ].each do |line| + f.print line + end + end +else + # replaces ~ with full path def realpath s s.gsub /^~/, ENV["HOME"] @@ -517,3 +541,4 @@ end main +end From c4cc32befb1693caa760449869c3637ee4362e2d Mon Sep 17 00:00:00 2001 From: Chad Perrin Date: Sat, 25 Jan 2014 12:46:06 -0700 Subject: [PATCH 03/11] need newlines in file --- bin/cons | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cons b/bin/cons index 17992c4..dab7a58 100755 --- a/bin/cons +++ b/bin/cons @@ -25,7 +25,7 @@ if (ARGV[0] == 'config') %q{# OTHER_APP="gnome-open"}, %q{UI_APP="dmenu -l 30 -b -i -nf '#888888' -nb '#222222' -sf '#ffffff' -sb 'MediumPurple3'"} ].each do |line| - f.print line + f.puts line end end else From 8d871e790f834cb7f364bacf1e34eb2d97788243 Mon Sep 17 00:00:00 2001 From: Chad Perrin Date: Sat, 25 Jan 2014 12:46:40 -0700 Subject: [PATCH 04/11] we do not actually need that config file right now --- etc/config.default | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 etc/config.default diff --git a/etc/config.default b/etc/config.default deleted file mode 100644 index 0e6c91d..0000000 --- a/etc/config.default +++ /dev/null @@ -1,11 +0,0 @@ -LIBRARY_DIR = (ENV["CONS_LIBRARY_DIR"] or realpath "~/Desktop/cons/" -DOWNLOADER = "wget -c -P" -# DOWNLOADER = "aria2c -c -d" -YDL = "~/src/youtube-dl/youtube-dl -t -c --no-part" -PLAYBACK_SPEED = (ENV["CONS_PLAYBACK_SPEED"] or "1.0") -PDF_APP="xdg-open" -VIDEO_APP="mplayer -speed #{PLAYBACK_SPEED}" -AUDIO_APP="mplayer -speed #{PLAYBACK_SPEED}" -OTHER_APP="xdg-open" -# OTHER_APP="gnome-open" -UI_APP="dmenu -l 30 -b -i -nf '#888888' -nb '#222222' -sf '#ffffff' -sb 'MediumPurple3'" From 26f068358f123f9ccd6f992d5f7a66969a3f7918 Mon Sep 17 00:00:00 2001 From: Chad Perrin Date: Sat, 25 Jan 2014 12:47:38 -0700 Subject: [PATCH 05/11] added gemspec --- cons.gemspec | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 cons.gemspec diff --git a/cons.gemspec b/cons.gemspec new file mode 100644 index 0000000..f475d02 --- /dev/null +++ b/cons.gemspec @@ -0,0 +1,28 @@ +Gem::Specification.new do |s| + s.name = 'cons' + s.version = 0.1 + s.authors = ['Scott Jaderholm', 'Chad Perrin'] + s.date = '2014-01-25' + s.description = <<-EOF + Cons is a command line media library primarily for consuming temporary + media. Like iTunes but for video, pdfs, and audio. It’s not intended for + managing a permanent music/video library. Files can also be removed/added + through normal file management tools. + EOF + s.summary = 'cons - makes consuming media fast and easy' + s.email = 'scott@jaderholm.com' + s.files = [ + 'LICENSE', + 'README.org', + 'bin/cons' + ] + s.homepage = 'https://github.com/scottjad/cons' + s.has_rdoc = false + s.license = 'MIT/X11 License' + s.bindir = 'bin' + s.executables = ['cons'] + + s.post_install_message = <<-EOF + Run `cons config` to configure cons before use. + EOF +end From a37ab27600c2f4f8f771d0e0bca716dc56399f68 Mon Sep 17 00:00:00 2001 From: Chad Perrin Date: Sat, 25 Jan 2014 12:53:14 -0700 Subject: [PATCH 06/11] added gem-based install instructions --- README.org | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.org b/README.org index eb93b2e..5323c0f 100644 --- a/README.org +++ b/README.org @@ -19,6 +19,17 @@ : cp ~/src/cons/config.default ~/.cons_config.rb : $EDITOR ~/.cons_config.rb # setup your apps : mkdir ~/Desktop/cons # unless your library already exists + : ----------------------------------------- + : $ cd ~/src + : $ git clone https://github.com/scottjad/cons.git + : $ cd cons + : $ gem build cons.gemspec + : $ su + : # gem install cons- + : # exit + : $ cons config + : $ $EDITOR ~/.cons_donfig.rb # set up your apps + : $ mkdir ~/Desktop/cons # unless your library already exists ** Usage | Task | Command | From 2b970fd8008a00779eb89f9d56725e6e1731e298 Mon Sep 17 00:00:00 2001 From: Chad Perrin Date: Sat, 25 Jan 2014 13:11:32 -0700 Subject: [PATCH 07/11] fleshed out config setup --- bin/cons | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/bin/cons b/bin/cons index dab7a58..7a81fd4 100755 --- a/bin/cons +++ b/bin/cons @@ -7,26 +7,35 @@ # see README.org for instructions if (ARGV[0] == 'config') - unless File.exists? (configfile = File.join(ENV['HOME'], '.cons_config.rb')) + unless File.exists? configfile = File.join(Dir.home, '.cons_config.rb') File.new(configfile, 'w') + File.open(configfile, 'w') do |f| + [ + %q{LIBRARY_DIR = (ENV["CONS_LIBRARY_DIR"] or realpath "~/Desktop/cons/"}, + %q{DOWNLOADER = "wget -c -P"}, + %q{# DOWNLOADER = "aria2c -c -d"}, + %q{YDL = "~/src/youtube-dl/youtube-dl -t -c --no-part"}, + %q{PLAYBACK_SPEED = (ENV["CONS_PLAYBACK_SPEED"] or "1.0")}, + %q{PDF_APP="xdg-open"}, + %q{VIDEO_APP="mplayer -speed #{PLAYBACK_SPEED}"}, + %q{AUDIO_APP="mplayer -speed #{PLAYBACK_SPEED}"}, + %q{OTHER_APP="xdg-open"}, + %q{# OTHER_APP="gnome-open"}, + %q{UI_APP="dmenu -l 30 -b -i -nf '#888888' -nb '#222222' -sf '#ffffff' -sb 'MediumPurple3'"} + ].each do |line| + f.puts line + end + end end - File.open(configfile, 'w') do |f| - [ - %q{LIBRARY_DIR = (ENV["CONS_LIBRARY_DIR"] or realpath "~/Desktop/cons/"}, - %q{DOWNLOADER = "wget -c -P"}, - %q{# DOWNLOADER = "aria2c -c -d"}, - %q{YDL = "~/src/youtube-dl/youtube-dl -t -c --no-part"}, - %q{PLAYBACK_SPEED = (ENV["CONS_PLAYBACK_SPEED"] or "1.0")}, - %q{PDF_APP="xdg-open"}, - %q{VIDEO_APP="mplayer -speed #{PLAYBACK_SPEED}"}, - %q{AUDIO_APP="mplayer -speed #{PLAYBACK_SPEED}"}, - %q{OTHER_APP="xdg-open"}, - %q{# OTHER_APP="gnome-open"}, - %q{UI_APP="dmenu -l 30 -b -i -nf '#888888' -nb '#222222' -sf '#ffffff' -sb 'MediumPurple3'"} - ].each do |line| - f.puts line - end + desktopdir = File.join(Dir.home, 'Desktop') + p desktopdir + unless Dir.exists? desktopdir + Dir.mkdir desktopdir + end + + unless Dir.exists? librarydir = File.join(desktopdir, 'cons') + Dir.mkdir librarydir end else From 34e1ce706a4c4e5b56941850fa4e911597a0c142 Mon Sep 17 00:00:00 2001 From: Chad Perrin Date: Sat, 25 Jan 2014 13:13:25 -0700 Subject: [PATCH 08/11] do not need old install notes now --- README.org | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/README.org b/README.org index 5323c0f..2c27ea4 100644 --- a/README.org +++ b/README.org @@ -13,13 +13,6 @@ - aria2 (recommended not required) ** Install - : cd ~/src - : git clone https://github.com/scottjad/cons.git - : ln -s ~/src/cons/cons ~/bin/cons # or add to PATH - : cp ~/src/cons/config.default ~/.cons_config.rb - : $EDITOR ~/.cons_config.rb # setup your apps - : mkdir ~/Desktop/cons # unless your library already exists - : ----------------------------------------- : $ cd ~/src : $ git clone https://github.com/scottjad/cons.git : $ cd cons @@ -28,8 +21,7 @@ : # gem install cons- : # exit : $ cons config - : $ $EDITOR ~/.cons_donfig.rb # set up your apps - : $ mkdir ~/Desktop/cons # unless your library already exists + : $ $EDITOR ~/.cons_config.rb # set up your apps ** Usage | Task | Command | From 81547753dd714543a7f968fba7c7a34834533114 Mon Sep 17 00:00:00 2001 From: Chad Perrin Date: Sat, 25 Jan 2014 13:23:24 -0700 Subject: [PATCH 09/11] added config success/fail messages --- bin/cons | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/bin/cons b/bin/cons index 7a81fd4..f58dc97 100755 --- a/bin/cons +++ b/bin/cons @@ -7,7 +7,10 @@ # see README.org for instructions if (ARGV[0] == 'config') - unless File.exists? configfile = File.join(Dir.home, '.cons_config.rb') + if File.exists? configfile = File.join(Dir.home, '.cons_config.rb') + puts %Q{Your configuration file already exists: #{configfile}} + else + puts %Q{Creating configuration file: #{configfile}} File.new(configfile, 'w') File.open(configfile, 'w') do |f| [ @@ -26,16 +29,39 @@ if (ARGV[0] == 'config') f.puts line end end + + if File.exists? configfile = File.join(Dir.home, '.cons_config.rb') + puts %Q{Success! Configuration file created: #{configfile}} + else + puts %Q{Error! Configuration file not created.} + end end desktopdir = File.join(Dir.home, 'Desktop') - p desktopdir - unless Dir.exists? desktopdir + if Dir.exists? desktopdir + puts %Q{Your desktop directory already exists: #{desktopdir}} + else + puts %Q{Creating desktop directory: #{desktopdir}} Dir.mkdir desktopdir + + if Dir.exists? desktopdir + puts %Q{Success! Desktop directory created: #{desktopdir}} + else + puts %Q{Error! Desktop directory not created.} + end end - unless Dir.exists? librarydir = File.join(desktopdir, 'cons') + if Dir.exists? librarydir = File.join(desktopdir, 'cons') + puts %Q{Your library directory already exists: #{librarydir}} + else + puts %Q{Creating library directory: #{librarydir}} Dir.mkdir librarydir + + if Dir.exists? librarydir + puts %Q{Success! Library directory created: #{librarydir}} + else + puts %Q{Error! Library directory not created.} + end end else From 5e0a332bf09e5d4827344fb5e9b98cdb5a1598ff Mon Sep 17 00:00:00 2001 From: Chad Perrin Date: Sat, 25 Jan 2014 13:24:32 -0700 Subject: [PATCH 10/11] added spacing around post-install config message to make it stand out --- cons.gemspec | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cons.gemspec b/cons.gemspec index f475d02..799726e 100644 --- a/cons.gemspec +++ b/cons.gemspec @@ -5,7 +5,7 @@ Gem::Specification.new do |s| s.date = '2014-01-25' s.description = <<-EOF Cons is a command line media library primarily for consuming temporary - media. Like iTunes but for video, pdfs, and audio. It’s not intended for + media. Like iTunes but for video, pdfs, and audio. It's not intended for managing a permanent music/video library. Files can also be removed/added through normal file management tools. EOF @@ -23,6 +23,8 @@ Gem::Specification.new do |s| s.executables = ['cons'] s.post_install_message = <<-EOF + Run `cons config` to configure cons before use. + EOF end From da2a5870498d821b28be81dc2daf2d3294971e3e Mon Sep 17 00:00:00 2001 From: Chad Perrin Date: Sat, 25 Jan 2014 17:29:54 -0700 Subject: [PATCH 11/11] version 0.3.2; made different version notices agree --- bin/cons | 2 +- cons.gemspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/cons b/bin/cons index f58dc97..4a5b91d 100755 --- a/bin/cons +++ b/bin/cons @@ -76,7 +76,7 @@ RETRY_FILE_PROCESSING = RETRY_FILE + "_PROCESSING" LAST_FILE = realpath "~/.cons_last" LIST_CACHE = realpath "~/.cons_list" URLS_FILE = realpath "~/.cons_urls" -CONSUME_VERSION = "0.3.1" +CONSUME_VERSION = "0.3.2" # load config require realpath "~/.cons_config" diff --git a/cons.gemspec b/cons.gemspec index 799726e..0a24b1c 100644 --- a/cons.gemspec +++ b/cons.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'cons' - s.version = 0.1 + s.version = 0.3.2 s.authors = ['Scott Jaderholm', 'Chad Perrin'] s.date = '2014-01-25' s.description = <<-EOF