oop_rails_server 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 44eb1325d0019e89344b163584820b439319eb83
4
- data.tar.gz: 70b0e6e9382f2012f912a810731276654b57c3f2
3
+ metadata.gz: 470c077aaf59850d09797e18c0d1e7455917ec0b
4
+ data.tar.gz: 25675945275cbba481e850543c11a4ef2e72e37d
5
5
  SHA512:
6
- metadata.gz: edd31796cdb8b5a1d31a1b377b8e5bc8567593791ea2bc69b554c69415d82376a3c3b3724812f9f3c07c4741ac0efbc50f1f4a9fa55c5f0ae57ac08d2a0e8215
7
- data.tar.gz: 8f6457793ed0b1838c79e19266f3424cd93e724327a1f575860a2320cb5c728262b8fd46abe1e2f3d623d38646477bda15ed983166f5138a6a16c8f16cab1bc7
6
+ metadata.gz: b4b977e4cbfa075d9ba7bdf31eb004ec9aa08030abab419a098f1ca9f4e74a9a869d487ef8d8a8c5729e605e85bde38ea8e5600de952766173f3dabeb8be0af2
7
+ data.tar.gz: 7130f8fac7d5fa7f09108440059c9229623a86c7a7550bd254f08873c8d155b5dc7e19db89edce2b6c4d62f3b403abf36e71a1f964581d062bc500883caa78e9
data/CHANGES.md ADDED
@@ -0,0 +1,7 @@
1
+ # `oop_rails_server` Releases
2
+
3
+ ## 0.0.4, 13 December 2014
4
+
5
+ * Better error messages in certain circumstances.
6
+ * Expose a `#run_command_in_rails_root!` method to allow executing arbitrary Rails-related commands in the
7
+ server's root.
@@ -41,7 +41,8 @@ module OopRailsServer
41
41
  end
42
42
 
43
43
  def get(path, options = { })
44
- get_response(path, options).body.strip
44
+ out = get_response(path, options)
45
+ out.body.strip if out
45
46
  end
46
47
 
47
48
  def uri_for(path)
@@ -52,12 +53,29 @@ module OopRailsServer
52
53
  def get_response(path, options = { })
53
54
  uri = uri_for(path)
54
55
  data = Net::HTTP.get_response(uri)
55
- unless data.code.to_s == '200' || options[:ignore_status_code]
56
- raise "'#{uri}' returned #{data.code.inspect}, not 200; body was: #{data.body.strip}"
56
+
57
+ if (data.code.to_s != '200')
58
+ if options[:ignore_status_code]
59
+ # ok, nothing
60
+ elsif options[:nil_on_not_found]
61
+ data = nil
62
+ else
63
+ raise "'#{uri}' returned #{data.code.inspect}, not 200; body was: #{data.body.strip}"
64
+ end
57
65
  end
58
66
  data
59
67
  end
60
68
 
69
+ def run_command_in_rails_root!(command)
70
+ Bundler.with_clean_env do
71
+ with_rails_env do
72
+ in_rails_root do
73
+ safe_system("bundle exec #{command}")
74
+ end
75
+ end
76
+ end
77
+ end
78
+
61
79
  private
62
80
  attr_reader :template_paths, :runtime_base_directory, :rails_env, :additional_gemfile_lines, :port, :server_pid
63
81
 
@@ -329,7 +347,8 @@ and output:
329
347
  end
330
348
 
331
349
  def is_remote_flag_required_error?(command_failed_error)
332
- command_failed_error.output =~ /could\s+not\s+find.*in\s+the\s+gems\s+available\s+on\s+this\s+machine/i
350
+ command_failed_error.output =~ /could\s+not\s+find.*in\s+the\s+gems\s+available\s+on\s+this\s+machine/i ||
351
+ command_failed_error.output =~ /could\s+not\s+find.*in\s+any\s+of\s+the\s+sources/i
333
352
  end
334
353
 
335
354
  def do_bundle_install!(name, allow_remote)
@@ -1,3 +1,3 @@
1
1
  module OopRailsServer
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oop_rails_server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Geweke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-10 00:00:00.000000000 Z
11
+ date: 2014-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -46,6 +46,7 @@ extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
48
  - ".gitignore"
49
+ - CHANGES.md
49
50
  - Gemfile
50
51
  - LICENSE.txt
51
52
  - README.md