Skip to content

Commit

Permalink
head command and start the piping integration
Browse files Browse the repository at this point in the history
  • Loading branch information
moski committed Feb 6, 2010
1 parent 7dc755e commit 814a71b
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 9 deletions.
6 changes: 1 addition & 5 deletions lib/extend/twitter_oauth/favorites.rb
Expand Up @@ -4,13 +4,9 @@ class Client
# The favorites method defined in twitter oauth doesn't allow u
# to specifiy the user using the screen_name param. So i am remaning the favorites to old_favorites
# and re-writting favorites.
#alias old_favorites favorites
alias_method :old_favorites, :to_s

alias_method :old_favorites, :favorites

def favorites(options = {})
puts "XXXXXXXXXXXXXXXXXX"
puts options.inspect
args = options.map{|k,v| "#{k}=#{v}"}.join('&')
get("/favorites.json?#{args}")
end
Expand Down
35 changes: 35 additions & 0 deletions public/js/usr/bin/head.js
@@ -0,0 +1,35 @@
/*
* head.js
* head -- display first lines of a file/tweet
* Copyright 2010 Monther. All rights reserved.
*
* require 'inode.h.js'
* require 'shell.h.js'
* require 'commands.js'
* require 'iostream.js'
*/
shell.command.head = function(){
this.name = "head";
this.aliases = new Array("head");
this.help = "display first lines of a file";

this.errors = function(){
var error_arr = new Array();
error_arr["NOINPUT"] = "requires an input";
error_arr["EBADF"] = "option require an argument";
return [];
}

this.call = function(args){
var count = 3;
var data = args[0];
var parser = null;
if( typeof(data['data']) != undefined){
parser = data['parser'];
data = data['data'];
}
data = data.slice(0,count);
shell.std.cout(data , parser);
}
}
shell.commands.require("head")
2 changes: 2 additions & 0 deletions public/js/usr/bin/iostream.js
Expand Up @@ -18,6 +18,8 @@ shell.std.cout = function (data, parser){
var parsed_data = (parser == null ? data : parser(data));
shell.std.print(parsed_data);
}else{
shell.pipe.dataOnPipe = new dataOnPipe_struct(data, parser);
shell.exec();
}
}

Expand Down
3 changes: 3 additions & 0 deletions public/js/usr/bin/pipe.js
Expand Up @@ -19,6 +19,9 @@ shell.pipe.callQueue = new Array();
/* The output of each pipe is saved in the dataOnPipe var */
shell.pipe.dataOnPipe = null;

var dataOnPipe_struct = jQuery.makeStruct("data parser");


/* Check if the Call queue is empty or not */
shell.pipe.callQueueEmpty = function(){
return shell.pipe.callQueue.length == 0;
Expand Down
8 changes: 8 additions & 0 deletions public/js/usr/bin/shell.js
Expand Up @@ -131,9 +131,17 @@ shell.processInput = function(){
shell.exec();
}
shell.exec = function (){
shell.std.clog("a7aaaaaaaaaaaaaa");

/* Get the command that i need to exectue **/
var command = shell.pipe.callQueueNext();


shell.std.clog("command == " + command);




/* Generate all the tokens.
* For example: ls moski_doski ==> ['ls' , 'moski_doski']
*/
Expand Down
1 change: 0 additions & 1 deletion public/js/usr/bin/twitter_FS.js
Expand Up @@ -28,7 +28,6 @@ shell.twitter_FS.initialize = function(current_user){

shell.syscalls.mkdirAndMount("/public_timeline" , "ls" ,"twitter/timelines/public_timeline","shell.callbacks.lsTweets");


if(shell.twitter.loggedIn()){
shell.syscalls.mkdirHome("/home/",shell.config.user);
shell.syscalls.chdir(shell.twitter_FS.join("/home/" , shell.config.user));
Expand Down
2 changes: 2 additions & 0 deletions tweetsh.rb
Expand Up @@ -180,6 +180,8 @@
users.to_json
end



# store the request tokens and send to Twitter
# PLEASE NOTE:
# when running sinatra + thin ... when u call window.location.replace("/oauth/connect") using chrome,
Expand Down
8 changes: 5 additions & 3 deletions views/layout.erb
Expand Up @@ -6,11 +6,13 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>

<% ['usr/include/shell.h.js' , 'usr/bin/keyboard.js' ,'usr/bin/shell.js' , 'usr/bin/commands.js' ,
'usr/bin/pipe.js' , 'usr/bin/iostream.js' , 'utilites.jquery.js' , 'usr/bin/clear.js',
<% ['usr/include/shell.h.js' , 'utilites.jquery.js', 'usr/bin/keyboard.js' ,'usr/bin/shell.js' , 'usr/bin/commands.js' ,
'usr/bin/pipe.js' , 'usr/bin/iostream.js' , 'usr/bin/clear.js',
'usr/include/inode.h.js' , 'usr/bin/twitter_FS.js', 'usr/bin/syscalls.js', 'usr/bin/pwd.js',
'usr/bin/cd.js' , 'usr/bin/callbacks.js' , 'usr/bin/twitter.js' , 'usr/bin/ls.js',
'usr/bin/parsers.js' , 'usr/bin/ssh.js' , 'usr/bin/exit.js'
'usr/bin/parsers.js' , 'usr/bin/ssh.js' , 'usr/bin/exit.js',

'usr/bin/head.js'

].each do |path| %>
<script src="/js/<%= path %>" type="text/javascript"></script>
Expand Down

0 comments on commit 814a71b

Please sign in to comment.