openshifter 0.4 → 0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module OpenShifter
2
- VERSION = '0.4' unless const_defined?(:VERSION)
2
+ VERSION = '0.5' unless const_defined?(:VERSION)
3
3
  end
@@ -64,41 +64,57 @@ send("setup_#{CONFIG['install']}".to_sym)
64
64
 
65
65
  ENV['GEM_PATH'] = ENV['GEM_HOME'] = SYS[:gems]
66
66
 
67
- puts '-> Cleaning target'
68
- FileUtils.rm_rf(SYS[:root])
67
+ def create_jee_structure
68
+ puts '-> Cleaning target'
69
+ FileUtils.rm_rf(SYS[:root])
69
70
 
70
- puts '-> Creating target'
71
- FileUtils.mkdir_p(SYS[:target])
71
+ puts '-> Creating target'
72
+ FileUtils.mkdir_p(SYS[:target])
72
73
 
73
- puts '-> Public files'
74
- FileUtils.cp_r(Dir.glob('public/*'), SYS[:target])
74
+ puts '-> Public files'
75
+ FileUtils.cp_r(Dir.glob('public/*'), SYS[:target])
75
76
 
76
- puts '-> META-INF'
77
- FileUtils.mkdir_p(SYS[:target_meta])
77
+ puts '-> META-INF'
78
+ FileUtils.mkdir_p(SYS[:target_meta])
78
79
 
79
- puts '--> Manifest'
80
- FileUtils.cp(File.expand_path('../templates/MANIFEST.MF', __FILE__), File.join(SYS[:target_meta], 'MANIFEST.MF'))
80
+ puts '--> Manifest'
81
+ FileUtils.cp(File.expand_path('../templates/MANIFEST.MF', __FILE__), File.join(SYS[:target_meta], 'MANIFEST.MF'))
81
82
 
82
- puts '--> init.rb'
83
- initrb = ERB.new(File.read(File.expand_path('../templates/init.rb', __FILE__))).result(binding)
84
- File.open(File.join(SYS[:target_meta], 'init.rb'), 'w') { |file| file.print(initrb) }
83
+ puts '--> init.rb'
84
+ initrb = ERB.new(File.read(File.expand_path('../templates/init.rb', __FILE__))).result(binding)
85
+ File.open(File.join(SYS[:target_meta], 'init.rb'), 'w') { |file| file.print(initrb) }
85
86
 
86
- puts '-> WEB-INF'
87
- FileUtils.mkdir_p(SYS[:target_web])
87
+ puts '-> WEB-INF'
88
+ FileUtils.mkdir_p(SYS[:target_web])
88
89
 
89
- puts '--> Application data'
90
- app = Dir.glob('*')
91
- app.delete('.openshift')
92
- app.delete('public')
93
- app.delete('deployments')
94
- FileUtils.cp_r(app, SYS[:target_web])
90
+ puts '--> Application data'
91
+ app = Dir.glob('*')
92
+ app.delete('.openshift')
93
+ app.delete('public')
94
+ app.delete('deployments')
95
+ FileUtils.cp_r(app, SYS[:target_web])
95
96
 
96
- puts '--> Lib'
97
- FileUtils.mkdir_p(File.join(SYS[:target_web], 'lib'))
97
+ puts '--> Lib'
98
+ FileUtils.mkdir_p(File.join(SYS[:target_web], 'lib'))
99
+
100
+ # Common tasks for setting Java thingies
101
+
102
+ puts '--> jboss-web.xml'
103
+ FileUtils.cp(File.expand_path('../templates/jboss-web.xml', __FILE__), File.join(SYS[:target_web], 'jboss-web.xml'))
104
+
105
+ puts '--> web.xml'
106
+ FileUtils.cp(File.expand_path('../templates/web.xml', __FILE__), File.join(SYS[:target_web], 'web.xml'))
107
+
108
+ puts '-> Deployment marker'
109
+ FileUtils.touch("#{SYS[:target]}.dodeploy")
110
+ end
98
111
 
99
112
  # Installation method specific tasks
100
113
 
101
114
  def create_remote
115
+
116
+ create_jee_structure
117
+
102
118
  puts '--> Copy runtime'
103
119
  FileUtils.mkdir_p(SYS[:libs])
104
120
  FileUtils.mkdir_p(SYS[:gems])
@@ -141,11 +157,21 @@ def create_remote
141
157
  end
142
158
 
143
159
  def create_vendor
160
+
161
+ create_jee_structure
162
+
144
163
  puts '--> Copy runtime'
145
164
  FileUtils.cp(Dir.glob('.openshift/lib/*.jar'), File.join(SYS[:target_web], 'lib'))
146
165
  end
147
166
 
148
167
  def create_torquebox
168
+
169
+ puts '-> Cleaning target'
170
+ FileUtils.rm_rf(SYS[:root])
171
+
172
+ puts '-> Creating target'
173
+ FileUtils.mkdir_p(SYS[:root])
174
+
149
175
  puts '--> Install JRuby'
150
176
  unless File.exists?(SYS[:torquebox_jruby])
151
177
  Dir.glob(File.join(ENV['OPENSHIFT_DATA_DIR'], 'jruby', 'torquebox', "jruby-*")) { |file| FileUtils.rm_rf(file) }
@@ -157,12 +183,6 @@ def create_torquebox
157
183
  FileUtils.rm(SYS[:gemfile_hash]) if File.exists?(SYS[:gemfile_hash])
158
184
  end
159
185
 
160
- unless File.exists?(SYS[:jrack])
161
- Dir.glob(File.join(SYS[:libs], "jruby-rack-*")) { |file| FileUtils.rm(file) }
162
- puts "---> Downloading jRuby-Rack #{CONFIG['jrack']}"
163
- puts `curl -o #{SYS[:jrack]} "http://repository.codehaus.org/org/jruby/rack/jruby-rack/#{CONFIG['jrack']}/jruby-rack-#{CONFIG['jrack']}.jar"`
164
- end
165
-
166
186
  puts '--> Gems'
167
187
 
168
188
  gemfile = Digest::SHA256.file('Gemfile').hexdigest
@@ -212,22 +232,12 @@ def create_torquebox
212
232
  FileUtils.ln_s(File.join(SYS[:torquebox], 'torquebox'), ".openshift/config/modules/org/torquebox")
213
233
  FileUtils.cp(File.expand_path('../templates/standalone.xml', __FILE__), '.openshift/config/standalone.xml')
214
234
 
215
- puts '--> Copying libraries'
216
- FileUtils.cp(Dir.glob(File.join(SYS[:libs], '*.jar')), File.join(SYS[:target_web], 'lib'))
235
+ knob = ERB.new(File.read(File.expand_path('../templates/app-knob.yml', __FILE__))).result(binding)
236
+ File.open(File.join(SYS[:root], 'app-knob.yml'), 'w') { |file| file.print(knob) }
217
237
 
238
+ FileUtils.touch(File.join(SYS[:root], 'app-knob.yml.dodeploy'))
218
239
  end
219
240
 
220
241
  # Run the tasks
221
242
 
222
- send("create_#{CONFIG['install']}".to_sym)
223
-
224
- # Common tasks for setting Java thingies
225
-
226
- puts '--> jboss-web.xml'
227
- FileUtils.cp(File.expand_path('../templates/jboss-web.xml', __FILE__), File.join(SYS[:target_web], 'jboss-web.xml'))
228
-
229
- puts '--> web.xml'
230
- FileUtils.cp(File.expand_path('../templates/web.xml', __FILE__), File.join(SYS[:target_web], 'web.xml'))
231
-
232
- puts '-> Deployment marker'
233
- FileUtils.touch("#{SYS[:target]}.dodeploy")
243
+ send("create_#{CONFIG['install']}".to_sym)
@@ -0,0 +1,5 @@
1
+ ---
2
+ application:
3
+ root: <%= ENV['OPENSHIFT_REPO_DIR'] %>
4
+ environment:
5
+ RACK_ENV: production
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openshifter
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.4'
4
+ version: '0.5'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -36,6 +36,7 @@ files:
36
36
  - templates/openshift/action_hooks/deploy
37
37
  - templates/openshift/action_hooks/post_deploy
38
38
  - templates/openshift/action_hooks/pre_build
39
+ - templates/openshift/action_hooks/templates/app-knob.yml
39
40
  - templates/openshift/action_hooks/templates/init.rb
40
41
  - templates/openshift/action_hooks/templates/jboss-web.xml
41
42
  - templates/openshift/action_hooks/templates/MANIFEST.MF