sandro-homeward 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,24 @@
1
+ == 0.2.2 / 2009-09-05
2
+ * enhancements
3
+ - APP_SETTINGS changed to ApplicationSettings module
4
+ module contains helpful methods for generating urls with appropriate ports
5
+ ApplicationSettings.host
6
+ ApplicationSettings.host_port
7
+ ApplicationSettings.host_with_port
8
+
9
+ - Removed init.rb and rails/init.rb
10
+ homeward is a bunch of generators not a rails plugin
11
+
12
+ - Renamed render_flashes to render_flash
13
+ Flash divs follow the convention of <div id="flash" class="notice">
14
+
15
+ - Removed the javascript variable AUTH_TOKEN
16
+ There are better ways to utilize the authenticity_token like: $('form').serialize();
17
+
18
+ == 0.2.1 / 2009-06-13
19
+ * bug fixes
20
+ - Properly namespace homeward.rake task
21
+
1
22
  == 0.2.0 / 2009-06-01
2
23
  * 2 major enhancements
3
24
  - Removed many methods in the Homeward namespace - Homeward is now simply a generator.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.2.2
@@ -1,12 +1,15 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
1
4
  # -*- encoding: utf-8 -*-
2
5
 
3
6
  Gem::Specification.new do |s|
4
7
  s.name = %q{homeward}
5
- s.version = "0.2.1"
8
+ s.version = "0.2.2"
6
9
 
7
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
11
  s.authors = ["Sandro Turriate"]
9
- s.date = %q{2009-06-13}
12
+ s.date = %q{2009-09-05}
10
13
  s.description = %q{A collection of utilities I like to use on all new rails projects}
11
14
  s.email = %q{sandro.turriate@gmail.com}
12
15
  s.extra_rdoc_files = [
@@ -15,15 +18,12 @@ Gem::Specification.new do |s|
15
18
  s.files = [
16
19
  ".gitignore",
17
20
  "History.txt",
18
- "Manifest.txt",
19
21
  "README.rdoc",
20
22
  "Rakefile",
21
23
  "VERSION",
22
24
  "homeward.gemspec",
23
- "init.rb",
24
25
  "lib/homeward.rb",
25
26
  "lib/homeward/tasks/homeward.rake",
26
- "rails/init.rb",
27
27
  "rails_generators/homeward/USAGE",
28
28
  "rails_generators/homeward/homeward_generator.rb",
29
29
  "rails_generators/homeward/templates/application.html.haml",
@@ -32,8 +32,7 @@ Gem::Specification.new do |s|
32
32
  "rails_generators/homeward/templates/homeward.rake",
33
33
  "rails_generators/homeward/templates/homeward_helper.rb",
34
34
  "rails_generators/homeward/templates/settings.yml",
35
- "spec/homeward_spec.rb",
36
- "spec/spec_helper.rb"
35
+ "rails_generators/homeward/templates/uri_ext.rb"
37
36
  ]
38
37
  s.has_rdoc = true
39
38
  s.homepage = %q{http://github.com/sandro/homeward}
@@ -41,10 +40,6 @@ Gem::Specification.new do |s|
41
40
  s.require_paths = ["lib"]
42
41
  s.rubygems_version = %q{1.3.1}
43
42
  s.summary = %q{Install blueprint, jrails, application layout, etc.}
44
- s.test_files = [
45
- "spec/homeward_spec.rb",
46
- "spec/spec_helper.rb"
47
- ]
48
43
 
49
44
  if s.respond_to? :specification_version then
50
45
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
@@ -1,29 +0,0 @@
1
- require 'yaml'
2
-
3
- module Homeward
4
- VERSION = '0.2.0'
5
- LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
6
- PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
7
-
8
- def self.version
9
- VERSION
10
- end
11
-
12
- def self.libpath( *args )
13
- args.empty? ? LIBPATH : ::File.join(LIBPATH, args.flatten)
14
- end
15
-
16
- def self.path( *args )
17
- args.empty? ? PATH : ::File.join(PATH, args.flatten)
18
- end
19
-
20
- def self.require_all_libs_relative_to(fname, dir = nil)
21
- dir ||= ::File.basename(fname, '.*')
22
- search_me = ::File.expand_path(
23
- ::File.join(::File.dirname(fname), dir, '**', '*.rb'))
24
-
25
- Dir.glob(search_me).sort.each {|rb| require rb}
26
- end
27
- end
28
-
29
- Homeward.require_all_libs_relative_to(__FILE__)
@@ -15,6 +15,7 @@ class HomewardGenerator < Rails::Generator::Base
15
15
 
16
16
  m.with_options :collision => :ask do |mc|
17
17
  mc.file 'homeward.rake', 'lib/tasks/homeward.rake'
18
+ mc.file 'uri_ext.rb', 'lib/uri_ext.rb'
18
19
 
19
20
  mc.template 'application.html.haml', 'app/views/layouts/application.html.haml'
20
21
 
@@ -5,7 +5,6 @@
5
5
  %title= h(@title || "<%= project_name %>")
6
6
  = blueprint_stylesheets
7
7
  = stylesheet_link_tag 'application', :media => 'screen, projection'
8
- = javascript_tag "var AUTH_TOKEN = #{form_authenticity_token.to_json};" if protect_against_forgery?
9
8
  = javascript_include_tag %w(jquery jquery-ui jrails)
10
9
  = javascript_include_tag 'application'
11
10
  = yield :head
@@ -15,6 +14,6 @@
15
14
  %h1
16
15
  = link_to "<%= project_name %>", root_url
17
16
 
18
- = render_flashes
17
+ = render_flash
19
18
  = yield
20
19
 
@@ -1,13 +1,41 @@
1
- def load_app_settings
2
- returning HashWithIndifferentAccess.new do |app_settings|
3
- config_file_path = File.join(RAILS_ROOT, %w(config settings.yml))
4
- if File.exist?(config_file_path)
5
- config = YAML.load_file(config_file_path)
6
- app_settings.merge!(config[Rails.env]) if config[Rails.env]
7
- else
8
- puts "WARNING: configuration file #{config_file_path} not found."
1
+ require 'ostruct'
2
+ require 'uri_ext.rb'
3
+
4
+ module ApplicationSettings
5
+ extend self
6
+
7
+ attr_writer :settings
8
+ private :settings=
9
+
10
+ def build_from_yaml(path)
11
+ if File.exist?(path) && config = YAML.load_file(path)
12
+ if settings = config[Rails.env]
13
+ self.settings = OpenStruct.new settings
14
+ end
9
15
  end
10
16
  end
17
+
18
+ def do_not_reply
19
+ "do_not_reply@#{settings.host}.com"
20
+ end
21
+
22
+ def host_uri
23
+ @host_uri ||= URI::HTTP.build(:host => settings.host, :port => settings.host_port)
24
+ end
25
+
26
+ def host_with_port
27
+ host_uri.host_with_port
28
+ end
29
+
30
+ def method_missing(name)
31
+ settings.send(name) rescue nil
32
+ end
33
+
34
+ private
35
+
36
+ def settings
37
+ @settings ||= OpenStruct.new
38
+ end
11
39
  end
12
40
 
13
- APP_SETTINGS = load_app_settings
41
+ ApplicationSettings.build_from_yaml(File.join(RAILS_ROOT, %w(config settings.yml)))
@@ -1,7 +1,8 @@
1
1
  ActionController::Base.class_eval do
2
- private
2
+ protected
3
3
 
4
4
  def current_page
5
5
  params[:page].to_i < 1 ? 1 : params[:page].to_i
6
6
  end
7
+ helper_method :current_page
7
8
  end
@@ -9,9 +9,9 @@ module HomewardHelper
9
9
  )
10
10
  end
11
11
 
12
- def render_flashes
12
+ def render_flash
13
13
  flash.map do |type, value|
14
- content_tag('div', value, :id => "flash_#{type}")
14
+ content_tag('div', value, :id => "flash", :class => type)
15
15
  end.join("\n")
16
16
  end
17
17
  end
@@ -1,8 +1,10 @@
1
1
  globals: &globals
2
2
  project_name: <%= project_name %>
3
+ host: localhost
3
4
 
4
5
  development:
5
6
  <<: *globals
7
+ host_port: 3000
6
8
 
7
9
  test:
8
10
  <<: *globals
@@ -0,0 +1,8 @@
1
+ module URI
2
+ class Generic
3
+ def host_with_port
4
+ normalized_port = ":#{port}" unless port == default_port
5
+ "#{host}#{normalized_port}"
6
+ end
7
+ end
8
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sandro-homeward
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sandro Turriate
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-13 00:00:00 -07:00
12
+ date: 2009-09-05 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -24,15 +24,12 @@ extra_rdoc_files:
24
24
  files:
25
25
  - .gitignore
26
26
  - History.txt
27
- - Manifest.txt
28
27
  - README.rdoc
29
28
  - Rakefile
30
29
  - VERSION
31
30
  - homeward.gemspec
32
- - init.rb
33
31
  - lib/homeward.rb
34
32
  - lib/homeward/tasks/homeward.rake
35
- - rails/init.rb
36
33
  - rails_generators/homeward/USAGE
37
34
  - rails_generators/homeward/homeward_generator.rb
38
35
  - rails_generators/homeward/templates/application.html.haml
@@ -41,8 +38,7 @@ files:
41
38
  - rails_generators/homeward/templates/homeward.rake
42
39
  - rails_generators/homeward/templates/homeward_helper.rb
43
40
  - rails_generators/homeward/templates/settings.yml
44
- - spec/homeward_spec.rb
45
- - spec/spec_helper.rb
41
+ - rails_generators/homeward/templates/uri_ext.rb
46
42
  has_rdoc: true
47
43
  homepage: http://github.com/sandro/homeward
48
44
  post_install_message:
@@ -69,6 +65,5 @@ rubygems_version: 1.2.0
69
65
  signing_key:
70
66
  specification_version: 2
71
67
  summary: Install blueprint, jrails, application layout, etc.
72
- test_files:
73
- - spec/homeward_spec.rb
74
- - spec/spec_helper.rb
68
+ test_files: []
69
+
@@ -1,17 +0,0 @@
1
- History.txt
2
- Manifest.txt
3
- README.rdoc
4
- Rakefile
5
- generators/homeward/USAGE
6
- generators/homeward/homeward_generator.rb
7
- generators/homeward/templates/application.html.haml
8
- generators/homeward/templates/constants.rb
9
- generators/homeward/templates/homeward.rake
10
- generators/homeward/templates/settings.yml
11
- init.rb
12
- lib/homeward.rb
13
- lib/homeward/controller_helpers.rb
14
- lib/homeward/view_helpers.rb
15
- rails/init.rb
16
- spec/homeward_spec.rb
17
- spec/spec_helper.rb
data/init.rb DELETED
@@ -1,2 +0,0 @@
1
- require File.dirname(__FILE__)+'/rails/init.rb'
2
-
@@ -1,2 +0,0 @@
1
- require File.join(File.dirname(__FILE__), %w(.. lib homeward.rb))
2
-
@@ -1,7 +0,0 @@
1
-
2
- require File.join(File.dirname(__FILE__), %w[spec_helper])
3
-
4
- describe Homeward do
5
- end
6
-
7
- # EOF
@@ -1,16 +0,0 @@
1
-
2
- require File.expand_path(
3
- File.join(File.dirname(__FILE__), %w[.. lib homeward]))
4
-
5
- Spec::Runner.configure do |config|
6
- # == Mock Framework
7
- #
8
- # RSpec uses it's own mocking framework by default. If you prefer to
9
- # use mocha, flexmock or RR, uncomment the appropriate line:
10
- #
11
- # config.mock_with :mocha
12
- # config.mock_with :flexmock
13
- # config.mock_with :rr
14
- end
15
-
16
- # EOF