beta_tools 0.0.4
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.
- data/.gitignore +11 -0
- data/Capfile +2 -0
- data/Gemfile +4 -0
- data/README +7 -0
- data/Rakefile +7 -0
- data/beta_tools.gemspec +31 -0
- data/bin/deploy +9 -0
- data/bin/documentation_daemon +12 -0
- data/bin/loginToUrl +6 -0
- data/bin/onVpn +6 -0
- data/bin/pub +91 -0
- data/bin/query_solr +11 -0
- data/bin/solrWebApp +6 -0
- data/conf/schema.xml +220 -0
- data/config/deploy.rb +44 -0
- data/config.ru +2 -0
- data/docs/#next_design.mmd# +0 -0
- data/features/deploy.feature +9 -0
- data/features/git.feature +15 -0
- data/features/maven.feature +21 -0
- data/features/step_definitions/deploy_steps.rb +11 -0
- data/features/step_definitions/git_steps.rb +20 -0
- data/features/step_definitions/maven_steps.rb +35 -0
- data/features/support/env.rb +8 -0
- data/int/it_tools/suite_it_tools.rb +2 -0
- data/int/it_tools/test_integ1.rb +17 -0
- data/lib/beta_tools/version.rb +3 -0
- data/lib/beta_tools.rb +5 -0
- data/lib/it_tools/calc.rb +14 -0
- data/lib/it_tools/config.ru +2 -0
- data/lib/it_tools/environment.rb +86 -0
- data/lib/it_tools/git.rb +3 -0
- data/lib/it_tools/html_publish.rb +287 -0
- data/lib/it_tools/mail.rb +21 -0
- data/lib/it_tools/maven.rb +101 -0
- data/lib/it_tools/md5.rb +4 -0
- data/lib/it_tools/multipart.rb +78 -0
- data/lib/it_tools/network_tools.rb +72 -0
- data/lib/it_tools/options.rb +46 -0
- data/lib/it_tools/pub_driver.rb +188 -0
- data/lib/it_tools/publisher2.rb +232 -0
- data/lib/it_tools/sample.rb +9 -0
- data/lib/it_tools/shared.rb +22 -0
- data/lib/it_tools/solr.rb +157 -0
- data/lib/it_tools/views/search_results.erb +16 -0
- data/log/thin.log +177 -0
- data/spec/it_tools/deploy_spec.rb +20 -0
- data/spec/spec_helper.rb +0 -0
- data/test/bin/test_pub.rb +30 -0
- data/test/cleaner.rb +6 -0
- data/test/driver.rb +24 -0
- data/test/integration/tp.rb +107 -0
- data/test/it_tools/for_debugger.rb +4 -0
- data/test/it_tools/publisher2.rb +13 -0
- data/test/it_tools/suite_it_tools.rb +6 -0
- data/test/it_tools/suite_it_tools.rb~ +13 -0
- data/test/it_tools/test_deploy.rb +83 -0
- data/test/it_tools/test_html_publish.rb +54 -0
- data/test/it_tools/test_maven.rb +31 -0
- data/test/it_tools/test_multipart.rb +31 -0
- data/test/it_tools/test_network_tools.rb +14 -0
- data/test/it_tools/test_publisher2.rb +42 -0
- data/test/it_tools/test_publisher2_support.rb +16 -0
- data/test/it_tools/test_sample.rb +10 -0
- data/test/it_tools/test_shared.rb +36 -0
- data/test/it_tools/test_solr.rb +22 -0
- data/test/it_tools/test_solr2.rb +22 -0
- data/testdata/assembly_pom.xml +157 -0
- data/testdata/desir.txt +39 -0
- data/testdata/ear_pom.xml +82 -0
- data/testdata/java.html +524 -0
- data/testdata/pom.xml +174 -0
- data/testdata/publish/src_dir/#arch.mmd# +0 -0
- data/testdata/publish/src_dir/ajax-loader.gif +0 -0
- data/testdata/publish/src_dir/file1.mmd +5 -0
- data/testdata/publish/src_dir/file2.mmd +3 -0
- data/testdata/publish/src_dir/file3.abc +0 -0
- data/testdata/publish/src_dir/file4.mmd +3 -0
- data/testdata/publish/src_dir/help.png +0 -0
- data/testdata/publish/src_dir/images/linux.jpeg +0 -0
- data/testdata/publish/src_dir/inputStyles.css +0 -0
- data/testdata/publish/src_dir/search.html +0 -0
- data/testdata/publish/src_dir/search.js +0 -0
- data/testdata/publish/target_dir/.@arch.html +0 -0
- data/testdata/publish/target_dir/file1.html +7 -0
- data/testdata/publish/target_dir/file2.html +5 -0
- data/testdata/publish/target_dir/search.js +0 -0
- data/testdata/publish/target_dir_static/.@arch.html +1 -0
- data/testdata/publish/target_dir_static/file1.html +7 -0
- data/testdata/publish/target_dir_static/index.html +1 -0
- data/testdata/publish/target_dir_static/style.css +61 -0
- data/testdata/ruby.mmd +404 -0
- data/testdata/simple.mmd +3 -0
- data/testdata/simple.xml +3 -0
- data/testdata/small.txt +2 -0
- data/testdata/utf8_chars.txt +1 -0
- metadata +338 -0
data/testdata/ruby.mmd
ADDED
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
# Install - Debian Flavors
|
|
2
|
+
|
|
3
|
+
Ubuntu, Mint
|
|
4
|
+
|
|
5
|
+
[Reference](http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/)
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
$ sudo apt-get -y install build-essential git-core curl
|
|
9
|
+
$ bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
|
|
10
|
+
echo 'source .rvm/scripts/rvm' >> ~/.bashrc; source ~/.bashrc
|
|
11
|
+
$ sudo apt-get install -y --force-yes build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion
|
|
12
|
+
$ rvm install 1.9.2; rvm use 1.9.2; rvm --default use 1.9.2
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Debugger on Emacs
|
|
16
|
+
|
|
17
|
+
[ref](http://pivotallabs.com/users/chad/blog/articles/366-ruby-debug-in-30-seconds-we-don-t-need-no-stinkin-gui-)
|
|
18
|
+
|
|
19
|
+
For ruby 1.9 do:
|
|
20
|
+
|
|
21
|
+
$ gem install ruby-debug19 ruby-debug-ide
|
|
22
|
+
|
|
23
|
+
get latest ruby-debug-extra from:
|
|
24
|
+
|
|
25
|
+
* http://rubyforge.org/projects/ruby-debug/ > files
|
|
26
|
+
|
|
27
|
+
this needs texlive do (it takes a looooong time to install), also get
|
|
28
|
+
the rdebug cheat sheet:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
$ sudo apt-get install texlive texinfo
|
|
32
|
+
$ cd Downloads; wget http://rubyforge.org/frs/download.php/73086/ruby-debug-extra-0.10.4.tar.gz; tar xvfz ruby-debug-extra-0.10.4.tar.gz; cd ruby-debug-extra-0.10.4/; ./configure; make; sudo make install
|
|
33
|
+
$ gem install cheat; cheat rdebug
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
create a file ~/.rdebugrc with this content:
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
set autolist
|
|
40
|
+
set autoeval
|
|
41
|
+
set autoreload
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
* autolist - execute 'list' command on every breakpoint
|
|
45
|
+
* autoeval - evaluate every unrecognized command
|
|
46
|
+
* autoreload - enables automatic source code reloading
|
|
47
|
+
|
|
48
|
+
**IMPORTANT**: open emacs from shell to inherit all environment from shell!!!
|
|
49
|
+
|
|
50
|
+
Open your ruby file and type: `M-x rdebug`
|
|
51
|
+
|
|
52
|
+
Key | Effect
|
|
53
|
+
-------------------------------------- | ---------------------
|
|
54
|
+
r | Reload
|
|
55
|
+
n | Next Line (Step Over)
|
|
56
|
+
s | Step Into
|
|
57
|
+
c | Continue
|
|
58
|
+
c[ont][ nnn] | run until program ends or hits breakpoint or reaches line nnn
|
|
59
|
+
where | Display Frame / Call Stack
|
|
60
|
+
b my.rb:10 | set breakpoint at my.rb line 10
|
|
61
|
+
b[reak] file:line [if expr] | breakpoints
|
|
62
|
+
b[reak] class(.|#)method [if expr] | breakpoints
|
|
63
|
+
h | help
|
|
64
|
+
@myvar = 'foo' | Modify a variable
|
|
65
|
+
myvar.class | Evaluate any var/expression
|
|
66
|
+
disp[lay] <expression> | add expression into display expression list
|
|
67
|
+
down [count] | move to lower frame
|
|
68
|
+
e[val] | expression evaluate expression and print its value, alias for p
|
|
69
|
+
q[uit], exit |
|
|
70
|
+
fin[ish] | return to outer frame
|
|
71
|
+
m[ethod] i[nstance] <obj> | show methods of object
|
|
72
|
+
m[ethod] <class|module> | show instance methods of class or module
|
|
73
|
+
n[ext][+][ nnn] | step over once or nnn times, '+' forces to move to another line
|
|
74
|
+
up[count] | move to higher frame
|
|
75
|
+
restart | restart the debugger (say if in (rdb:ctrl) state.
|
|
76
|
+
|
|
77
|
+
# Language Reference
|
|
78
|
+
|
|
79
|
+
## Define a method
|
|
80
|
+
|
|
81
|
+
```ruby
|
|
82
|
+
irb(main):019:0> def h(name = "World")
|
|
83
|
+
irb(main):020:1> puts "Hello #{name.capitalize}!"
|
|
84
|
+
irb(main):021:1> end
|
|
85
|
+
=> nil
|
|
86
|
+
irb(main):022:0> h "chris"
|
|
87
|
+
Hello Chris!
|
|
88
|
+
=> nil
|
|
89
|
+
irb(main):023:0> h
|
|
90
|
+
Hello World!
|
|
91
|
+
=> nil
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Highlights:
|
|
95
|
+
|
|
96
|
+
* default parameter value: "World", if method called without a param.
|
|
97
|
+
|
|
98
|
+
* `#{}` is string interpolation
|
|
99
|
+
|
|
100
|
+
## Modules
|
|
101
|
+
|
|
102
|
+
define a module file: `fenton.rb`
|
|
103
|
+
|
|
104
|
+
```ruby
|
|
105
|
+
module MyModule
|
|
106
|
+
def func1
|
|
107
|
+
puts "Hello"
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Mixin
|
|
113
|
+
|
|
114
|
+
Modules cannot be instantiated, only included into a class. This is
|
|
115
|
+
called a `mixin`. In file `travers.rb`. Modules can include other
|
|
116
|
+
modules.
|
|
117
|
+
|
|
118
|
+
```ruby
|
|
119
|
+
require 'fenton'
|
|
120
|
+
class ClassOne
|
|
121
|
+
include MyModule
|
|
122
|
+
def func2
|
|
123
|
+
func1
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Sharing Code
|
|
129
|
+
|
|
130
|
+
required statement should be following by path and filenames
|
|
131
|
+
|
|
132
|
+
I may define the following in file: `lib/myTools/fenton.rb`
|
|
133
|
+
|
|
134
|
+
```ruby
|
|
135
|
+
module ItTools
|
|
136
|
+
class VpnTools
|
|
137
|
+
def on_vpn
|
|
138
|
+
puts "hello."
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Assuming lib is one of the number of pre-defined directories on your
|
|
145
|
+
system. These paths are defined in a variable called `$LOAD_PATH`
|
|
146
|
+
|
|
147
|
+
To use this in another file I'd do:
|
|
148
|
+
|
|
149
|
+
```ruby
|
|
150
|
+
require 'myTools/fenton'
|
|
151
|
+
foo = ItTools::VpnTools.new
|
|
152
|
+
foo.on_vpn
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Exception Handling
|
|
156
|
+
|
|
157
|
+
```ruby
|
|
158
|
+
begin
|
|
159
|
+
1/0
|
|
160
|
+
p 'I should never get executed'
|
|
161
|
+
rescue
|
|
162
|
+
p 'I am rescuing an exception and can do what I want!'
|
|
163
|
+
end
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Inheritance
|
|
167
|
+
|
|
168
|
+
[ref](http://rubylearning.com/satishtalim/ruby_inheritance.html)
|
|
169
|
+
|
|
170
|
+
* A class can only inherit from a *SINGLE* other class.
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
```ruby
|
|
174
|
+
class Mammal
|
|
175
|
+
def breathe
|
|
176
|
+
puts "inhale and exhale"
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
class Cat < Mammal
|
|
180
|
+
def speak
|
|
181
|
+
puts "Meow"
|
|
182
|
+
end
|
|
183
|
+
end
|
|
184
|
+
rani = Cat.new
|
|
185
|
+
rani.breathe
|
|
186
|
+
rani.speak
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Command Line Arguments
|
|
190
|
+
|
|
191
|
+
are stored in the array `ARGV`
|
|
192
|
+
|
|
193
|
+
```ruby
|
|
194
|
+
#!/usr/bin/env ruby
|
|
195
|
+
ARGV.each do|a|
|
|
196
|
+
puts "Argument: #{a}"
|
|
197
|
+
end
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
# Cook Book
|
|
201
|
+
|
|
202
|
+
## Creating Gems
|
|
203
|
+
|
|
204
|
+
[Ref](http://blog.thepete.net/2010/11/creating-and-publishing-your-first-ruby.html)
|
|
205
|
+
|
|
206
|
+
In this example we create a gem called: `fentonGem1`
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
$ rvm gemset create fentonGem1
|
|
210
|
+
$ rvm gemset use fentonGem1
|
|
211
|
+
$ gem install bundler
|
|
212
|
+
$ bundle gem fentonGem1
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Look at `fentonGem1.gemspec` update summary/description lines:
|
|
216
|
+
|
|
217
|
+
```ruby
|
|
218
|
+
s.summary = %q{Gem basically does nothing}
|
|
219
|
+
s.description = %q{Gem really doesnt do anything}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Create our library function
|
|
223
|
+
|
|
224
|
+
in file: `lib/fentonGem1/do_little.rb
|
|
225
|
+
|
|
226
|
+
```ruby
|
|
227
|
+
module FentonGem1
|
|
228
|
+
class DoLittle
|
|
229
|
+
def simpleFunc
|
|
230
|
+
time = Time.now
|
|
231
|
+
minute = time.min
|
|
232
|
+
hour = time.hour % 12
|
|
233
|
+
meridian_indicator = time.hour < 12 ? 'AM' : 'PM'
|
|
234
|
+
"#{minute} minutes past #{hour} o'clock, #{meridian_indicator}"
|
|
235
|
+
end
|
|
236
|
+
end
|
|
237
|
+
end
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### Make it scriptable
|
|
241
|
+
|
|
242
|
+
in file: `bin/getTimeNow`
|
|
243
|
+
|
|
244
|
+
```ruby
|
|
245
|
+
#!/usr/bin/env ruby
|
|
246
|
+
require 'fentonGem1/do_little'
|
|
247
|
+
do_little = FentonGem1::DoLittle.new
|
|
248
|
+
puts do_little.simpleFunc
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Build Gem and Test
|
|
252
|
+
|
|
253
|
+
Add items into git repository
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
$ git add bin/ lib/*; git commit -am'.'
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
~/tmp/fentonGem1$ rake install
|
|
261
|
+
~/tmp/fentonGem1$ getTimeNow
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### Publish
|
|
265
|
+
|
|
266
|
+
Signup at rubygems.org:
|
|
267
|
+
|
|
268
|
+
[Instructions at rubygems.org](https://rubygems.org/pages/gem_docs)
|
|
269
|
+
|
|
270
|
+
publish with:
|
|
271
|
+
|
|
272
|
+
```bash
|
|
273
|
+
$ gem push pkg/fentonGem1-0.0.1.gem
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
# Install - RedHat variants
|
|
277
|
+
|
|
278
|
+
As root
|
|
279
|
+
|
|
280
|
+
```bash
|
|
281
|
+
# yum install -y curl openssl-devel zlib-devel gcc gcc-c++ make autoconf readline-devel curl-devel expat-devel gettext-devel
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
As the user who will be using ruby:
|
|
285
|
+
|
|
286
|
+
```bash
|
|
287
|
+
$ wget https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer
|
|
288
|
+
$ chmod a+x rvm-installer
|
|
289
|
+
$ echo insecure >> ~/.curlrc
|
|
290
|
+
$ ./rvm-installer
|
|
291
|
+
$ source /home/fenton/.bash_profile
|
|
292
|
+
$ rvm install 1.9.3
|
|
293
|
+
$ echo -e "\nrvm use 1.9.3" >> ~/.bash_profile
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
Log out completely (so .bash_profile gets executed) and log back in.
|
|
297
|
+
|
|
298
|
+
```bash
|
|
299
|
+
$ ruby --version
|
|
300
|
+
ruby 1.9.3p0 (2011-10-30 revision 33570) [i686-linux]
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
# Unit Testing
|
|
304
|
+
|
|
305
|
+
[ref](http://www.moseshohman.com/blog/2004/10/13/building-testunit-testsuites-in-ruby/)
|
|
306
|
+
|
|
307
|
+
## Test Case
|
|
308
|
+
|
|
309
|
+
Folder layout:
|
|
310
|
+
|
|
311
|
+
```
|
|
312
|
+
it_tools/
|
|
313
|
+
├── Gemfile
|
|
314
|
+
├── it_tools.gemspec
|
|
315
|
+
├── lib
|
|
316
|
+
│ └── it_tools
|
|
317
|
+
│ ├── deploy.rb
|
|
318
|
+
│ ├── it_tools.rb
|
|
319
|
+
│ ├── mail.rb
|
|
320
|
+
│ └── version.rb
|
|
321
|
+
├── Rakefile
|
|
322
|
+
└── test
|
|
323
|
+
└── it_tools
|
|
324
|
+
└── test_deploy.rb
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
Sample test: `test/it_tools/test_deploy.rb`
|
|
329
|
+
|
|
330
|
+
```ruby
|
|
331
|
+
require "test/unit"
|
|
332
|
+
require 'pathname'
|
|
333
|
+
libpath = Pathname.new(
|
|
334
|
+
File.join(File.dirname(__FILE__), [".."]*2, "lib")
|
|
335
|
+
).cleanpath.to_s
|
|
336
|
+
$:.unshift(libpath) unless $:.include?(libpath)
|
|
337
|
+
|
|
338
|
+
require "it_tools/deploy"
|
|
339
|
+
|
|
340
|
+
class TestEnvironment < Test::Unit::TestCase
|
|
341
|
+
def test_get_deploy_dir
|
|
342
|
+
env = Deployment::Environment.new
|
|
343
|
+
assert_equal('/scratch/ngsp/hrmsToCrmod', env.get_deploy_dir('dev'))
|
|
344
|
+
end
|
|
345
|
+
end
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
This stuff:
|
|
349
|
+
|
|
350
|
+
```ruby
|
|
351
|
+
require 'pathname'
|
|
352
|
+
libpath = Pathname.new(
|
|
353
|
+
File.join(File.dirname(__FILE__), [".."]*2, "lib")
|
|
354
|
+
).cleanpath.to_s
|
|
355
|
+
$:.unshift(libpath) unless $:.include?(libpath)
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
ensures that `lib` is on your load path, so you can test now with:
|
|
359
|
+
|
|
360
|
+
```bash
|
|
361
|
+
~/projects/it_tools $ ruby test/it_tools/test_deploy.rb
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
## Test Suite
|
|
365
|
+
|
|
366
|
+
Layout:
|
|
367
|
+
|
|
368
|
+
```
|
|
369
|
+
it_tools/
|
|
370
|
+
├── Gemfile
|
|
371
|
+
├── it_tools.gemspec
|
|
372
|
+
├── lib
|
|
373
|
+
│ └── it_tools
|
|
374
|
+
│ ├── deploy.rb
|
|
375
|
+
│ ├── it_tools.rb
|
|
376
|
+
│ ├── mail.rb
|
|
377
|
+
│ └── version.rb
|
|
378
|
+
├── Rakefile
|
|
379
|
+
└── test
|
|
380
|
+
└── it_tools
|
|
381
|
+
├── suite_it_tools.rb
|
|
382
|
+
└── test_deploy.rb
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
file: `test/it_tools/suite_it_tools.rb
|
|
386
|
+
|
|
387
|
+
```ruby
|
|
388
|
+
require 'pathname'
|
|
389
|
+
testpath = Pathname.new(
|
|
390
|
+
File.join(File.dirname(__FILE__), ".."*1)
|
|
391
|
+
).cleanpath.to_s
|
|
392
|
+
$:.unshift(testpath) unless $:.include?(testpath)
|
|
393
|
+
|
|
394
|
+
require 'it_tools/test_deploy'
|
|
395
|
+
|
|
396
|
+
te = TestDeployment::TestEnvironment.new("TestEnvironment")
|
|
397
|
+
te.test_get_deploy_dir
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
test with:
|
|
401
|
+
|
|
402
|
+
```bash
|
|
403
|
+
~/projects/it_tools $ ruby test/it_tools/suite_it_tools.rb
|
|
404
|
+
```
|
data/testdata/simple.mmd
ADDED
data/testdata/simple.xml
ADDED
data/testdata/small.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Oracle® Data
|