ubiquo 0.2.7 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -21,6 +21,7 @@ begin
21
21
  ]
22
22
  gem.add_dependency(%q<rails>, '= 2.3.5')
23
23
 
24
+ gem.add_development_dependency(%q<mocha>, '>= 0.9.8')
24
25
  gem.add_development_dependency(%q<highline>, '>= 1.5.2')
25
26
  gem.add_development_dependency(%q<ya2yaml>, '>= 0.26')
26
27
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.7
1
+ 0.2.8
@@ -37,6 +37,13 @@ module Ubiquo
37
37
  suported_profiles.each do |profile, msg|
38
38
  o.on("--#{profile.to_s}", msg) { self[:profile] = profile }
39
39
  end
40
+ o.on(
41
+ "--custom [PLUGINS]",
42
+ "Includes minimal template, but you can add extra plugins"
43
+ ) do |plugins|
44
+ self[:profile] = :custom
45
+ self[:plugins] = plugins.split(",")
46
+ end
40
47
 
41
48
  o.separator "\nSelects ubiquo default locale (defaults to english): "
42
49
 
@@ -19,6 +19,8 @@ choosen_plugin_set = "<%= @opts[:profile].to_s %>"
19
19
 
20
20
  case choosen_plugin_set
21
21
  when "minimal" then selected_plugins = minimal_plugins
22
+ when "custom"
23
+ selected_plugins = (minimal_plugins + <%= @opts[:plugins].inspect %>).uniq
22
24
  else selected_plugins = minimal_plugins + rest_plugins
23
25
  end
24
26
 
@@ -197,7 +199,12 @@ ActionController::Routing::Routes.draw do |map|
197
199
 
198
200
  # Ubiquo plugins routes. See routes.rb from each plugin path.
199
201
  #{ubiquo_routes}
200
- <%= "map.from_plugin :ubiquo_design" if opts[:gnuine] %>
202
+ <% if opts[:gnuine] %>
203
+ <% if @opts[:template] == :edge %>
204
+ <%= "map.from_plugin :ubiquo_categories" %>
205
+ <% end %>
206
+ <%= "map.from_plugin :ubiquo_design" %>
207
+ <% end %>
201
208
  ############# default routes
202
209
  #map.connect ':controller/:action/:id'
203
210
  #map.connect ':controller/:action/:id.:format'
@@ -253,6 +260,9 @@ ubiquo_branch = <%= @opts[:template] == :edge ? 'nil' : "'0.7-stable'" %>
253
260
  add_plugins(selected_plugins + external_plugins, :branch => ubiquo_branch, :devel => <%= @opts[:devel] ? true : false %>)
254
261
 
255
262
  <% if @opts[:gnuine] && opts[:profile] == :complete %>
263
+ <% if @opts[:template] == :edge %>
264
+ plugin 'ubiquo_categories', :git => 'gitosis@gandalf.gnuine.com:ubiquo_categories.git', :submodule => true, :branch => nil
265
+ <% end %>
256
266
  plugin 'ubiquo_design', :git => 'gitosis@gandalf.gnuine.com:ubiquo_design.git', :submodule => true, :branch => ubiquo_branch
257
267
  <% end %>
258
268
 
@@ -5,23 +5,22 @@ external_plugins = %w[
5
5
  tiny_mce
6
6
  paperclip
7
7
  ]
8
- minimal_plugins = %w[ ubiquo_core ubiquo_authentication ]
8
+ minimal_plugins = %w[ ubiquo_core ubiquo_authentication ubiquo_access_control ubiquo_scaffold ]
9
9
  rest_plugins = %w[
10
- ubiquo_access_control
11
10
  ubiquo_media
12
- ubiquo_scaffold
13
11
  ubiquo_jobs
14
12
  ubiquo_i18n
15
13
  ubiquo_activity
16
14
  ubiquo_versions
17
15
  ubiquo_guides
18
- <%= "ubiquo_design" if @opts[:gnuine] %>
19
16
  ]
20
17
 
21
18
  choosen_plugin_set = "<%= @opts[:profile].to_s %>"
22
19
 
23
20
  case choosen_plugin_set
24
21
  when "minimal" then selected_plugins = minimal_plugins
22
+ when "custom"
23
+ selected_plugins = (minimal_plugins + <%= @opts[:plugins].inspect %>).uniq
25
24
  else selected_plugins = minimal_plugins + rest_plugins
26
25
  end
27
26
 
@@ -49,8 +48,8 @@ def add_plugins(plugin_names, options={})
49
48
  end
50
49
  # To ask needed settings when boostraping the app
51
50
  appname = "<%= @opts[:app_name] %>"
52
- exception_recipient = "programadors@gnuine.com"
53
- sender_address = "errors@gnuine.com"
51
+ exception_recipient = "<%= @opts[:exception_recipient] %>"
52
+ sender_address = "<%= @opts[:sender_address] %>"
54
53
  # Remove rails temporary directories
55
54
  ["./tmp/pids", "./tmp/sessions", "./tmp/sockets", "./tmp/cache"].each do |f|
56
55
  run("rmdir ./#{f}")
@@ -112,11 +111,13 @@ base_config: &base_config
112
111
  encoding: unicode
113
112
  adapter: postgresql
114
113
  host: localhost
114
+ username: #{%x{id -u -n}.strip}
115
+ password:
115
116
 
116
117
  development:
117
- <<: *base_config
118
+ <<: *base_config
118
119
  database: #{appname}_development
119
-
120
+
120
121
  test:
121
122
  <<: *base_config
122
123
  database: #{appname}_test
@@ -140,9 +141,9 @@ base_config: &base_config
140
141
  socket: /var/run/mysqld/mysqld.sock
141
142
 
142
143
  development:
143
- <<: *base_config
144
+ <<: *base_config
144
145
  database: #{appname}_development
145
-
146
+
146
147
  test:
147
148
  <<: *base_config
148
149
  database: #{appname}_test
@@ -164,20 +165,20 @@ base_config: &base_config
164
165
  timeout: 5000
165
166
 
166
167
  development:
167
- <<: *base_config
168
- dbfile: db/#{appname}_development.db
169
-
168
+ <<: *base_config
169
+ database: db/#{appname}_development.db
170
+
170
171
  test:
171
172
  <<: *base_config
172
- dbfile: db/#{appname}_test.db
173
+ database: db/#{appname}_test.db
173
174
 
174
175
  preproduction:
175
176
  <<: *base_config
176
- dbfile: db/#{appname}_preproduction.db
177
+ database: db/#{appname}_preproduction.db
177
178
 
178
179
  production:
179
180
  <<: *base_config
180
- dbfile: db/#{appname}_production.db
181
+ database: db/#{appname}_production.db
181
182
  CODE
182
183
 
183
184
  choosen_adapter = "<%= @opts[:database] %>"
@@ -198,12 +199,17 @@ ActionController::Routing::Routes.draw do |map|
198
199
 
199
200
  # Ubiquo plugins routes. See routes.rb from each plugin path.
200
201
  #{ubiquo_routes}
202
+ <% if opts[:gnuine] %>
203
+ <% if @opts[:template] == :edge %>
204
+ <%= "map.from_plugin :ubiquo_categories" %>
205
+ <% end %>
206
+ <%= "map.from_plugin :ubiquo_design" %>
207
+ <% end %>
201
208
  ############# default routes
202
209
  #map.connect ':controller/:action/:id'
203
210
  #map.connect ':controller/:action/:id.:format'
204
211
  end
205
212
  CODE
206
- puts "here we go"
207
213
  # default rails environment.rb
208
214
  file 'config/environment.rb', <<-CODE
209
215
  # Be sure to restart your server when you modify this file
@@ -220,14 +226,14 @@ Rails::Initializer.run do |config|
220
226
  # -- all .rb files in that directory are automatically loaded.
221
227
 
222
228
  # Add additional load paths for your own custom dirs
223
-
224
- # Specify gems that this application depends on.
229
+
230
+ # Specify gems that this application depends on.
225
231
  # They can then be installed with "rake gems:install" on new installations.
226
232
  # config.gem "bj"
227
233
  # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
228
234
  # config.gem "aws-s3", :lib => "aws/s3"
229
- config.gem "rmagick", :lib => 'RMagick'
230
-
235
+ # config.gem "rmagick", :lib => 'RMagick'
236
+
231
237
  # Only load the plugins named here, in the order given (default is alphabetical).
232
238
  # :all can be used as a placeholder for all plugins not explicitly named
233
239
  config.plugins = [ :ubiquo_core, :all ]
@@ -245,22 +251,28 @@ Rails::Initializer.run do |config|
245
251
 
246
252
  # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
247
253
  # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
248
- # config.i18n.default_locale = :de
254
+ # config.i18n.default_locale = :de
249
255
  config.i18n.load_path += Dir.glob(File.join("config", "locales", "**","*.{rb,yml}"))
250
- config.i18n.default_locale = :ca
256
+ config.i18n.default_locale = :<%= @opts[:locale] %>
251
257
  end
252
258
  CODE
253
- puts "out of here"
254
259
  ubiquo_branch = <%= @opts[:template] == :edge ? 'nil' : "'0.7-stable'" %>
255
- add_plugins(selected_plugins + external_plugins, :branch => ubiquo_branch, :devel => <%= @opts[:gnuine] ? true : false %>)
260
+ add_plugins(selected_plugins + external_plugins, :branch => ubiquo_branch, :devel => <%= @opts[:devel] ? true : false %>)
256
261
 
257
- <% if @opts[:gnuine] %>
262
+ <% if @opts[:gnuine] && opts[:profile] == :complete %>
263
+ <% if @opts[:template] == :edge %>
264
+ plugin 'ubiquo_categories', :git => 'gitosis@gandalf.gnuine.com:ubiquo_categories.git', :submodule => true, :branch => nil
265
+ <% end %>
258
266
  plugin 'ubiquo_design', :git => 'gitosis@gandalf.gnuine.com:ubiquo_design.git', :submodule => true, :branch => ubiquo_branch
259
267
  <% end %>
260
268
 
261
269
  rake("rails:update")
262
270
  rake("calendardateselect:install")
263
- rake("ubiquo:install")
271
+ rake("ubiquo:install OVERWRITE=yes")
272
+
273
+ <% if RUBY_PLATFORM =~ /java/ %>
274
+ generate(:jdbc)
275
+ <% end %>
264
276
 
265
277
  <% if @opts[:gnuine] %>
266
278
  rake("db:create:all")
@@ -271,9 +283,5 @@ git :add => "."
271
283
  git :commit => "-a -m 'Initial #{appname} commit'"
272
284
 
273
285
  <% unless @opts[:gnuine] %>
274
- puts "1.- You must configure your database using config/database.yml"
275
- puts "2.- You must create your databases. rake db:create:all"
276
- puts "3.- You must initialize your database. rake ubiquo:db:init"
277
- puts "4.- You must create the admin user. rake ubiquo:create_user"
278
- puts "5.- scrip/server and point your browser to http://localhost:3000/ubiquo"
286
+ puts "Run script/server and go to http://localhost:3000/ and follow the instructions there."
279
287
  <% end %>
@@ -13,4 +13,11 @@ class TestGenerator < Test::Unit::TestCase
13
13
  assert_match 'ubiquo_branch = nil', rails_template
14
14
  end
15
15
 
16
+ def test_should_generate_expected_template_from_custom_profile
17
+ skeleton = File.join(File.dirname(__FILE__), "../fixtures", "template.erb")
18
+ opts = Options.new(%w[ --custom ubiquo_media myapp ])
19
+ rails_template = Generator.build_template(opts, skeleton)
20
+ assert_kind_of String, rails_template
21
+ assert_match 'choosen_plugin_set = "custom"', rails_template
22
+ end
16
23
  end
@@ -59,4 +59,10 @@ class TestOptions < Test::Unit::TestCase
59
59
  assert_equal "s@s.com", opts[:sender_address]
60
60
  end
61
61
 
62
+ def test_should_be_able_to_add_custom_plugins
63
+ opts = Options.new(%w[ --custom ubiquo_media myapp ])
64
+ assert_equal :custom, opts[:profile]
65
+ assert_equal ["ubiquo_media"].inspect, opts[:plugins].inspect
66
+ end
67
+
62
68
  end
data/ubiquo.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ubiquo}
8
- s.version = "0.2.7"
8
+ s.version = "0.2.8"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Albert Callarisa", "Bernat Foj", "Eric Garc\303\255a", "Felip Ladr\303\263n", "Antoni Reina", "Ramon Salvad\303\263", "Arnau S\303\241nchez"]
12
- s.date = %q{2010-04-27}
12
+ s.date = %q{2010-05-08}
13
13
  s.default_executable = %q{ubiquo}
14
14
  s.description = %q{This gem provides a command-line application to make the creation of ubiquo based applications fast and easy.}
15
15
  s.email = %q{rsalvado@gnuine.com}
@@ -53,15 +53,18 @@ Gem::Specification.new do |s|
53
53
 
54
54
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
55
55
  s.add_runtime_dependency(%q<rails>, ["= 2.3.5"])
56
+ s.add_development_dependency(%q<mocha>, [">= 0.9.8"])
56
57
  s.add_development_dependency(%q<highline>, [">= 1.5.2"])
57
58
  s.add_development_dependency(%q<ya2yaml>, [">= 0.26"])
58
59
  else
59
60
  s.add_dependency(%q<rails>, ["= 2.3.5"])
61
+ s.add_dependency(%q<mocha>, [">= 0.9.8"])
60
62
  s.add_dependency(%q<highline>, [">= 1.5.2"])
61
63
  s.add_dependency(%q<ya2yaml>, [">= 0.26"])
62
64
  end
63
65
  else
64
66
  s.add_dependency(%q<rails>, ["= 2.3.5"])
67
+ s.add_dependency(%q<mocha>, [">= 0.9.8"])
65
68
  s.add_dependency(%q<highline>, [">= 1.5.2"])
66
69
  s.add_dependency(%q<ya2yaml>, [">= 0.26"])
67
70
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 7
9
- version: 0.2.7
8
+ - 8
9
+ version: 0.2.8
10
10
  platform: ruby
11
11
  authors:
12
12
  - Albert Callarisa
@@ -20,7 +20,7 @@ autorequire:
20
20
  bindir: bin
21
21
  cert_chain: []
22
22
 
23
- date: 2010-04-27 00:00:00 +02:00
23
+ date: 2010-05-08 00:00:00 +02:00
24
24
  default_executable: ubiquo
25
25
  dependencies:
26
26
  - !ruby/object:Gem::Dependency
@@ -38,9 +38,23 @@ dependencies:
38
38
  type: :runtime
39
39
  version_requirements: *id001
40
40
  - !ruby/object:Gem::Dependency
41
- name: highline
41
+ name: mocha
42
42
  prerelease: false
43
43
  requirement: &id002 !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ segments:
48
+ - 0
49
+ - 9
50
+ - 8
51
+ version: 0.9.8
52
+ type: :development
53
+ version_requirements: *id002
54
+ - !ruby/object:Gem::Dependency
55
+ name: highline
56
+ prerelease: false
57
+ requirement: &id003 !ruby/object:Gem::Requirement
44
58
  requirements:
45
59
  - - ">="
46
60
  - !ruby/object:Gem::Version
@@ -50,11 +64,11 @@ dependencies:
50
64
  - 2
51
65
  version: 1.5.2
52
66
  type: :development
53
- version_requirements: *id002
67
+ version_requirements: *id003
54
68
  - !ruby/object:Gem::Dependency
55
69
  name: ya2yaml
56
70
  prerelease: false
57
- requirement: &id003 !ruby/object:Gem::Requirement
71
+ requirement: &id004 !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - ">="
60
74
  - !ruby/object:Gem::Version
@@ -63,7 +77,7 @@ dependencies:
63
77
  - 26
64
78
  version: "0.26"
65
79
  type: :development
66
- version_requirements: *id003
80
+ version_requirements: *id004
67
81
  description: This gem provides a command-line application to make the creation of ubiquo based applications fast and easy.
68
82
  email: rsalvado@gnuine.com
69
83
  executables: