oracle_client_installer 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NWIxMDE5MDljNWE2MTQyMTk4MGYwMzUzMGZhNGQxMDA3ODhmMjVjYQ==
4
+ YTY2MWYzZTBkNWFjMzA3YzVmZWU5MWJkYWNiMmQwOGI1MDJjZjM5Ng==
5
5
  data.tar.gz: !binary |-
6
- YzM4OTMxZDZmYjRkMzM5NGRmZGM3NzRiZTMzZWRmZDQwMGMzZDEyNA==
6
+ ZWEwMTllMjg0Y2E3M2Y4OWVjYjYwYjRiNThlMDBhMjQyNWQ0ODk1MA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZmE5NmRiYWY1YjkzMDgyNWExNGRhZDM2Y2U1ZTk4YTMzNmY0YjI2MWRmN2Y5
10
- Y2NhMDExNzY4MThhN2UzMWIwZWM1N2M5MDRlOGU5NGNjMzI1NTJmMTRiNTlj
11
- NWMwZGVkYWY3YzEzMTczMzA5NTk4YjEzODMyYjRmMDc1YjMwMGM=
9
+ NDFiYjg4NzhmYjc0Mjg2MmY3YTk3ZjcwY2EwOWNjMDkzZjgxN2Y3OWNlOTZl
10
+ Mzk0MGZmMjVhMDQ1YjNjM2MxNWFhMjhlNGMxMzc1MTNkOGY2MGVkNjhjN2Qz
11
+ OTRjYTExOTllYTY0Nzk3ZTA1NTdmMGQwZjRjN2I2N2NhMzk0MjE=
12
12
  data.tar.gz: !binary |-
13
- YmQ2OWM5MmQwMjhiZjEyMDNhOTcwZGQ5MWM5M2IxMTM5MGQ3Njg4NjRiYWU0
14
- ZThmODJhODUzOGUxODcwNDA3MDRjODQ4ODNmYzE5ZDc1OGJmYjdhZTQ5NzQ3
15
- MGFlOWMxZDUyODFjOWFjZjI4Y2Q0NTg3Yjc3OWNmOTU0MzVhNjQ=
13
+ OWIwMDhlNzJjN2Y3MWI4YmQ5YzU5MzUyOTNhNDliNDg1YTUzNmU0NTk5Zjg4
14
+ OWFmNWVkMzM2YTUyNjRjYWJlYTRjODY3ODllZDY4MGRlYWU2OWQzZjZiYmJl
15
+ NjhmMTUxZThjMjkxMmY0NzVkMmI2Mzk4YTAzMzc0YTlmOGI0YTQ=
@@ -1,5 +1,4 @@
1
1
  {
2
- "host": "localhost",
3
2
  "user": "ENV['USER']",
4
3
  "home": "ENV['HOME']",
5
4
  "ruby_home": "ENV['MY_RUBY_HOME']",
data/CHANGES CHANGED
@@ -4,3 +4,6 @@
4
4
 
5
5
  * Initial release.
6
6
 
7
+ == Version 1.0.1
8
+
9
+ * Small code reorganization, writing README file.
data/README.md CHANGED
@@ -1,17 +1,187 @@
1
- oracle_client_installer
2
- =======================
1
+ # Oracle Instant Client Installer - thor-based tasks for facilitating oracle client installation
3
2
 
4
- Thor-based tasks for installing oracle client
3
+ ## Introduction
5
4
 
5
+ Installing database driver for Oracle (activerecord-oracle_enhanced-adapter) is not a simple process.
6
+ First, you need to install Instant Client. Second, you have to install ruby wrapper around Instant Client
7
+ (ruby-oci8 gem). On some platforms second step requires compiling source code. Only after that
8
+ you can install oracle database driver. Here we discuss how to do it for OSX10 operating system.
9
+
10
+ ## Create new gem group
11
+
12
+ Create separate group (e.g. "oracle") in Gemfile for oracle ruby-oci8 client wrapper. You have to keep
13
+ this gem in separate group because it requires special steps done before it can be installed.
14
+
15
+ ```ruby
16
+ # Gemfile
17
+
18
+ group :oracle do
19
+ gem "ruby-oci8", "2.1.7"
20
+ end
21
+ ```
22
+
23
+ ## Install gems for the project (except ruby-oci8 gem)
24
+
25
+ Install ruby gems for your project with bundler tool. You have to bypass oracle client wrapper installation:
6
26
 
7
27
  ```bash
8
- bundle install --without=oracle_driver
28
+ bundle install --without=oracle
29
+ ```
9
30
 
10
- rm -rf .bundle
31
+ Check that you don't have ruby-oci8 installed yet:
32
+
33
+ ```bash
34
+ gem list
35
+ ```
36
+
37
+ ## Download Oracle Instant Client
38
+
39
+ Download Oracle Instant Client packages and save tem locally (e.g. in "downloads" folder). You can find
40
+ installation packages on **www.oracle.com** web site (you have to be registered user though).
41
+
42
+ ## Configuration file
43
+
44
+ Create configuration file for the installation (.oracle_client_installer.json) in the root of your project.
45
+ It will tell where have you downloaded files and some other parameters:
46
+
47
+ ```json
48
+ {
49
+ "user": "ENV['USER']",
50
+ "home": "ENV['HOME']",
51
+ "ruby_home": "ENV['MY_RUBY_HOME']",
52
+
53
+ "oracle_base": "/usr/local/oracle",
54
+ "oracle_version": "11.2.0.4.0",
55
+ "ruby_oci_version": "2.1.7",
56
+ "tns_admin_dir": "#{oracle_base}/network/admin",
57
+
58
+ "src_dir": "downloads",
59
+ "dest_dir": "#{oracle_base}/instantclient_11_2",
60
+
61
+ "basic_zip": "#{src_dir}/instantclient-basic-macos.x64-#{oracle_version}.zip",
62
+ "sdk_zip": "#{src_dir}/instantclient-sdk-macos.x64-#{oracle_version}.zip",
63
+ "sqlplus_zip": "#{src_dir}/instantclient-sqlplus-macos.x64-#{oracle_version}.zip"
64
+ }
65
+ ```
66
+
67
+ We are going to run ruby from **ruby_home** on behalf of **user** and use specific versions of
68
+ **oracle** and **ruby-oci8** gem. We also specify where to look for installation packages (src_dir)
69
+ and where to install Instant Client (dest_dir). Also, as you can see, we are using **macos** as platform
70
+ and **x64** as architecture.
71
+
72
+ ## Provide execution script
73
+
74
+ Library itself if written in ruby, but for launching you can use **rake** or **thor** tools. I provide
75
+ thor script here:
76
+
77
+ ```ruby
78
+ require 'thor'
79
+ require 'oracle_client_installer'
80
+
81
+ class OracleClient < Thor
82
+ def initialize *params
83
+ @installer = OracleClientInstaller.new ".oracle_client_installer.json"
84
+
85
+ super *params
86
+ end
87
+
88
+ desc "install", "Installs Oracle Instant Client"
89
+ def install
90
+ @installer.install
91
+ end
92
+
93
+ desc "uninstall", "Uninstalls Oracle Instant Client"
94
+ def uninstall
95
+ @installer.uninstall
96
+ end
97
+
98
+ desc "verify", "Verifies Oracle Instant Client connection"
99
+ def verify
100
+ username = "scott"
101
+ password = "tiger"
102
+ schema = "ORCL"
103
+ sql = "SELECT * FROM emp where rownum <= 10"
104
+
105
+ @installer.verify do
106
+ "require 'oci8'; OCI8.new('#{username}','#{password}','#{schema}').exec('#{sql}') do |r| puts r.join(','); end"
107
+ end
108
+ end
109
+
110
+ end
111
+ ```
112
+
113
+ ## Install Oracle Instant Client
114
+
115
+ Run this thor command:
11
116
 
117
+ ```bash
12
118
  thor oracle_client:install
13
119
  ```
14
120
 
121
+ After execution all packages will be installed at right location on your computer.
122
+
123
+ ## Again: install gems for the project (now with ruby-oci8 gem)
124
+
125
+ Remove .bundle in order to include "oracle" group into bundle execution and
126
+ then run bundler with "oracle" group:
127
+
128
+ ```bash
129
+ rm -rf .bundle
130
+
131
+ bundle
132
+ ```
133
+
134
+ ## Verify the Installation:
135
+
136
+ If you have Oracle installed locally with **scott/tiger/ORCL**, you can test it now:
137
+
138
+ ```bash
139
+ thor oracle_client:verify
140
+ ```
141
+
142
+ # General notes
143
+
144
+ If you have oracle installed somewhere on network, you can add TNS names inside your
145
+ **tnsnames.ora** file located inside **/usr/local/oracle/network/admin** folder. You can set up
146
+ this location via **tns_admin_dir** property on your configuration file:
147
+
148
+ ```
149
+ MY_ORCL=
150
+ (DESCRIPTION=
151
+ (ADDRESS=
152
+ (PROTOCOL=TCP)
153
+ (HOST=db.your_host.com)
154
+ (PORT=1521)
155
+ )
156
+ (CONNECT_DATA=
157
+ (SID=MY_ORCL)
158
+ )
159
+ )
160
+ ```
161
+
162
+ In order to use oracle driver inside rails application, you have to include it into Gemfile:
163
+
164
+ ```ruby
165
+ # Gemfile
166
+
167
+ group :oracle do
168
+ ...
169
+ gem 'activerecord-oracle_enhanced-adapter', '1.5.3'
170
+ end
171
+ ```
172
+
173
+ # Summary: all steps together
174
+
15
175
  ```bash
176
+ bundle install --without=oracle
177
+
178
+ thor oracle_client:install
179
+
180
+ rm -rf .bundle
181
+
182
+ bundle
183
+
16
184
  thor oracle_client:verify
17
- ```
185
+ ```
186
+
187
+
@@ -22,8 +22,6 @@ class OracleClientInstaller
22
22
 
23
23
  def install
24
24
  run({:sudo => true, :capture_output => true}, "install", env)
25
-
26
- run({}, "install-ruby-oci8", env)
27
25
  end
28
26
 
29
27
  def uninstall
@@ -43,11 +41,7 @@ class OracleClientInstaller
43
41
  end
44
42
 
45
43
  def run server_info, script_name, env
46
- execute(server_info) { evaluate_script_body(script_list[script_name], env) }
47
- end
48
-
49
- def evaluate_script_body content, env
50
- interpolator.interpolate content, env
44
+ execute(server_info) { evaluate_script_body(script_list[script_name], env, :string) }
51
45
  end
52
46
 
53
47
  end
@@ -1,3 +1,3 @@
1
1
  class OracleClientInstaller
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -1,8 +1,10 @@
1
1
  $: << File.expand_path(File.dirname(__FILE__) + '/../lib')
2
2
 
3
- require 'oracle_client_installer/oracle_client_installer'
3
+ require 'oracle_client_installer'
4
4
 
5
5
  class OracleClient < Thor
6
+ attr_reader :installer
7
+
6
8
  def initialize *params
7
9
  @installer = OracleClientInstaller.new ".oracle_client_installer.json"
8
10
 
@@ -11,22 +13,22 @@ class OracleClient < Thor
11
13
 
12
14
  desc "install", "Installs Oracle Instant Client"
13
15
  def install
14
- @installer.install
16
+ installer.install
15
17
  end
16
18
 
17
- desc "uninstall", "Uninstalls Oracle Instant Client"
19
+ desc "uninstall", "Uninstalls Oracle Instant Client"
18
20
  def uninstall
19
- @installer.uninstall
21
+ installer.uninstall
20
22
  end
21
23
 
22
- desc "verify", "Verifies Oracle Instant Client connevtion"
24
+ desc "verify", "Verifies Oracle Instant Client connection"
23
25
  def verify
24
26
  username = "scott"
25
27
  password = "tiger"
26
28
  schema = "ORCL"
27
29
  sql = "SELECT * FROM emp where rownum <= 10"
28
30
 
29
- @installer.verify do
31
+ installer.verify do
30
32
  "require 'oci8'; OCI8.new('#{username}','#{password}','#{schema}').exec('#{sql}') do |r| puts r.join(','); end"
31
33
  end
32
34
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oracle_client_installer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Shvets
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-29 00:00:00.000000000 Z
11
+ date: 2014-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: text-interpolator