homeward 0.2.3

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 ADDED
@@ -0,0 +1,2 @@
1
+ pkg/*
2
+ *.gem
data/History.txt ADDED
@@ -0,0 +1,44 @@
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
+
22
+ == 0.2.0 / 2009-06-01
23
+ * 2 major enhancements
24
+ - Removed many methods in the Homeward namespace - Homeward is now simply a generator.
25
+ - Generated rake file loads its rake tasks from the gem
26
+
27
+ * 3 minor enhancements
28
+ - APP_CONFIG is now APP_SETTINGS
29
+ - Running the Blueprint rake tasks clones the repo into /tmp unless its already present
30
+ - Jrails is installed from github
31
+
32
+ == 0.1.1 / 2009-01-12
33
+ * 2 major enhancements
34
+ - Providing a mechanism for creating application specific settings via config/settings.yml. Access your settings via the APP_CONFIG constant
35
+ - The homeward generator creates all homeward files, including the application_layout; the homeward_layout generator has been removed
36
+
37
+ * 3 minor enhancements
38
+ - View and Controller helpers now mixed-in to ActionView::Base and ActionController::Base [thanks tpope]
39
+ - Added config/initializers/constants.rb to the generator
40
+ - Added config/settings.yml and config/settings.yml.example to the generator
41
+ - Note: you should add config/settings.yml to your .gitignore
42
+
43
+ == 0.1.0 / 2009-01-04
44
+ * Birthday!
data/README.rdoc ADDED
@@ -0,0 +1,72 @@
1
+ = Homeward
2
+ by Sandro Turriate
3
+ http://github.com/sandro/homeward
4
+
5
+ == DESCRIPTION:
6
+
7
+ Rakefile and generators to help create my baseapp
8
+
9
+ == FEATURES:
10
+
11
+ * Installs Blueprint css
12
+ * Replaces prototype with jrails
13
+ * Creates an application layout which includes Blueprint and jrails
14
+ * Creates config/settings.yml for application specific settings
15
+ * Creates config/initializers/constants.rb with an APP\_CONFIG constant which consists of the settings defined in config/settings.yml
16
+ * Defines render_flashes which will render a flash message when available, utilized by the layout
17
+ * Defines current_page helper to be used with will\_paginate
18
+
19
+ rake homeward:install
20
+ Update and install Blueprint, replace prototype with jrails
21
+
22
+ rake homeward:blueprint:install
23
+ installs blueprint
24
+
25
+ rake homeward:blueprint:update
26
+ pulls the latest blueprint code
27
+
28
+ rake homeward:javascript:install_jrails
29
+ installs jrails
30
+
31
+ rake homeward:javascript:remove_prototype
32
+ removes prototype
33
+
34
+ rake homeward:javascript:use_jrails
35
+ replaces prototype with jrails
36
+
37
+ == REQUIREMENTS:
38
+
39
+ * Rails
40
+ * Haml
41
+
42
+ == INSTALL:
43
+
44
+ 1. gem install sandro-homeward
45
+ 2. script/generate homeward
46
+ 3. rake homeward:install
47
+
48
+ == LICENSE:
49
+
50
+ (The MIT License)
51
+
52
+ Copyright (c) 2008 - 2009
53
+
54
+ Permission is hereby granted, free of charge, to any person obtaining
55
+ a copy of this software and associated documentation files (the
56
+ 'Software'), to deal in the Software without restriction, including
57
+ without limitation the rights to use, copy, modify, merge, publish,
58
+ distribute, sublicense, and/or sell copies of the Software, and to
59
+ permit persons to whom the Software is furnished to do so, subject to
60
+ the following conditions:
61
+
62
+ The above copyright notice and this permission notice shall be
63
+ included in all copies or substantial portions of the Software.
64
+
65
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
66
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
67
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
68
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
69
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
70
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
71
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
72
+
data/Rakefile ADDED
@@ -0,0 +1,17 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gemspec|
7
+ gemspec.name = "homeward"
8
+ gemspec.summary = "Install blueprint, jrails, application layout, etc."
9
+ gemspec.description = "A collection of utilities I like to use on all new rails projects"
10
+ gemspec.email = "sandro.turriate@gmail.com"
11
+ gemspec.homepage = "http://github.com/sandro/homeward"
12
+ gemspec.authors = ["Sandro Turriate"]
13
+ end
14
+ Jeweler::GemcutterTasks.new
15
+ rescue LoadError
16
+ puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
17
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.2.3
data/homeward.gemspec ADDED
@@ -0,0 +1,53 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{homeward}
8
+ s.version = "0.2.3"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Sandro Turriate"]
12
+ s.date = %q{2009-12-23}
13
+ s.description = %q{A collection of utilities I like to use on all new rails projects}
14
+ s.email = %q{sandro.turriate@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "README.rdoc"
17
+ ]
18
+ s.files = [
19
+ ".gitignore",
20
+ "History.txt",
21
+ "README.rdoc",
22
+ "Rakefile",
23
+ "VERSION",
24
+ "homeward.gemspec",
25
+ "lib/homeward.rb",
26
+ "lib/homeward/tasks/homeward.rake",
27
+ "rails_generators/homeward/USAGE",
28
+ "rails_generators/homeward/homeward_generator.rb",
29
+ "rails_generators/homeward/templates/application.html.haml",
30
+ "rails_generators/homeward/templates/application_settings.rb",
31
+ "rails_generators/homeward/templates/current_page_normalizer.rb",
32
+ "rails_generators/homeward/templates/homeward.rake",
33
+ "rails_generators/homeward/templates/homeward_helper.rb",
34
+ "rails_generators/homeward/templates/settings.yml",
35
+ "rails_generators/homeward/templates/uri_ext.rb"
36
+ ]
37
+ s.homepage = %q{http://github.com/sandro/homeward}
38
+ s.rdoc_options = ["--charset=UTF-8"]
39
+ s.require_paths = ["lib"]
40
+ s.rubygems_version = %q{1.3.5}
41
+ s.summary = %q{Install blueprint, jrails, application layout, etc.}
42
+
43
+ if s.respond_to? :specification_version then
44
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
45
+ s.specification_version = 3
46
+
47
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
48
+ else
49
+ end
50
+ else
51
+ end
52
+ end
53
+
data/lib/homeward.rb ADDED
File without changes
@@ -0,0 +1,54 @@
1
+ require 'fileutils'
2
+ require 'open3'
3
+
4
+ BLUEPRINT_CLONE_URL = "git://github.com/joshuaclayton/blueprint-css.git"
5
+ BLUEPRINT_PATH = "/tmp/blueprint-css"
6
+
7
+ namespace :homeward do
8
+ desc %q(Update and install Blueprint, replace prototype with jrails)
9
+ task :install => %w(homeward:blueprint:update homeward:blueprint:install homeward:javascript:use_jrails)
10
+
11
+ namespace :blueprint do
12
+ task :clone do
13
+ unless File.exists?(BLUEPRINT_PATH)
14
+ puts %x(git clone #{BLUEPRINT_CLONE_URL} #{BLUEPRINT_PATH})
15
+ end
16
+ end
17
+
18
+ desc 'pulls the latest blueprint code'
19
+ task :update => :clone do
20
+ Dir.chdir BLUEPRINT_PATH do
21
+ Open3.popen3("git stash && git pull && git pop") do |stdin, stdout, stderr|
22
+ puts stdout.readlines.last
23
+ end
24
+ end
25
+ end
26
+
27
+ desc "installs blueprint"
28
+ task :install => :clone do
29
+ compressor = "#{BLUEPRINT_PATH}/lib/compress.rb"
30
+ install_path = "#{Rails.root}/public/stylesheets/blueprint"
31
+ %x(ruby #{compressor} -o #{install_path})
32
+ FileUtils.rm_rf "#{install_path}/src"
33
+ end
34
+ end
35
+
36
+ namespace :javascript do
37
+ desc 'replaces prototype with jrails'
38
+ task :use_jrails => [:remove_prototype, :install_jrails]
39
+
40
+ desc 'removes prototype'
41
+ task :remove_prototype do
42
+ Dir.chdir("#{Rails.root}/public/javascripts") do
43
+ FileUtils.rm_rf %w(prototype.js effects.js dragdrop.js controls.js)
44
+ end
45
+ end
46
+
47
+ desc 'installs jrails'
48
+ task :install_jrails do
49
+ Dir.chdir(Rails.root) do
50
+ puts %x(script/plugin install git://github.com/aaronchi/jrails.git)
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,4 @@
1
+ Description:
2
+ Adds the homeward rake task to lib/tasks/homeward.rake
3
+ Copies the homeward application layout to app/views/layouts/application.html.haml
4
+ Creates application wide settings in config/settings.yml
@@ -0,0 +1,32 @@
1
+ class HomewardGenerator < Rails::Generator::Base
2
+ attr_accessor :project_name
3
+
4
+ def initialize(runtime_args, runtime_options = {})
5
+ super
6
+ @project_name = File.basename(Rails.root).humanize
7
+ end
8
+
9
+ def manifest
10
+ record do |m|
11
+ m.directory 'lib/tasks'
12
+ m.directory 'config/initializers'
13
+ m.directory 'app/helpers'
14
+ m.directory 'app/views/layouts'
15
+
16
+ m.with_options :collision => :ask do |mc|
17
+ mc.file 'homeward.rake', 'lib/tasks/homeward.rake'
18
+ mc.file 'uri_ext.rb', 'lib/uri_ext.rb'
19
+
20
+ mc.template 'application.html.haml', 'app/views/layouts/application.html.haml'
21
+
22
+ mc.template 'application_settings.rb', 'config/initializers/application_settings.rb'
23
+ mc.template 'current_page_normalizer.rb', 'config/initializers/current_page_normalizer.rb'
24
+ mc.template 'homeward_helper.rb', 'app/helpers/homeward_helper.rb'
25
+
26
+ mc.template 'settings.yml', 'config/settings.yml'
27
+ mc.template 'settings.yml', 'config/settings.yml.example'
28
+ end
29
+ end
30
+ end
31
+ end
32
+
@@ -0,0 +1,19 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %meta{"http-equiv" => 'Content-Type', :content => 'text/html;charset=utf-8'}
5
+ %title= yield(:title) || "<%= project_name %>"
6
+ = blueprint_stylesheets
7
+ = stylesheet_link_tag 'application', :media => 'screen, projection'
8
+ = javascript_include_tag %w(jquery jquery-ui jrails)
9
+ = javascript_include_tag 'application'
10
+ = yield :head
11
+ %body
12
+ .container
13
+ #header
14
+ %h1
15
+ = link_to "<%= project_name %>", root_url
16
+
17
+ = render_flash
18
+ = yield
19
+
@@ -0,0 +1,41 @@
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
15
+ end
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
39
+ end
40
+
41
+ ApplicationSettings.build_from_yaml(File.join(RAILS_ROOT, 'config', 'settings.yml'))
@@ -0,0 +1,8 @@
1
+ ActionController::Base.class_eval do
2
+ protected
3
+
4
+ def current_page
5
+ params[:page].to_i < 1 ? 1 : params[:page].to_i
6
+ end
7
+ helper_method :current_page
8
+ end
@@ -0,0 +1,6 @@
1
+ begin
2
+ require 'homeward'
3
+ load 'homeward/tasks/homeward.rake'
4
+ rescue LoadError
5
+ puts "Could not find the homeward raketask, did you install the 'sandro-homeward' gem?"
6
+ end
@@ -0,0 +1,17 @@
1
+ module HomewardHelper
2
+ def blueprint_stylesheets
3
+ %(
4
+ #{stylesheet_link_tag 'blueprint/screen', :media => 'screen, projection'}
5
+ #{stylesheet_link_tag 'blueprint/print', :media => 'print'}
6
+ <!--[if IE]>
7
+ #{stylesheet_link_tag 'blueprint/ie', :media => 'screen, projection'}
8
+ <![endif]-->
9
+ )
10
+ end
11
+
12
+ def render_flash
13
+ flash.map do |type, value|
14
+ content_tag('div', value, :id => "flash", :class => type)
15
+ end.join("\n")
16
+ end
17
+ end
@@ -0,0 +1,13 @@
1
+ globals: &globals
2
+ project_name: <%= project_name %>
3
+ host: localhost
4
+
5
+ development:
6
+ <<: *globals
7
+ host_port: 3000
8
+
9
+ test:
10
+ <<: *globals
11
+
12
+ production:
13
+ <<: *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 ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: homeward
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.3
5
+ platform: ruby
6
+ authors:
7
+ - Sandro Turriate
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-12-23 00:00:00 -05:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: A collection of utilities I like to use on all new rails projects
17
+ email: sandro.turriate@gmail.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README.rdoc
24
+ files:
25
+ - .gitignore
26
+ - History.txt
27
+ - README.rdoc
28
+ - Rakefile
29
+ - VERSION
30
+ - homeward.gemspec
31
+ - lib/homeward.rb
32
+ - lib/homeward/tasks/homeward.rake
33
+ - rails_generators/homeward/USAGE
34
+ - rails_generators/homeward/homeward_generator.rb
35
+ - rails_generators/homeward/templates/application.html.haml
36
+ - rails_generators/homeward/templates/application_settings.rb
37
+ - rails_generators/homeward/templates/current_page_normalizer.rb
38
+ - rails_generators/homeward/templates/homeward.rake
39
+ - rails_generators/homeward/templates/homeward_helper.rb
40
+ - rails_generators/homeward/templates/settings.yml
41
+ - rails_generators/homeward/templates/uri_ext.rb
42
+ has_rdoc: true
43
+ homepage: http://github.com/sandro/homeward
44
+ licenses: []
45
+
46
+ post_install_message:
47
+ rdoc_options:
48
+ - --charset=UTF-8
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: "0"
56
+ version:
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: "0"
62
+ version:
63
+ requirements: []
64
+
65
+ rubyforge_project:
66
+ rubygems_version: 1.3.5
67
+ signing_key:
68
+ specification_version: 3
69
+ summary: Install blueprint, jrails, application layout, etc.
70
+ test_files: []
71
+