wschenk-workstreamer_api 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +9 -0
- data/LICENSE +20 -0
- data/README.rdoc +23 -0
- data/Rakefile +52 -0
- data/VERSION +1 -0
- data/lib/workstreamer_api.rb +375 -0
- data/rails_example/Rakefile +10 -0
- data/rails_example/app/controllers/application.rb +15 -0
- data/rails_example/app/controllers/user_controller.rb +12 -0
- data/rails_example/app/controllers/workstreamer_controller.rb +154 -0
- data/rails_example/app/helpers/application_helper.rb +3 -0
- data/rails_example/app/helpers/user_helper.rb +2 -0
- data/rails_example/app/helpers/workstreamer_helper.rb +2 -0
- data/rails_example/app/models/user.rb +2 -0
- data/rails_example/app/views/layouts/application.rhtml +158 -0
- data/rails_example/app/views/workstreamer/index.html.erb +1 -0
- data/rails_example/app/views/workstreamer/info.html.erb +25 -0
- data/rails_example/app/views/workstreamer/stream.html.erb +24 -0
- data/rails_example/config/app_config.yml +3 -0
- data/rails_example/config/boot.rb +109 -0
- data/rails_example/config/database.yml +22 -0
- data/rails_example/config/environment.rb +77 -0
- data/rails_example/config/environments/development.rb +17 -0
- data/rails_example/config/environments/production.rb +24 -0
- data/rails_example/config/environments/test.rb +22 -0
- data/rails_example/config/initializers/inflections.rb +10 -0
- data/rails_example/config/initializers/mime_types.rb +5 -0
- data/rails_example/config/initializers/new_rails_defaults.rb +17 -0
- data/rails_example/config/locales/en.yml +5 -0
- data/rails_example/config/routes.rb +43 -0
- data/rails_example/db/migrate/20090611183940_create_users.rb +15 -0
- data/rails_example/db/schema.rb +23 -0
- data/rails_example/doc/README_FOR_APP +5 -0
- data/rails_example/public/404.html +30 -0
- data/rails_example/public/422.html +30 -0
- data/rails_example/public/500.html +33 -0
- data/rails_example/public/dispatch.cgi +10 -0
- data/rails_example/public/dispatch.fcgi +24 -0
- data/rails_example/public/dispatch.rb +10 -0
- data/rails_example/public/favicon.ico +0 -0
- data/rails_example/public/images/rails.png +0 -0
- data/rails_example/public/javascripts/application.js +2 -0
- data/rails_example/public/javascripts/controls.js +963 -0
- data/rails_example/public/javascripts/dragdrop.js +973 -0
- data/rails_example/public/javascripts/effects.js +1128 -0
- data/rails_example/public/javascripts/prototype.js +4320 -0
- data/rails_example/public/robots.txt +5 -0
- data/rails_example/script/about +4 -0
- data/rails_example/script/console +3 -0
- data/rails_example/script/dbconsole +3 -0
- data/rails_example/script/destroy +3 -0
- data/rails_example/script/generate +3 -0
- data/rails_example/script/performance/benchmarker +3 -0
- data/rails_example/script/performance/profiler +3 -0
- data/rails_example/script/performance/request +3 -0
- data/rails_example/script/plugin +3 -0
- data/rails_example/script/process/inspector +3 -0
- data/rails_example/script/process/reaper +3 -0
- data/rails_example/script/process/spawner +3 -0
- data/rails_example/script/runner +3 -0
- data/rails_example/script/server +3 -0
- data/rails_example/test/fixtures/users.yml +7 -0
- data/rails_example/test/functional/user_controller_test.rb +8 -0
- data/rails_example/test/functional/workstreamer_controller_test.rb +8 -0
- data/rails_example/test/performance/browsing_test.rb +9 -0
- data/rails_example/test/test_helper.rb +38 -0
- data/rails_example/test/unit/user_test.rb +8 -0
- data/spec/spec_helper.rb +9 -0
- data/spec/workstreamer_api_spec.rb +7 -0
- metadata +143 -0
@@ -0,0 +1,10 @@
|
|
1
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
2
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
3
|
+
|
4
|
+
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
|
5
|
+
|
6
|
+
require 'rake'
|
7
|
+
require 'rake/testtask'
|
8
|
+
require 'rake/rdoctask'
|
9
|
+
|
10
|
+
require 'tasks/rails'
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Filters added to this controller apply to all controllers in the application.
|
2
|
+
# Likewise, all the methods added will be available for all controllers.
|
3
|
+
|
4
|
+
class ApplicationController < ActionController::Base
|
5
|
+
helper :all # include all helpers, all the time
|
6
|
+
|
7
|
+
# See ActionController::RequestForgeryProtection for details
|
8
|
+
# Uncomment the :secret if you're not using the cookie session store
|
9
|
+
protect_from_forgery # :secret => 'ccc9497e74859d264d4fc9a3aaa1b817'
|
10
|
+
|
11
|
+
# See ActionController::Base for details
|
12
|
+
# Uncomment this to filter the contents of submitted sensitive data parameters
|
13
|
+
# from your application log (in this case, all fields with names like "password").
|
14
|
+
# filter_parameter_logging :password
|
15
|
+
end
|
@@ -0,0 +1,154 @@
|
|
1
|
+
class WorkstreamerController < ApplicationController
|
2
|
+
before_filter :load_user, :except => :index
|
3
|
+
before_filter :require_token, :except => [:index, :callback]
|
4
|
+
|
5
|
+
rescue_from WorkstreamerApi::Unauthorized, :with => :incorrect_token
|
6
|
+
rescue_from WorkstreamerApi::Forbidden, :with => :incorrect_token
|
7
|
+
|
8
|
+
def info
|
9
|
+
@info = workstreamer.user_info
|
10
|
+
|
11
|
+
if @info && @info['login']
|
12
|
+
@user.update_attribute( "login", @info['login'])
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def status_update
|
17
|
+
create_content "Status update", workstreamer.post_status_update( params[:content] )
|
18
|
+
end
|
19
|
+
|
20
|
+
def direct_message
|
21
|
+
create_content "Direct message", workstreamer.post_direct_message( params[:user_name], params[:message] )
|
22
|
+
end
|
23
|
+
|
24
|
+
def get_content
|
25
|
+
result = workstreamer.get_content( params[:id] )
|
26
|
+
|
27
|
+
master_content = result['hash']['master-content']
|
28
|
+
|
29
|
+
@stream = [master_content]
|
30
|
+
|
31
|
+
render :action => "stream"
|
32
|
+
end
|
33
|
+
|
34
|
+
def feed_item
|
35
|
+
create_content "Feed Item", workstreamer.post_feed_item( params )
|
36
|
+
end
|
37
|
+
|
38
|
+
def message
|
39
|
+
create_content "Message", workstreamer.post_message( params[:title], params[:content], { :recipients => params[:recipients], :project => params[:project]} )
|
40
|
+
end
|
41
|
+
|
42
|
+
def comment
|
43
|
+
create_content "Comment", workstreamer.create_comment( params[:comment], params[:parent_id] )
|
44
|
+
end
|
45
|
+
|
46
|
+
def create_task
|
47
|
+
create_content "Task", workstreamer.create_task( params[:title], params[:assigned_to], params[:content] )
|
48
|
+
end
|
49
|
+
|
50
|
+
def lookup_users
|
51
|
+
@info = workstreamer.lookup_users( params[:usernames] )
|
52
|
+
render :action => "info"
|
53
|
+
end
|
54
|
+
|
55
|
+
def lookup_project
|
56
|
+
@info = workstreamer.lookup_project( params[:project] )
|
57
|
+
render :action => "info"
|
58
|
+
end
|
59
|
+
|
60
|
+
def stream
|
61
|
+
@stream = workstreamer.stream
|
62
|
+
end
|
63
|
+
|
64
|
+
def callback
|
65
|
+
request_token = OAuth::RequestToken.new(workstreamer.consumer,
|
66
|
+
session[:request_token],
|
67
|
+
session[:request_token_secret])
|
68
|
+
|
69
|
+
# Exchange the request token for an access token.
|
70
|
+
access_token = request_token.get_access_token
|
71
|
+
|
72
|
+
@user.update_attributes( :token => access_token.token, :secret => access_token.secret )
|
73
|
+
|
74
|
+
flash[:notice] = "You have been authorized!"
|
75
|
+
|
76
|
+
redirect_to :action => "info"
|
77
|
+
end
|
78
|
+
|
79
|
+
protected
|
80
|
+
def load_user
|
81
|
+
begin
|
82
|
+
@user = User.find session[:user_id] if session[:user_id]
|
83
|
+
rescue
|
84
|
+
@user = nil
|
85
|
+
end
|
86
|
+
|
87
|
+
if @user.nil?
|
88
|
+
flash[:notice] = "You need to have a user first!"
|
89
|
+
redirect_to root_url
|
90
|
+
return false
|
91
|
+
end
|
92
|
+
|
93
|
+
@user
|
94
|
+
end
|
95
|
+
|
96
|
+
def require_token
|
97
|
+
# If the user doesn't have a token, then redirect them
|
98
|
+
if @user.token.nil?
|
99
|
+
return incorrect_token
|
100
|
+
end
|
101
|
+
|
102
|
+
@user
|
103
|
+
end
|
104
|
+
|
105
|
+
def incorrect_token
|
106
|
+
logger.info( "Called incorrect token" )
|
107
|
+
if @user
|
108
|
+
@user.update_attributes( :token => nil, :secret => nil )
|
109
|
+
@user = nil
|
110
|
+
end
|
111
|
+
|
112
|
+
@workstreamer = nil
|
113
|
+
|
114
|
+
request_token = workstreamer.request_token
|
115
|
+
|
116
|
+
session[:request_token] = request_token.token
|
117
|
+
session[:request_token_secret] = request_token.secret
|
118
|
+
|
119
|
+
redirect_to request_token.authorize_url
|
120
|
+
return false
|
121
|
+
end
|
122
|
+
|
123
|
+
def workstreamer
|
124
|
+
@workstreamer ||= WorkstreamerController.create_ws_api( @user )
|
125
|
+
end
|
126
|
+
|
127
|
+
##
|
128
|
+
# This method was pulled out just so we can call it from script/console
|
129
|
+
def WorkstreamerController.create_ws_api( user = nil )
|
130
|
+
user_token = nil
|
131
|
+
user_secret = nil
|
132
|
+
|
133
|
+
if user
|
134
|
+
user_token = user.token
|
135
|
+
user_secret = user.secret
|
136
|
+
end
|
137
|
+
|
138
|
+
WorkstreamerApi::Api.new( APP_CONFIG[:consumer_key],
|
139
|
+
APP_CONFIG[:consumer_secret],
|
140
|
+
APP_CONFIG[:site],
|
141
|
+
user_token,
|
142
|
+
user_secret )
|
143
|
+
end
|
144
|
+
|
145
|
+
def create_content( type, result )
|
146
|
+
if result
|
147
|
+
flash[:notice] = "#{type} was created successfully"
|
148
|
+
else
|
149
|
+
flash[:notice] = "#{type} was NOT created!"
|
150
|
+
end
|
151
|
+
|
152
|
+
redirect_to "/workstreamer/stream"
|
153
|
+
end
|
154
|
+
end
|
@@ -0,0 +1,158 @@
|
|
1
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
2
|
+
"http://www.w3.org/TR/html4/strict.dtd">
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<title>Workstreamer API example application</title>
|
6
|
+
</head>
|
7
|
+
|
8
|
+
<body>
|
9
|
+
<% if flash[:notice] %>
|
10
|
+
<h1><%= flash[:notice] %></h1>
|
11
|
+
<% end %>
|
12
|
+
<ul>
|
13
|
+
<% User.find( :all ).each do |user| %>
|
14
|
+
<li><%= link_to "Become user ##{user.id}", :controller => "user", :action => "switch", :id => user.id %>
|
15
|
+
<%= user.login %>
|
16
|
+
<%= user.token %>
|
17
|
+
<% if user.id == session[:user_id] %>
|
18
|
+
Active user
|
19
|
+
<% end %>
|
20
|
+
</li>
|
21
|
+
<% end %>
|
22
|
+
<li><%= link_to "Create a new user", :controller => "user", :action => "create" %>
|
23
|
+
</ul>
|
24
|
+
<table border="1">
|
25
|
+
<tr>
|
26
|
+
<td>
|
27
|
+
<%= link_to "User Info", :controller => "workstreamer", :action => "info" %>
|
28
|
+
</td>
|
29
|
+
</tr>
|
30
|
+
|
31
|
+
<tr>
|
32
|
+
<td>
|
33
|
+
<%= link_to "Get user's stream", :controller => "workstreamer", :action => "stream" %>
|
34
|
+
</td>
|
35
|
+
</tr>
|
36
|
+
|
37
|
+
<tr>
|
38
|
+
<form action="/workstreamer/lookup_users">
|
39
|
+
<td>
|
40
|
+
<input type="text" name="usernames">
|
41
|
+
</td>
|
42
|
+
<td>
|
43
|
+
<input type="submit" value="Lookup Users">
|
44
|
+
</td>
|
45
|
+
</form>
|
46
|
+
</tr>
|
47
|
+
|
48
|
+
|
49
|
+
<tr>
|
50
|
+
<form action="/workstreamer/lookup_project">
|
51
|
+
<td>
|
52
|
+
<input type="text" name="project">
|
53
|
+
</td>
|
54
|
+
<td>
|
55
|
+
<input type="submit" value="Lookup Project Info">
|
56
|
+
</td>
|
57
|
+
</form>
|
58
|
+
</tr>
|
59
|
+
|
60
|
+
<tr>
|
61
|
+
<form action="/workstreamer/get_content">
|
62
|
+
<td>
|
63
|
+
<input type="text" name="id">
|
64
|
+
</td>
|
65
|
+
<td>
|
66
|
+
<input type="submit" value="Get content from id">
|
67
|
+
</td>
|
68
|
+
</form>
|
69
|
+
</tr>
|
70
|
+
|
71
|
+
<hr>
|
72
|
+
|
73
|
+
<tr>
|
74
|
+
<form action="/workstreamer/status_update">
|
75
|
+
<td>
|
76
|
+
<input type="text" name="content">
|
77
|
+
</td>
|
78
|
+
<td>
|
79
|
+
<input type="submit" value="Post status update">
|
80
|
+
</td>
|
81
|
+
</form>
|
82
|
+
</tr>
|
83
|
+
|
84
|
+
<tr>
|
85
|
+
<form action="/workstreamer/direct_message">
|
86
|
+
<td>
|
87
|
+
To user<br/>
|
88
|
+
<input type="text" name="user_name"><br/>
|
89
|
+
One liner<br/>
|
90
|
+
<input type="text" name="message">
|
91
|
+
</td>
|
92
|
+
<td>
|
93
|
+
<input type="submit" value="Post direct message">
|
94
|
+
</td>
|
95
|
+
</form>
|
96
|
+
</tr>
|
97
|
+
|
98
|
+
|
99
|
+
<tr>
|
100
|
+
<form action="/workstreamer/message">
|
101
|
+
<td>
|
102
|
+
Subject (*)<br/>
|
103
|
+
<input type="text" name="title"><br/>
|
104
|
+
Recipient List<br/>
|
105
|
+
<input type="text" name="recipients"><br/>
|
106
|
+
Project<br/>
|
107
|
+
<input type="text" name="project"><br/>
|
108
|
+
|
109
|
+
</td>
|
110
|
+
<td>
|
111
|
+
Message body (*)<br/>
|
112
|
+
<textarea name="content" rows="8"></textarea>
|
113
|
+
<input type="submit" value="Post message">
|
114
|
+
</td>
|
115
|
+
</form>
|
116
|
+
</tr>
|
117
|
+
|
118
|
+
<tr>
|
119
|
+
<form action="/workstreamer/feed_item">
|
120
|
+
<td>
|
121
|
+
Title (*)<br/>
|
122
|
+
<input type="text" name="title"><br/>
|
123
|
+
URL<br/>
|
124
|
+
<input type="text" name="url"><br/>
|
125
|
+
Created At/Published<br/>
|
126
|
+
<input type="text" name="created_at"><br/>
|
127
|
+
remote_id<br/>
|
128
|
+
<input type="text" name="remote_id"><br/>
|
129
|
+
</td>
|
130
|
+
<td>
|
131
|
+
Extended<br/>
|
132
|
+
<textarea name="content" rows="8"></textarea>
|
133
|
+
<input type="submit" value="Post Feed Item">
|
134
|
+
</td>
|
135
|
+
</form>
|
136
|
+
</tr>
|
137
|
+
|
138
|
+
<tr>
|
139
|
+
<form action="/workstreamer/create_task">
|
140
|
+
<td>
|
141
|
+
Task Assignee (*)<br/>
|
142
|
+
<input type="text" name="assigned_to"><br/>
|
143
|
+
Task title (*)<br/>
|
144
|
+
<input type="text" name="title"><br/>
|
145
|
+
</td>
|
146
|
+
<td>
|
147
|
+
Extended<br/>
|
148
|
+
<textarea name="content" rows="8"></textarea>
|
149
|
+
<input type="submit" value="Create a task">
|
150
|
+
</td>
|
151
|
+
</form>
|
152
|
+
</tr>
|
153
|
+
|
154
|
+
</table>
|
155
|
+
<hr/>
|
156
|
+
<%= yield %>
|
157
|
+
</body>
|
158
|
+
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
<h2>Select a user, make a call and results will be shown here</h2>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<dl>
|
2
|
+
<% @info.keys.each do |key| %>
|
3
|
+
<dt><%= key %></dt>
|
4
|
+
<dd>
|
5
|
+
<% if @info[key].is_a? Hash %>
|
6
|
+
<table>
|
7
|
+
<% @info[key].keys.each do |key2| %>
|
8
|
+
<tr>
|
9
|
+
<th><%= key2 %></th>
|
10
|
+
<td><%= @info[key][key2] %></td>
|
11
|
+
</tr>
|
12
|
+
<% end %>
|
13
|
+
</table>
|
14
|
+
<% elsif @info[key].is_a? Array %>
|
15
|
+
<ul>
|
16
|
+
<% @info[key].each do |val| %>
|
17
|
+
<li><%= val %></li>
|
18
|
+
<% end %>
|
19
|
+
</ul>
|
20
|
+
<% else %>
|
21
|
+
<%= @info[key] %>
|
22
|
+
<% end %>
|
23
|
+
</dd>
|
24
|
+
<% end %>
|
25
|
+
</dl>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<dl>
|
2
|
+
<% @stream.each do |mc|
|
3
|
+
content = mc['content']
|
4
|
+
user = content['user'] || {}
|
5
|
+
%>
|
6
|
+
<dt>#<%= mc['id'] %> <%= mc['content-type'] %> from <nobr><%= user['firstname'] %> <%= user['lastname'] %> #<%= content['user-id'] %></nobr></dt>
|
7
|
+
<dd>
|
8
|
+
<% if content['is-dm'] == 'true' %>
|
9
|
+
<p>Direct message to user #<%= content['recipient-id'] %></p>
|
10
|
+
<% end %>
|
11
|
+
<% if content['assignee-id'] %>
|
12
|
+
<p>Assigned to user #<%= content['assignee-id'] %></p>
|
13
|
+
<% end %>
|
14
|
+
<p><%= content['title'] %><br><%= content['content'] %><%= content['message'] %><%= content['summary'] %><%= content['description'] %></p>
|
15
|
+
<p><form action="/workstreamer/comment">
|
16
|
+
<input type="hidden" name="parent_id" value="<%= mc['id'] %>">
|
17
|
+
<input type="text" name="comment">
|
18
|
+
<input type="submit" value="Add comment">
|
19
|
+
</form>
|
20
|
+
<p><%= content['created-at'] %><br/><%= content['url'] %></p>
|
21
|
+
</dd>
|
22
|
+
<% end %>
|
23
|
+
|
24
|
+
</dl>
|
@@ -0,0 +1,109 @@
|
|
1
|
+
# Don't change this file!
|
2
|
+
# Configure your app in config/environment.rb and config/environments/*.rb
|
3
|
+
|
4
|
+
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
|
5
|
+
|
6
|
+
module Rails
|
7
|
+
class << self
|
8
|
+
def boot!
|
9
|
+
unless booted?
|
10
|
+
preinitialize
|
11
|
+
pick_boot.run
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def booted?
|
16
|
+
defined? Rails::Initializer
|
17
|
+
end
|
18
|
+
|
19
|
+
def pick_boot
|
20
|
+
(vendor_rails? ? VendorBoot : GemBoot).new
|
21
|
+
end
|
22
|
+
|
23
|
+
def vendor_rails?
|
24
|
+
File.exist?("#{RAILS_ROOT}/vendor/rails")
|
25
|
+
end
|
26
|
+
|
27
|
+
def preinitialize
|
28
|
+
load(preinitializer_path) if File.exist?(preinitializer_path)
|
29
|
+
end
|
30
|
+
|
31
|
+
def preinitializer_path
|
32
|
+
"#{RAILS_ROOT}/config/preinitializer.rb"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
class Boot
|
37
|
+
def run
|
38
|
+
load_initializer
|
39
|
+
Rails::Initializer.run(:set_load_path)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
class VendorBoot < Boot
|
44
|
+
def load_initializer
|
45
|
+
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
|
46
|
+
Rails::Initializer.run(:install_gem_spec_stubs)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
class GemBoot < Boot
|
51
|
+
def load_initializer
|
52
|
+
self.class.load_rubygems
|
53
|
+
load_rails_gem
|
54
|
+
require 'initializer'
|
55
|
+
end
|
56
|
+
|
57
|
+
def load_rails_gem
|
58
|
+
if version = self.class.gem_version
|
59
|
+
gem 'rails', version
|
60
|
+
else
|
61
|
+
gem 'rails'
|
62
|
+
end
|
63
|
+
rescue Gem::LoadError => load_error
|
64
|
+
$stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
|
65
|
+
exit 1
|
66
|
+
end
|
67
|
+
|
68
|
+
class << self
|
69
|
+
def rubygems_version
|
70
|
+
Gem::RubyGemsVersion rescue nil
|
71
|
+
end
|
72
|
+
|
73
|
+
def gem_version
|
74
|
+
if defined? RAILS_GEM_VERSION
|
75
|
+
RAILS_GEM_VERSION
|
76
|
+
elsif ENV.include?('RAILS_GEM_VERSION')
|
77
|
+
ENV['RAILS_GEM_VERSION']
|
78
|
+
else
|
79
|
+
parse_gem_version(read_environment_rb)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def load_rubygems
|
84
|
+
require 'rubygems'
|
85
|
+
min_version = '1.3.1'
|
86
|
+
unless rubygems_version >= min_version
|
87
|
+
$stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
|
88
|
+
exit 1
|
89
|
+
end
|
90
|
+
|
91
|
+
rescue LoadError
|
92
|
+
$stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
|
93
|
+
exit 1
|
94
|
+
end
|
95
|
+
|
96
|
+
def parse_gem_version(text)
|
97
|
+
$1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
|
98
|
+
end
|
99
|
+
|
100
|
+
private
|
101
|
+
def read_environment_rb
|
102
|
+
File.read("#{RAILS_ROOT}/config/environment.rb")
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
# All that for this:
|
109
|
+
Rails.boot!
|