rrails 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Changes.md ADDED
@@ -0,0 +1,9 @@
1
+ v0.2.0 2012-09-27 20:40:56 +0900
2
+ ------------------------------------------------------------------------
3
+ - Merge pull request #3 from kamipo/reloader thanks @kamipo
4
+ - added reloader.
5
+ - remove_connection is not necessary. included in establish_connection.
6
+
7
+ v0.1.0 2012-05-01 10:02:39 +0900
8
+ ------------------------------------------------------------------------
9
+ - initial release.
data/README.rdoc CHANGED
@@ -4,11 +4,12 @@ remote run rails/rake command.
4
4
 
5
5
  == Usage
6
6
 
7
+ # run server
7
8
  $ cd ~/rails_project
8
9
  $ bundle exec rrails-server
9
10
 
11
+ # on another console.
10
12
  $ rrails -- rails generate model Yakiniku
11
-
12
13
  $ rrails -E test -- rake db:migrate
13
14
 
14
15
  == Description
data/Rakefile CHANGED
@@ -15,7 +15,7 @@ require 'jeweler'
15
15
  Jeweler::Tasks.new do |gem|
16
16
  # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
17
  gem.name = "rrails"
18
- gem.homepage = "http://github.com/walf443/rrails"
18
+ gem.homepage = "http://rubydoc.info/gems/rrails/frames"
19
19
  gem.license = "MIT"
20
20
  gem.summary = %Q{remote run rails/rake command}
21
21
  gem.description = %Q{remote run rails/rake command}
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
data/lib/rrails/client.rb CHANGED
@@ -3,6 +3,16 @@ require 'rrails'
3
3
  require 'shellwords'
4
4
  require 'optparse'
5
5
  module RemoteRails
6
+ #
7
+ # client for RemoteRails::Server.
8
+ #
9
+ # @example
10
+ # client = RemoteRails::Client.new({
11
+ # :cmd => "rails generate model Sushi",
12
+ # :rails_env => "development",
13
+ # })
14
+ # client.run
15
+ #
6
16
  class Client
7
17
  def self.new_with_options(argv)
8
18
  options = {}
data/lib/rrails/server.rb CHANGED
@@ -9,6 +9,12 @@ require 'shellwords'
9
9
  APP_PATH = File.expand_path('./config/application')
10
10
 
11
11
  module RemoteRails
12
+ # server to run rails/rake command.
13
+ #
14
+ # @example
15
+ # server = RemoteRails::Server.new(:rails_env => "development")
16
+ # server.start
17
+ #
12
18
  class Server
13
19
  def initialize(options={})
14
20
  @rails_env = options[:rails_env] || "development"
@@ -19,15 +25,6 @@ module RemoteRails
19
25
  @logger = Logger.new(options[:logfile] ? options[:logfile] : $stderr)
20
26
  end
21
27
 
22
- def boot_rails
23
- @logger.info("prepare rails environment")
24
- ENV["RAILS_ENV"] = @rails_env
25
- require File.expand_path('./config/boot')
26
- require @app_path
27
- Rails.application.require_environment!
28
- @logger.info("finished preparing rails environment")
29
- end
30
-
31
28
  def start
32
29
  self.boot_rails
33
30
  server = TCPServer.open(@host, @port)
@@ -65,10 +62,22 @@ module RemoteRails
65
62
  end
66
63
  end
67
64
 
65
+ def boot_rails
66
+ @logger.info("prepare rails environment")
67
+ ENV["RAILS_ENV"] = @rails_env
68
+ require File.expand_path('./config/boot')
69
+ require @app_path
70
+ Rails.application.require_environment!
71
+ unless Rails.application.config.cache_classes
72
+ ActionDispatch::Reloader.cleanup!
73
+ ActionDispatch::Reloader.prepare!
74
+ end
75
+ @logger.info("finished preparing rails environment")
76
+ end
77
+
68
78
  def dispatch(sock, line)
69
79
  args = Shellwords.shellsplit(line)
70
80
  subcmd = args.shift
71
- ActiveRecord::Base.remove_connection if defined?(ActiveRecord::Base)
72
81
  servsock_out, clisock_out = UNIXSocket.pair
73
82
  servsock_err, clisock_err = UNIXSocket.pair
74
83
  pid = fork do
data/rrails.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "rrails"
8
- s.version = "0.1.0"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Keiji, Yoshimi"]
12
- s.date = "2012-05-01"
12
+ s.date = "2012-09-28"
13
13
  s.description = "remote run rails/rake command"
14
14
  s.email = "walf443@gmail.com"
15
15
  s.executables = ["rrails", "rrails-server"]
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
19
19
  ]
20
20
  s.files = [
21
21
  ".document",
22
+ "Changes.md",
22
23
  "Gemfile",
23
24
  "Gemfile.lock",
24
25
  "LICENSE.txt",
@@ -34,10 +35,10 @@ Gem::Specification.new do |s|
34
35
  "test/helper.rb",
35
36
  "test/test_rrails.rb"
36
37
  ]
37
- s.homepage = "http://github.com/walf443/rrails"
38
+ s.homepage = "http://rubydoc.info/gems/rrails/frames"
38
39
  s.licenses = ["MIT"]
39
40
  s.require_paths = ["lib"]
40
- s.rubygems_version = "1.8.21"
41
+ s.rubygems_version = "1.8.23"
41
42
  s.summary = "remote run rails/rake command"
42
43
 
43
44
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rrails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-01 00:00:00.000000000 Z
12
+ date: 2012-09-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: shoulda
@@ -102,6 +102,7 @@ extra_rdoc_files:
102
102
  - README.rdoc
103
103
  files:
104
104
  - .document
105
+ - Changes.md
105
106
  - Gemfile
106
107
  - Gemfile.lock
107
108
  - LICENSE.txt
@@ -116,7 +117,7 @@ files:
116
117
  - rrails.gemspec
117
118
  - test/helper.rb
118
119
  - test/test_rrails.rb
119
- homepage: http://github.com/walf443/rrails
120
+ homepage: http://rubydoc.info/gems/rrails/frames
120
121
  licenses:
121
122
  - MIT
122
123
  post_install_message:
@@ -131,7 +132,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
131
132
  version: '0'
132
133
  segments:
133
134
  - 0
134
- hash: -3230074702185761932
135
+ hash: -1092235871622214733
135
136
  required_rubygems_version: !ruby/object:Gem::Requirement
136
137
  none: false
137
138
  requirements:
@@ -140,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
141
  version: '0'
141
142
  requirements: []
142
143
  rubyforge_project:
143
- rubygems_version: 1.8.21
144
+ rubygems_version: 1.8.23
144
145
  signing_key:
145
146
  specification_version: 3
146
147
  summary: remote run rails/rake command