rails-extjs-direct 0.0.3 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
data/.git/HEAD ADDED
@@ -0,0 +1 @@
1
+ ref: refs/heads/master
data/.git/config ADDED
@@ -0,0 +1,5 @@
1
+ [core]
2
+ repositoryformatversion = 0
3
+ filemode = true
4
+ bare = false
5
+ logallrefupdates = true
data/.git/description ADDED
@@ -0,0 +1 @@
1
+ Unnamed repository; edit this file to name it for gitweb.
@@ -0,0 +1,15 @@
1
+ #!/bin/sh
2
+ #
3
+ # An example hook script to check the commit log message taken by
4
+ # applypatch from an e-mail message.
5
+ #
6
+ # The hook should exit with non-zero status after issuing an
7
+ # appropriate message if it wants to stop the commit. The hook is
8
+ # allowed to edit the commit message file.
9
+ #
10
+ # To enable this hook, rename this file to "applypatch-msg".
11
+
12
+ . git-sh-setup
13
+ test -x "$GIT_DIR/hooks/commit-msg" &&
14
+ exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"}
15
+ :
@@ -0,0 +1,24 @@
1
+ #!/bin/sh
2
+ #
3
+ # An example hook script to check the commit log message.
4
+ # Called by git-commit with one argument, the name of the file
5
+ # that has the commit message. The hook should exit with non-zero
6
+ # status after issuing an appropriate message if it wants to stop the
7
+ # commit. The hook is allowed to edit the commit message file.
8
+ #
9
+ # To enable this hook, rename this file to "commit-msg".
10
+
11
+ # Uncomment the below to add a Signed-off-by line to the message.
12
+ # Doing this in a hook is a bad idea in general, but the prepare-commit-msg
13
+ # hook is more suited to it.
14
+ #
15
+ # SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
16
+ # grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
17
+
18
+ # This example catches duplicate Signed-off-by lines.
19
+
20
+ test "" = "$(grep '^Signed-off-by: ' "$1" |
21
+ sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
22
+ echo >&2 Duplicate Signed-off-by lines.
23
+ exit 1
24
+ }
@@ -0,0 +1,8 @@
1
+ #!/bin/sh
2
+ #
3
+ # An example hook script that is called after a successful
4
+ # commit is made.
5
+ #
6
+ # To enable this hook, rename this file to "post-commit".
7
+
8
+ : Nothing
@@ -0,0 +1,15 @@
1
+ #!/bin/sh
2
+ #
3
+ # An example hook script for the "post-receive" event.
4
+ #
5
+ # The "post-receive" script is run after receive-pack has accepted a pack
6
+ # and the repository has been updated. It is passed arguments in through
7
+ # stdin in the form
8
+ # <oldrev> <newrev> <refname>
9
+ # For example:
10
+ # aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master
11
+ #
12
+ # see contrib/hooks/ for an sample, or uncomment the next line and
13
+ # rename the file to "post-receive".
14
+
15
+ #. /usr/share/doc/git-core/contrib/hooks/post-receive-email
@@ -0,0 +1,8 @@
1
+ #!/bin/sh
2
+ #
3
+ # An example hook script to prepare a packed repository for use over
4
+ # dumb transports.
5
+ #
6
+ # To enable this hook, rename this file to "post-update".
7
+
8
+ exec git-update-server-info
@@ -0,0 +1,14 @@
1
+ #!/bin/sh
2
+ #
3
+ # An example hook script to verify what is about to be committed
4
+ # by applypatch from an e-mail message.
5
+ #
6
+ # The hook should exit with non-zero status after issuing an
7
+ # appropriate message if it wants to stop the commit.
8
+ #
9
+ # To enable this hook, rename this file to "pre-applypatch".
10
+
11
+ . git-sh-setup
12
+ test -x "$GIT_DIR/hooks/pre-commit" &&
13
+ exec "$GIT_DIR/hooks/pre-commit" ${1+"$@"}
14
+ :
@@ -0,0 +1,18 @@
1
+ #!/bin/sh
2
+ #
3
+ # An example hook script to verify what is about to be committed.
4
+ # Called by git-commit with no arguments. The hook should
5
+ # exit with non-zero status after issuing an appropriate message if
6
+ # it wants to stop the commit.
7
+ #
8
+ # To enable this hook, rename this file to "pre-commit".
9
+
10
+ if git-rev-parse --verify HEAD 2>/dev/null
11
+ then
12
+ against=HEAD
13
+ else
14
+ # Initial commit: diff against an empty tree object
15
+ against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
16
+ fi
17
+
18
+ exec git diff-index --check --cached $against --
@@ -0,0 +1,169 @@
1
+ #!/bin/sh
2
+ #
3
+ # Copyright (c) 2006, 2008 Junio C Hamano
4
+ #
5
+ # The "pre-rebase" hook is run just before "git-rebase" starts doing
6
+ # its job, and can prevent the command from running by exiting with
7
+ # non-zero status.
8
+ #
9
+ # The hook is called with the following parameters:
10
+ #
11
+ # $1 -- the upstream the series was forked from.
12
+ # $2 -- the branch being rebased (or empty when rebasing the current branch).
13
+ #
14
+ # This sample shows how to prevent topic branches that are already
15
+ # merged to 'next' branch from getting rebased, because allowing it
16
+ # would result in rebasing already published history.
17
+
18
+ publish=next
19
+ basebranch="$1"
20
+ if test "$#" = 2
21
+ then
22
+ topic="refs/heads/$2"
23
+ else
24
+ topic=`git symbolic-ref HEAD` ||
25
+ exit 0 ;# we do not interrupt rebasing detached HEAD
26
+ fi
27
+
28
+ case "$topic" in
29
+ refs/heads/??/*)
30
+ ;;
31
+ *)
32
+ exit 0 ;# we do not interrupt others.
33
+ ;;
34
+ esac
35
+
36
+ # Now we are dealing with a topic branch being rebased
37
+ # on top of master. Is it OK to rebase it?
38
+
39
+ # Does the topic really exist?
40
+ git show-ref -q "$topic" || {
41
+ echo >&2 "No such branch $topic"
42
+ exit 1
43
+ }
44
+
45
+ # Is topic fully merged to master?
46
+ not_in_master=`git-rev-list --pretty=oneline ^master "$topic"`
47
+ if test -z "$not_in_master"
48
+ then
49
+ echo >&2 "$topic is fully merged to master; better remove it."
50
+ exit 1 ;# we could allow it, but there is no point.
51
+ fi
52
+
53
+ # Is topic ever merged to next? If so you should not be rebasing it.
54
+ only_next_1=`git-rev-list ^master "^$topic" ${publish} | sort`
55
+ only_next_2=`git-rev-list ^master ${publish} | sort`
56
+ if test "$only_next_1" = "$only_next_2"
57
+ then
58
+ not_in_topic=`git-rev-list "^$topic" master`
59
+ if test -z "$not_in_topic"
60
+ then
61
+ echo >&2 "$topic is already up-to-date with master"
62
+ exit 1 ;# we could allow it, but there is no point.
63
+ else
64
+ exit 0
65
+ fi
66
+ else
67
+ not_in_next=`git-rev-list --pretty=oneline ^${publish} "$topic"`
68
+ perl -e '
69
+ my $topic = $ARGV[0];
70
+ my $msg = "* $topic has commits already merged to public branch:\n";
71
+ my (%not_in_next) = map {
72
+ /^([0-9a-f]+) /;
73
+ ($1 => 1);
74
+ } split(/\n/, $ARGV[1]);
75
+ for my $elem (map {
76
+ /^([0-9a-f]+) (.*)$/;
77
+ [$1 => $2];
78
+ } split(/\n/, $ARGV[2])) {
79
+ if (!exists $not_in_next{$elem->[0]}) {
80
+ if ($msg) {
81
+ print STDERR $msg;
82
+ undef $msg;
83
+ }
84
+ print STDERR " $elem->[1]\n";
85
+ }
86
+ }
87
+ ' "$topic" "$not_in_next" "$not_in_master"
88
+ exit 1
89
+ fi
90
+
91
+ exit 0
92
+
93
+ ################################################################
94
+
95
+ This sample hook safeguards topic branches that have been
96
+ published from being rewound.
97
+
98
+ The workflow assumed here is:
99
+
100
+ * Once a topic branch forks from "master", "master" is never
101
+ merged into it again (either directly or indirectly).
102
+
103
+ * Once a topic branch is fully cooked and merged into "master",
104
+ it is deleted. If you need to build on top of it to correct
105
+ earlier mistakes, a new topic branch is created by forking at
106
+ the tip of the "master". This is not strictly necessary, but
107
+ it makes it easier to keep your history simple.
108
+
109
+ * Whenever you need to test or publish your changes to topic
110
+ branches, merge them into "next" branch.
111
+
112
+ The script, being an example, hardcodes the publish branch name
113
+ to be "next", but it is trivial to make it configurable via
114
+ $GIT_DIR/config mechanism.
115
+
116
+ With this workflow, you would want to know:
117
+
118
+ (1) ... if a topic branch has ever been merged to "next". Young
119
+ topic branches can have stupid mistakes you would rather
120
+ clean up before publishing, and things that have not been
121
+ merged into other branches can be easily rebased without
122
+ affecting other people. But once it is published, you would
123
+ not want to rewind it.
124
+
125
+ (2) ... if a topic branch has been fully merged to "master".
126
+ Then you can delete it. More importantly, you should not
127
+ build on top of it -- other people may already want to
128
+ change things related to the topic as patches against your
129
+ "master", so if you need further changes, it is better to
130
+ fork the topic (perhaps with the same name) afresh from the
131
+ tip of "master".
132
+
133
+ Let's look at this example:
134
+
135
+ o---o---o---o---o---o---o---o---o---o "next"
136
+ / / / /
137
+ / a---a---b A / /
138
+ / / / /
139
+ / / c---c---c---c B /
140
+ / / / \ /
141
+ / / / b---b C \ /
142
+ / / / / \ /
143
+ ---o---o---o---o---o---o---o---o---o---o---o "master"
144
+
145
+
146
+ A, B and C are topic branches.
147
+
148
+ * A has one fix since it was merged up to "next".
149
+
150
+ * B has finished. It has been fully merged up to "master" and "next",
151
+ and is ready to be deleted.
152
+
153
+ * C has not merged to "next" at all.
154
+
155
+ We would want to allow C to be rebased, refuse A, and encourage
156
+ B to be deleted.
157
+
158
+ To compute (1):
159
+
160
+ git-rev-list ^master ^topic next
161
+ git-rev-list ^master next
162
+
163
+ if these match, topic has not merged in next at all.
164
+
165
+ To compute (2):
166
+
167
+ git-rev-list master..topic
168
+
169
+ if this is empty, it is fully merged to "master".
@@ -0,0 +1,36 @@
1
+ #!/bin/sh
2
+ #
3
+ # An example hook script to prepare the commit log message.
4
+ # Called by git-commit with the name of the file that has the
5
+ # commit message, followed by the description of the commit
6
+ # message's source. The hook's purpose is to edit the commit
7
+ # message file. If the hook fails with a non-zero status,
8
+ # the commit is aborted.
9
+ #
10
+ # To enable this hook, rename this file to "prepare-commit-msg".
11
+
12
+ # This hook includes three examples. The first comments out the
13
+ # "Conflicts:" part of a merge commit.
14
+ #
15
+ # The second includes the output of "git diff --name-status -r"
16
+ # into the message, just before the "git status" output. It is
17
+ # commented because it doesn't cope with --amend or with squashed
18
+ # commits.
19
+ #
20
+ # The third example adds a Signed-off-by line to the message, that can
21
+ # still be edited. This is rarely a good idea.
22
+
23
+ case "$2,$3" in
24
+ merge,)
25
+ perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;;
26
+
27
+ # ,|template,)
28
+ # perl -i.bak -pe '
29
+ # print "\n" . `git diff --cached --name-status -r`
30
+ # if /^#/ && $first++ == 0' "$1" ;;
31
+
32
+ *) ;;
33
+ esac
34
+
35
+ # SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
36
+ # grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
@@ -0,0 +1,107 @@
1
+ #!/bin/sh
2
+ #
3
+ # An example hook script to blocks unannotated tags from entering.
4
+ # Called by git-receive-pack with arguments: refname sha1-old sha1-new
5
+ #
6
+ # To enable this hook, rename this file to "update".
7
+ #
8
+ # Config
9
+ # ------
10
+ # hooks.allowunannotated
11
+ # This boolean sets whether unannotated tags will be allowed into the
12
+ # repository. By default they won't be.
13
+ # hooks.allowdeletetag
14
+ # This boolean sets whether deleting tags will be allowed in the
15
+ # repository. By default they won't be.
16
+ # hooks.allowdeletebranch
17
+ # This boolean sets whether deleting branches will be allowed in the
18
+ # repository. By default they won't be.
19
+ #
20
+
21
+ # --- Command line
22
+ refname="$1"
23
+ oldrev="$2"
24
+ newrev="$3"
25
+
26
+ # --- Safety check
27
+ if [ -z "$GIT_DIR" ]; then
28
+ echo "Don't run this script from the command line." >&2
29
+ echo " (if you want, you could supply GIT_DIR then run" >&2
30
+ echo " $0 <ref> <oldrev> <newrev>)" >&2
31
+ exit 1
32
+ fi
33
+
34
+ if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
35
+ echo "Usage: $0 <ref> <oldrev> <newrev>" >&2
36
+ exit 1
37
+ fi
38
+
39
+ # --- Config
40
+ allowunannotated=$(git config --bool hooks.allowunannotated)
41
+ allowdeletebranch=$(git config --bool hooks.allowdeletebranch)
42
+ allowdeletetag=$(git config --bool hooks.allowdeletetag)
43
+
44
+ # check for no description
45
+ projectdesc=$(sed -e '1q' "$GIT_DIR/description")
46
+ if [ -z "$projectdesc" -o "$projectdesc" = "Unnamed repository; edit this file to name it for gitweb." ]; then
47
+ echo "*** Project description file hasn't been set" >&2
48
+ exit 1
49
+ fi
50
+
51
+ # --- Check types
52
+ # if $newrev is 0000...0000, it's a commit to delete a ref.
53
+ if [ "$newrev" = "0000000000000000000000000000000000000000" ]; then
54
+ newrev_type=delete
55
+ else
56
+ newrev_type=$(git-cat-file -t $newrev)
57
+ fi
58
+
59
+ case "$refname","$newrev_type" in
60
+ refs/tags/*,commit)
61
+ # un-annotated tag
62
+ short_refname=${refname##refs/tags/}
63
+ if [ "$allowunannotated" != "true" ]; then
64
+ echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
65
+ echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
66
+ exit 1
67
+ fi
68
+ ;;
69
+ refs/tags/*,delete)
70
+ # delete tag
71
+ if [ "$allowdeletetag" != "true" ]; then
72
+ echo "*** Deleting a tag is not allowed in this repository" >&2
73
+ exit 1
74
+ fi
75
+ ;;
76
+ refs/tags/*,tag)
77
+ # annotated tag
78
+ ;;
79
+ refs/heads/*,commit)
80
+ # branch
81
+ ;;
82
+ refs/heads/*,delete)
83
+ # delete branch
84
+ if [ "$allowdeletebranch" != "true" ]; then
85
+ echo "*** Deleting a branch is not allowed in this repository" >&2
86
+ exit 1
87
+ fi
88
+ ;;
89
+ refs/remotes/*,commit)
90
+ # tracking branch
91
+ ;;
92
+ refs/remotes/*,delete)
93
+ # delete tracking branch
94
+ if [ "$allowdeletebranch" != "true" ]; then
95
+ echo "*** Deleting a tracking branch is not allowed in this repository" >&2
96
+ exit 1
97
+ fi
98
+ ;;
99
+ *)
100
+ # Anything else (is there anything else?)
101
+ echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
102
+ exit 1
103
+ ;;
104
+ esac
105
+
106
+ # --- Finished
107
+ exit 0
data/.git/info/exclude ADDED
@@ -0,0 +1,6 @@
1
+ # git-ls-files --others --exclude-from=.git/info/exclude
2
+ # Lines that start with '#' are comments.
3
+ # For a project mostly in C, the following would be a good set of
4
+ # exclude patterns (uncomment them if you want to use them):
5
+ # *.[oa]
6
+ # *~
data/Manifest.txt CHANGED
@@ -1,3 +1,17 @@
1
+ .git/HEAD
2
+ .git/config
3
+ .git/description
4
+ .git/hooks/applypatch-msg.sample
5
+ .git/hooks/commit-msg.sample
6
+ .git/hooks/post-commit.sample
7
+ .git/hooks/post-receive.sample
8
+ .git/hooks/post-update.sample
9
+ .git/hooks/pre-applypatch.sample
10
+ .git/hooks/pre-commit.sample
11
+ .git/hooks/pre-rebase.sample
12
+ .git/hooks/prepare-commit-msg.sample
13
+ .git/hooks/update.sample
14
+ .git/info/exclude
1
15
  .project
2
16
  History.txt
3
17
  Manifest.txt
@@ -5,11 +19,13 @@ PostInstall.txt
5
19
  README.rdoc
6
20
  Rakefile
7
21
  lib/rails-extjs-direct.rb
22
+ lib/rails-extjs-direct/helpers/direct_controller_helper.rb
8
23
  lib/rails-extjs-direct/mixins/action_controller/direct_controller.rb
9
24
  lib/rails-extjs-direct/rack/remoting_provider.rb
10
25
  lib/rails-extjs-direct/xexception.rb
11
26
  lib/rails-extjs-direct/xrequest.rb
12
27
  lib/rails-extjs-direct/xresponse.rb
28
+ rails-extjs-direct.gemspec
13
29
  script/console
14
30
  script/destroy
15
31
  script/generate
data/README.rdoc CHANGED
@@ -1,6 +1,4 @@
1
1
  = rails-extjs-direct
2
- THIS GEM IS UNDER DEVELOPMENT AND NOT A FULL IMLPLEMENTATION OF THE Ext.Direct specification
3
-
4
2
  http://rubyforge.org/projects/rails-extjs/
5
3
  http://www.extjs.com
6
4
 
@@ -0,0 +1,14 @@
1
+ module Rails::ExtJS::Direct::Controller::Helper
2
+ def get_extjs_direct_provider(type, url=nil)
3
+ @providers = {} if @providers.nil?
4
+
5
+ if @providers[type].nil?
6
+ begin
7
+ @providers[type] = "Rails::ExtJS::Direct::#{type.capitalize}Provider".constantize.new(type, url)
8
+ rescue NameError
9
+ raise StandardError.new("Unknown Direct Provider '#{type}'")
10
+ end
11
+ end
12
+ @providers[type]
13
+ end
14
+ end
@@ -1,12 +1,66 @@
1
1
  module Rails::ExtJS::Direct::Controller
2
2
 
3
- # standard ruby method called when some class does:
4
- # include Merb::ExtJS::Direct::RemotingProvider
5
3
  def self.included(base)
6
- base.before_filter :extjs_direct_prepare_request
4
+ base.class_eval do
5
+ cattr_accessor :extjs_direct_actions
6
+ before_filter :extjs_direct_prepare_request
7
+
8
+ # include the Helper @see helpers/direct_controller_helper.rb
9
+ helper Helper
10
+
11
+ def self.direct_actions(*actions)
12
+ unless actions.empty?
13
+ self.extjs_direct_actions = actions.collect {|a| a.kind_of?(Hash) ? a : {:name => a, :len => 1}}
14
+ else
15
+ self.extjs_direct_actions
16
+ end
17
+ end
18
+ end
7
19
  end
8
20
 
9
21
  def extjs_direct_prepare_request
22
+ #TODO just populate params with the XRequest data.
23
+
10
24
  @xrequest = XRequest.new(params)
25
+ @xresponse = XResponse.new(@xrequest)
26
+
27
+ token = params["authenticity_token"] || nil
28
+
29
+ params.each_key do |k|
30
+ params.delete(k)
31
+ end
32
+
33
+ params["authenticity_token"] = token if token
34
+
35
+ params[:id] = @xrequest.id
36
+
37
+ if @xrequest.id.kind_of?(Array)
38
+ params[:data] = @xrequest.params
39
+ elsif @xrequest.params.kind_of?(Hash)
40
+ params[:data] = {}
41
+ @xrequest.params.each do |k,v|
42
+ params[:data][k] = v
43
+ end
44
+ end
45
+ end
46
+
47
+ def respond(status, params)
48
+ @xresponse.status = status
49
+ @xresponse.message = params[:message] if params[:message]
50
+ @xresponse.result = params[:result] if params[:result]
51
+
52
+ render :json => @xresponse
53
+ end
54
+
55
+ def rescue_action(e)
56
+ if (e.kind_of?(XException))
57
+ render :json => XExceptionResponse.new(@xrequest, e)
58
+ else
59
+ #render :json => XExceptionResponse.new(@xrequest, e)
60
+ render :text => "Rail::ExtJS::Direct::Controller#rescue_action -- Exception"
61
+ end
11
62
  end
12
63
  end
64
+
65
+
66
+
@@ -1,32 +1,50 @@
1
+ #begin
2
+ # require 'json'
3
+ #rescue LoadError => load_error
4
+ # raise "Error loading 'json' library. Please type 'sudo gem install json' and try again."
5
+ #end
1
6
 
2
- require 'json'
3
7
  class Rails::ExtJS::Direct::RemotingProvider
4
8
  def initialize(app, rpath)
5
- @app = app
9
+ if app.kind_of?(String)
10
+ @controllers = {}
11
+ @type = app
12
+ else
13
+ @app = app
14
+ end
6
15
  @router_path = rpath
7
16
  end
8
17
 
18
+ def add_controller(controller_name)
19
+ @controllers[controller_name.capitalize] = "#{controller_name.capitalize}Controller".constantize.direct_actions
20
+ end
21
+
22
+ def render
23
+ "<script>Ext.Direct.addProvider({type: '#{@type}', url: '#{@router_path}', actions: #{@controllers.to_json}});</script>"
24
+ end
25
+
9
26
  def call(env)
10
27
  if env["PATH_INFO"].match("^"+@router_path)
11
28
  output = []
12
29
  parse(env["action_controller.request.request_parameters"]).each do |req|
13
- # have to dup the env for each request
14
- request_env = env.dup
30
+ # have to dup the env for each request
31
+ request_env = env.dup
15
32
 
16
- # pop poorly-named Ext.Direct params off.
17
- controller = req.delete("action").downcase
18
- action = req.delete("method")
33
+ # pop poorly-named Ext.Direct routing-params off.
34
+ controller = req.delete("action").downcase
35
+ action = req.delete("method")
19
36
 
20
- # set env URI and PATH_INFO for each request
21
- request_env["PATH_INFO"] = "/#{controller}/#{action}"
22
- request_env["REQUEST_URI"] = "/#{controller}/#{action}"
37
+ # set env URI and PATH_INFO for each request
38
+ request_env["PATH_INFO"] = "/#{controller}/#{action}"
39
+ request_env["REQUEST_URI"] = "/#{controller}/#{action}"
23
40
 
24
- # set request params
25
- request_env["action_controller.request.request_parameters"] = req
41
+ # set request params
42
+ request_env["action_controller.request.request_parameters"] = req
26
43
 
27
- # call the app!
28
- status, headers, response = @app.call(request_env)
29
- output << response.body
44
+ # call the app!
45
+ # TODO Implement begin/rescue to catch XExceptions
46
+ status, headers, response = @app.call(request_env)
47
+ output << response.body
30
48
  end
31
49
  # join all responses together
32
50
  res = output.join(',')
@@ -8,7 +8,7 @@ class XRequest
8
8
 
9
9
  def initialize(params)
10
10
  # TODO: simply setting @id, @params
11
- @id = (params["id"].to_i > 0) ? params["id"].to_i : (params["data"].kind_of?(Array) && (params["data"].first.kind_of?(Integer) || params["data"].first.nil?)) ? params["data"].shift: nil
11
+ @id = (params["id"].to_i > 0) ? params["id"].to_i : (params["data"].kind_of?(Array) && (params["data"].first.kind_of?(Integer) || params["data"].first.nil?)) ? params["data"].shift : nil
12
12
  @tid = params["tid"]
13
13
  @type = params["type"]
14
14
  @params = (params["data"].kind_of?(Array) && params["data"].length == 1 && params["data"].first.kind_of?(Hash)) ? params["data"].first : params["data"] || []
@@ -8,8 +8,14 @@ class XResponse
8
8
  attr_reader :tid
9
9
 
10
10
  def initialize(req)
11
- @tid = req.tid
12
- @type = req.type
11
+ if req.kind_of?(XRequest)
12
+ @tid = req.tid
13
+ @type = req.type
14
+ else
15
+ req.kind_of?(Hash)
16
+ @tid = req["tid"]
17
+ @type = req["type"]
18
+ end
13
19
  @status = false
14
20
  @message = ''
15
21
  @result = []
@@ -4,7 +4,7 @@
4
4
  module Rails
5
5
  module ExtJS
6
6
  module Direct
7
- VERSION = '0.0.3'
7
+ VERSION = '0.0.13'
8
8
  end
9
9
  end
10
10
  end
@@ -12,4 +12,5 @@ require File.join(File.dirname(__FILE__), 'rails-extjs-direct', 'xresponse')
12
12
  require File.join(File.dirname(__FILE__), 'rails-extjs-direct', 'xrequest')
13
13
  require File.join(File.dirname(__FILE__), 'rails-extjs-direct', 'xexception')
14
14
  require File.join(File.dirname(__FILE__), 'rails-extjs-direct', 'rack', 'remoting_provider')
15
- require File.join(File.dirname(__FILE__), 'rails-extjs-direct', 'mixins', 'action_controller', 'direct_controller')
15
+ require File.join(File.dirname(__FILE__), 'rails-extjs-direct', 'mixins', 'action_controller', 'direct_controller')
16
+ require File.join(File.dirname(__FILE__), 'rails-extjs-direct', 'helpers', 'direct_controller_helper')
@@ -0,0 +1,39 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{rails-extjs-direct}
5
+ s.version = "0.0.13"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Chris Scott"]
9
+ s.date = %q{2009-09-26}
10
+ s.description = %q{A series of components for implementing the Ext.Direct API specification in Rails 2.3 and higher.
11
+ Ext.Direct in Rails is implementede with Rack Middleware.}
12
+ s.email = ["christocracy@gmail.com"]
13
+ s.extra_rdoc_files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc"]
14
+ s.files = [".git/HEAD", ".git/config", ".git/description", ".git/hooks/applypatch-msg.sample", ".git/hooks/commit-msg.sample", ".git/hooks/post-commit.sample", ".git/hooks/post-receive.sample", ".git/hooks/post-update.sample", ".git/hooks/pre-applypatch.sample", ".git/hooks/pre-commit.sample", ".git/hooks/pre-rebase.sample", ".git/hooks/prepare-commit-msg.sample", ".git/hooks/update.sample", ".git/info/exclude", ".project", "History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "lib/rails-extjs-direct.rb", "lib/rails-extjs-direct/helpers/direct_controller_helper.rb", "lib/rails-extjs-direct/mixins/action_controller/direct_controller.rb", "lib/rails-extjs-direct/rack/remoting_provider.rb", "lib/rails-extjs-direct/xexception.rb", "lib/rails-extjs-direct/xrequest.rb", "lib/rails-extjs-direct/xresponse.rb", "rails-extjs-direct.gemspec", "script/console", "script/destroy", "script/generate", "test/test_helper.rb", "test/test_rails-extjs-direct.rb"]
15
+ s.homepage = %q{http://rubyforge.org/projects/rails-extjs/}
16
+ s.post_install_message = %q{PostInstall.txt}
17
+ s.rdoc_options = ["--main", "README.rdoc"]
18
+ s.require_paths = ["lib"]
19
+ s.rubyforge_project = %q{rails-extjs}
20
+ s.rubygems_version = %q{1.3.5}
21
+ s.summary = %q{A series of components for implementing the Ext.Direct API specification in Rails 2.3 and higher}
22
+ s.test_files = ["test/test_helper.rb", "test/test_rails-extjs-direct.rb"]
23
+
24
+ if s.respond_to? :specification_version then
25
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
26
+ s.specification_version = 3
27
+
28
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
29
+ s.add_development_dependency(%q<newgem>, [">= 1.3.0"])
30
+ s.add_development_dependency(%q<hoe>, [">= 1.8.0"])
31
+ else
32
+ s.add_dependency(%q<newgem>, [">= 1.3.0"])
33
+ s.add_dependency(%q<hoe>, [">= 1.8.0"])
34
+ end
35
+ else
36
+ s.add_dependency(%q<newgem>, [">= 1.3.0"])
37
+ s.add_dependency(%q<hoe>, [">= 1.8.0"])
38
+ end
39
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-extjs-direct
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Scott
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-01 00:00:00 -04:00
12
+ date: 2009-09-26 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -32,7 +32,9 @@ dependencies:
32
32
  - !ruby/object:Gem::Version
33
33
  version: 1.8.0
34
34
  version:
35
- description: A series of components for implementing the Ext.Direct API specification in Rails 2.3 and higher. Ext.Direct in Rails is implementede with Rack Middleware.
35
+ description: |-
36
+ A series of components for implementing the Ext.Direct API specification in Rails 2.3 and higher.
37
+ Ext.Direct in Rails is implementede with Rack Middleware.
36
38
  email:
37
39
  - christocracy@gmail.com
38
40
  executables: []
@@ -45,6 +47,20 @@ extra_rdoc_files:
45
47
  - PostInstall.txt
46
48
  - README.rdoc
47
49
  files:
50
+ - .git/HEAD
51
+ - .git/config
52
+ - .git/description
53
+ - .git/hooks/applypatch-msg.sample
54
+ - .git/hooks/commit-msg.sample
55
+ - .git/hooks/post-commit.sample
56
+ - .git/hooks/post-receive.sample
57
+ - .git/hooks/post-update.sample
58
+ - .git/hooks/pre-applypatch.sample
59
+ - .git/hooks/pre-commit.sample
60
+ - .git/hooks/pre-rebase.sample
61
+ - .git/hooks/prepare-commit-msg.sample
62
+ - .git/hooks/update.sample
63
+ - .git/info/exclude
48
64
  - .project
49
65
  - History.txt
50
66
  - Manifest.txt
@@ -52,18 +68,22 @@ files:
52
68
  - README.rdoc
53
69
  - Rakefile
54
70
  - lib/rails-extjs-direct.rb
71
+ - lib/rails-extjs-direct/helpers/direct_controller_helper.rb
55
72
  - lib/rails-extjs-direct/mixins/action_controller/direct_controller.rb
56
73
  - lib/rails-extjs-direct/rack/remoting_provider.rb
57
74
  - lib/rails-extjs-direct/xexception.rb
58
75
  - lib/rails-extjs-direct/xrequest.rb
59
76
  - lib/rails-extjs-direct/xresponse.rb
77
+ - rails-extjs-direct.gemspec
60
78
  - script/console
61
79
  - script/destroy
62
80
  - script/generate
63
81
  - test/test_helper.rb
64
82
  - test/test_rails-extjs-direct.rb
65
83
  has_rdoc: true
66
- homepage: THIS GEM IS UNDER DEVELOPMENT AND NOT A FULL IMLPLEMENTATION OF THE Ext.Direct specification
84
+ homepage: http://rubyforge.org/projects/rails-extjs/
85
+ licenses: []
86
+
67
87
  post_install_message: PostInstall.txt
68
88
  rdoc_options:
69
89
  - --main
@@ -85,9 +105,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
105
  requirements: []
86
106
 
87
107
  rubyforge_project: rails-extjs
88
- rubygems_version: 1.3.1
108
+ rubygems_version: 1.3.5
89
109
  signing_key:
90
- specification_version: 2
110
+ specification_version: 3
91
111
  summary: A series of components for implementing the Ext.Direct API specification in Rails 2.3 and higher
92
112
  test_files:
93
113
  - test/test_helper.rb