otacrawler 0.1.1 → 0.1.2

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: 0b6078163571a0bcfd005cb0014bbbcde8518e63
4
- data.tar.gz: ce52f3c0fd882bc90e020fbed9fc633cc5a3b255
3
+ metadata.gz: 0c770877fc688a529a290b30e689582ddf248a0b
4
+ data.tar.gz: b50c9bb7a5a29dc0ecf0f3b6c7df453150c675da
5
5
  SHA512:
6
- metadata.gz: 84aec7866172b784f048a8cd394ffc4254f51777dbe455e73088522a79355feb4ab97e30fdf64a7d4fe95c090b689ccb55231441c032a676f73317e5f215b773
7
- data.tar.gz: 822b822a8b26e3fa2759518ce83b1a7bdf465a0d806f5392182d3c52732154848d30ce3a5241a519a95dbfbef19a7f0abbeb492ae6db6cfd9398b47fd5d43236
6
+ metadata.gz: 7a6b90ba6e64a7ef72e632647fb199bdc06b76cc979d907fc281d3f0101652491a432d6efd709fed0cf5683f32780e860678b382b7c90e15bb399c8658e0162b
7
+ data.tar.gz: de0bccb6b008d0aa69c7bc8baa348e818735a12f51c52335fc63fbe80edcd46c715b81f6356957f80ccd27378c04b5499c6e1d1219ea8c29fc14fc50492f0dac
data/README.md CHANGED
@@ -21,6 +21,22 @@ Or install it yourself as:
21
21
 
22
22
  ## Usage
23
23
 
24
+ Setting database:
25
+ ```YAML
26
+ # database.yml
27
+ development:
28
+ adapter: mysql2
29
+ host: localhost
30
+ username: root
31
+ database: otacrawler
32
+
33
+ production:
34
+ adapter: mysql2
35
+ host: xxxx
36
+ username: xxxx
37
+ database: otacrawler
38
+ ```
39
+
24
40
  Run robot:
25
41
 
26
42
  ```ruby
@@ -31,7 +47,8 @@ Run robot:
31
47
  ## ENV
32
48
 
33
49
  ```
34
- DATABASE_SETTING_PATH - Database setting file path. It formatted YAML.
50
+ DATABASE_SETTING_PATH - Database setting file path. That file formatted YAML.
51
+ OTACRAWLER_ENV - Setting environment. This doesn't overrides the value of the environment variable RAILS_ENV.
35
52
  ```
36
53
 
37
54
  ## Development
data/database.yml CHANGED
@@ -1,13 +1,12 @@
1
- db:
2
- production:
3
- adapter: mysql2
4
- host: localhost
5
- username: xxxxxxxx
6
- password: xxxxxxxx
7
- database: xxxxxxxx
1
+ production:
2
+ adapter: mysql2
3
+ host: localhost
4
+ username: xxxxxxxx
5
+ password: xxxxxxxx
6
+ database: xxxxxxxx
8
7
 
9
- development:
10
- adapter: mysql2
11
- host: localhost
12
- username: root
13
- database: otacrawler
8
+ development:
9
+ adapter: mysql2
10
+ host: localhost
11
+ username: root
12
+ database: otacrawler
data/lib/otacrawler.rb CHANGED
@@ -5,7 +5,8 @@ require "active_record"
5
5
 
6
6
  module Otacrawler
7
7
  config = YAML.load(ERB.new(IO.read(ENV["DATABASE_SETTING_PATH"])).result)
8
- ActiveRecord::Base.establish_connection(config["db"]["development"])
8
+ env = ENV["RAILS_ENV"] || ENV["OTACRAWLER_ENV"]
9
+ ActiveRecord::Base.establish_connection(config[env])
9
10
 
10
11
  class << self
11
12
  include Mem
@@ -1,3 +1,3 @@
1
1
  module Otacrawler
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: otacrawler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - yuta-muramoto
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-26 00:00:00.000000000 Z
11
+ date: 2016-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mem