diff --git a/README.org b/README.org index eb93b2e..2c27ea4 100644 --- a/README.org +++ b/README.org @@ -13,12 +13,15 @@ - 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 + : $ gem build cons.gemspec + : $ su + : # gem install cons- + : # exit + : $ cons config + : $ $EDITOR ~/.cons_config.rb # set up your apps ** Usage | Task | Command | diff --git a/cons b/bin/cons similarity index 85% rename from cons rename to bin/cons index 26472ee..4a5b91d 100755 --- a/cons +++ b/bin/cons @@ -6,6 +6,65 @@ # see README.org for instructions +if (ARGV[0] == 'config') + 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| + [ + %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 + + 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') + 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 + + 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 + # replaces ~ with full path def realpath s s.gsub /^~/, ENV["HOME"] @@ -17,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" @@ -517,3 +576,4 @@ end main +end diff --git a/config.default b/config.default deleted file mode 100644 index 0e6c91d..0000000 --- a/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'" diff --git a/cons.gemspec b/cons.gemspec new file mode 100644 index 0000000..0a24b1c --- /dev/null +++ b/cons.gemspec @@ -0,0 +1,30 @@ +Gem::Specification.new do |s| + s.name = 'cons' + s.version = 0.3.2 + 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