sandro-homeward 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt ADDED
@@ -0,0 +1,2 @@
1
+ == 0.1.0 / 2009-01-04
2
+ * Birthday!
data/Manifest.txt ADDED
@@ -0,0 +1,19 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.markdown
4
+ README.txt
5
+ Rakefile
6
+ generators/homeward/USAGE
7
+ generators/homeward/homeward_generator.rb
8
+ generators/homeward/templates/homeward.rake
9
+ generators/homeward_layout/USAGE
10
+ generators/homeward_layout/homeward_layout_generator.rb
11
+ generators/homeward_layout/templates/application.html.haml
12
+ init.rb
13
+ lib/homeward.rb
14
+ lib/homeward/controllers/application.rb
15
+ lib/homeward/helpers/application_helper.rb
16
+ rails/init.rb
17
+ spec/homeward_spec.rb
18
+ spec/spec_helper.rb
19
+ tasks/homeward.rake
data/README.markdown ADDED
@@ -0,0 +1,84 @@
1
+ Homeward
2
+ ==========
3
+ by Sandro Turriate
4
+ http://github.com/sandro/homeward
5
+
6
+ DESCRIPTION:
7
+ --------
8
+ Rakefile and generators to help create my baseapp
9
+
10
+ FEATURES:
11
+ --------
12
+ Installs Blueprint css
13
+ Replaces Prototype with jQuery
14
+ Creates an application layout which includes Blueprint and jQuery
15
+ Includes a `render_flashes` application\_helper method which will render a flash message when available
16
+ Includes a `current_page` helper to be used with will\_paginate
17
+
18
+ rake homeward
19
+ Run all significant tasks
20
+ Create application layout
21
+ Update Blueprint
22
+ Install Blueprint
23
+ Replace prototype with jrails
24
+
25
+ rake homeward:application_layout
26
+ Invokes the homeward_layout generator
27
+
28
+ rake homeward:blueprint:install
29
+ installs blueprint
30
+
31
+ rake homeward:blueprint:update
32
+ pulls the latest blueprint code
33
+
34
+ rake homeward:javascript:install_jrails
35
+ installs jrails
36
+
37
+ rake homeward:javascript:remove_prototype
38
+ removes prototype
39
+
40
+ rake homeward:javascript:use_jrails
41
+ replaces prototype with jrails
42
+
43
+ TODO/FIXES:
44
+ --------
45
+ Don't re-open classes to define methods, they need to be overwritable.
46
+
47
+ SYNOPSIS:
48
+ --------
49
+ script/generate homeward
50
+ rake homeward
51
+
52
+ REQUIREMENTS:
53
+ --------
54
+ * Rails
55
+
56
+ INSTALL:
57
+ --------
58
+ sudo gem install --source http://gems.github.com sandro-homeward
59
+
60
+ LICENSE:
61
+ --------
62
+ (The MIT License)
63
+
64
+ Copyright (c) 2008
65
+
66
+ Permission is hereby granted, free of charge, to any person obtaining
67
+ a copy of this software and associated documentation files (the
68
+ 'Software'), to deal in the Software without restriction, including
69
+ without limitation the rights to use, copy, modify, merge, publish,
70
+ distribute, sublicense, and/or sell copies of the Software, and to
71
+ permit persons to whom the Software is furnished to do so, subject to
72
+ the following conditions:
73
+
74
+ The above copyright notice and this permission notice shall be
75
+ included in all copies or substantial portions of the Software.
76
+
77
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
78
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
79
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
80
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
81
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
82
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
83
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
84
+
data/README.txt ADDED
File without changes
data/Rakefile ADDED
@@ -0,0 +1,40 @@
1
+ # Look in the tasks/setup.rb file for the various options that can be
2
+ # configured in this Rakefile. The .rake files in the tasks directory
3
+ # are where the options are used.
4
+
5
+ begin
6
+ require 'bones'
7
+ Bones.setup
8
+ rescue LoadError
9
+ begin
10
+ load 'tasks/setup.rb'
11
+ rescue LoadError
12
+ raise RuntimeError, '### please install the "bones" gem ###'
13
+ end
14
+ end
15
+
16
+ ensure_in_path 'lib'
17
+ require 'homeward'
18
+
19
+ task :default => 'spec:run'
20
+
21
+ namespace :gem do
22
+ task :redo do
23
+ puts %x(rm -rf pkg/homeward-1.0.0 && rake manifest:create && rake gem:reinstall)
24
+ end
25
+ end
26
+
27
+ PROJ.name = 'homeward'
28
+ PROJ.summary = 'Personal rails methods I always use'
29
+ PROJ.description = PROJ.summary
30
+ PROJ.authors = 'Sandro Turriate'
31
+ PROJ.email = 'sandro.turriate@gmail.com'
32
+ PROJ.url = 'http://github.com/sandro/homeward'
33
+ PROJ.version = Homeward::VERSION
34
+ PROJ.rubyforge.name = 'homeward'
35
+
36
+ PROJ.spec.opts << '--color'
37
+
38
+ PROJ.exclude << %w(.*.gemspec \.gitignore)
39
+
40
+ # EOF
@@ -0,0 +1,2 @@
1
+ Description:
2
+ Adds the homeward rake task to lib/tasks/homeward.rake
@@ -0,0 +1,12 @@
1
+ class HomewardGenerator < Rails::Generator::Base
2
+ def initialize(runtime_args, runtime_options = {})
3
+ Dir.mkdir('lib/tasks') unless File.directory?('lib/tasks')
4
+ super
5
+ end
6
+
7
+ def manifest
8
+ record do |m|
9
+ m.file 'homeward.rake', 'lib/tasks/homeward.rake', :collision => :ask
10
+ end
11
+ end
12
+ end
@@ -0,0 +1 @@
1
+ /Users/santuri/Code/Ruby/homeward/tasks/homeward.rake
@@ -0,0 +1,2 @@
1
+ Description:
2
+ Copies the homeward layout to app/views/layouts/application.html.haml
@@ -0,0 +1,16 @@
1
+ class HomewardLayoutGenerator < 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.template 'application.html.haml', 'app/views/layouts/application.html.haml', :collision => :ask
12
+ end
13
+ end
14
+
15
+
16
+ end
@@ -0,0 +1,20 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %meta{"http-equiv" => 'Content-Type', :content => 'text/html;charset=utf-8'}
5
+ %title= h(@title || "<%= project_name %>")
6
+ = blueprint_includes
7
+ = stylesheet_link_tag 'application', :media => 'screen, projection'
8
+ = javascript_tag "var AUTH_TOKEN = #{form_authenticity_token.to_json};" if protect_against_forgery?
9
+ = javascript_include_tag %w(jquery jquery-ui jrails)
10
+ = javascript_include_tag 'application'
11
+ = yield :head
12
+ %body
13
+ .container
14
+ #header
15
+ %h1
16
+ = link_to "<%= project_name %>", root_url
17
+
18
+ = render_flashes
19
+ = yield
20
+
data/init.rb ADDED
@@ -0,0 +1,2 @@
1
+ require File.dirname(__FILE__)+'/rails/init.rb'
2
+
data/lib/homeward.rb ADDED
@@ -0,0 +1,28 @@
1
+ module Homeward
2
+ VERSION = '0.1.0'
3
+ LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
4
+ PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
5
+
6
+ def self.version
7
+ VERSION
8
+ end
9
+
10
+ def self.libpath( *args )
11
+ args.empty? ? LIBPATH : ::File.join(LIBPATH, args.flatten)
12
+ end
13
+
14
+ def self.path( *args )
15
+ args.empty? ? PATH : ::File.join(PATH, args.flatten)
16
+ end
17
+
18
+ def self.require_all_libs_relative_to( fname, dir = nil )
19
+ dir ||= ::File.basename(fname, '.*')
20
+ search_me = ::File.expand_path(
21
+ ::File.join(::File.dirname(fname), dir, '**', '*.rb'))
22
+
23
+ Dir.glob(search_me).sort.each {|rb| require rb}
24
+ end
25
+ end
26
+
27
+ Homeward.require_all_libs_relative_to(__FILE__)
28
+
@@ -0,0 +1,7 @@
1
+ class ApplicationController
2
+ private
3
+
4
+ def current_page
5
+ params[:page].to_i < 1 ? 1 : params[:page].to_i
6
+ end
7
+ end
@@ -0,0 +1,17 @@
1
+ module ApplicationHelper
2
+ def blueprint_includes
3
+ %q(
4
+ <link rel="stylesheet" href="/stylesheets/blueprint/screen.css" type="text/css" media="screen, projection">
5
+ <link rel="stylesheet" href="/stylesheets/blueprint/print.css" type="text/css" media="print">
6
+ <!--[if IE]>
7
+ <link rel="stylesheet" href="/stylesheets/blueprint/ie.css" type="text/css" media="screen, projection">
8
+ <![endif]-->
9
+ )
10
+ end
11
+
12
+ def render_flashes
13
+ flash.map do |type, value|
14
+ content_tag('div', value, :id => "flash_#{type}")
15
+ end.join("\n")
16
+ end
17
+ end
data/rails/init.rb ADDED
@@ -0,0 +1,2 @@
1
+ require File.join(File.dirname(__FILE__), %w(.. lib homeward.rb))
2
+
@@ -0,0 +1,7 @@
1
+
2
+ require File.join(File.dirname(__FILE__), %w[spec_helper])
3
+
4
+ describe Homeward do
5
+ end
6
+
7
+ # EOF
@@ -0,0 +1,16 @@
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
@@ -0,0 +1,63 @@
1
+ require 'fileutils'
2
+
3
+ BLUEPRINT_GIT_PATH = "#{ENV['HOME']}/Code/Css/blueprint-css"
4
+
5
+ desc %q(Run all significant tasks
6
+ Create application layout
7
+ Update Blueprint
8
+ Install Blueprint
9
+ Replace prototype with jrails
10
+ )
11
+ task :homeward => %w(homeward:application_layout homeward:blueprint:update homeward:blueprint:install homeward:javascript:use_jrails)
12
+
13
+ namespace :homeward do
14
+ desc 'Invokes the homeward_layout generator'
15
+ task :application_layout do
16
+ Dir.chdir(Rails.root) do
17
+ puts %x(script/generate homeward_layout)
18
+ end
19
+ end
20
+
21
+ namespace :blueprint do
22
+ desc 'pulls the latest blueprint code'
23
+ task :update do
24
+ Dir.chdir BLUEPRINT_GIT_PATH do
25
+ puts %x(echo "Stashing\n" &&
26
+ git stash &&
27
+ echo "\nPulling\n" &&
28
+ git pull &&
29
+ echo "\nPopping\n" &&
30
+ git stash pop
31
+ )
32
+ end
33
+ end
34
+
35
+ desc "installs blueprint"
36
+ task :install do
37
+ compressor = "#{BLUEPRINT_GIT_PATH}/lib/compress.rb"
38
+ install_path = "#{Rails.root}/public/stylesheets/blueprint"
39
+ %x(ruby #{compressor} -o #{install_path})
40
+ FileUtils.rm_rf "#{install_path}/src"
41
+ end
42
+ end
43
+
44
+ namespace :javascript do
45
+ desc 'replaces prototype with jrails'
46
+ task :use_jrails => [:remove_prototype, :install_jrails]
47
+
48
+ desc 'removes prototype'
49
+ task :remove_prototype do
50
+ Dir.chdir("#{Rails.root}/public/javascripts") do
51
+ FileUtils.rm_rf %w(prototype.js effects.js dragdrop.js controls.js)
52
+ end
53
+ end
54
+
55
+ desc 'installs jrails'
56
+ task :install_jrails do
57
+ Dir.chdir(Rails.root) do
58
+ puts %x(script/plugin install http://ennerchi.googlecode.com/svn/trunk/plugins/jrails)
59
+ end
60
+ end
61
+ end
62
+ end
63
+
metadata ADDED
@@ -0,0 +1,81 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sandro-homeward
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Sandro Turriate
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-01-04 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: bones
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 2.2.0
23
+ version:
24
+ description: Personal rails methods I always use
25
+ email: sandro.turriate@gmail.com
26
+ executables: []
27
+
28
+ extensions: []
29
+
30
+ extra_rdoc_files:
31
+ - History.txt
32
+ - README.txt
33
+ files:
34
+ - History.txt
35
+ - Manifest.txt
36
+ - README.markdown
37
+ - README.txt
38
+ - Rakefile
39
+ - generators/homeward/USAGE
40
+ - generators/homeward/homeward_generator.rb
41
+ - generators/homeward/templates/homeward.rake
42
+ - generators/homeward_layout/USAGE
43
+ - generators/homeward_layout/homeward_layout_generator.rb
44
+ - generators/homeward_layout/templates/application.html.haml
45
+ - init.rb
46
+ - lib/homeward.rb
47
+ - lib/homeward/controllers/application.rb
48
+ - lib/homeward/helpers/application_helper.rb
49
+ - rails/init.rb
50
+ - spec/homeward_spec.rb
51
+ - spec/spec_helper.rb
52
+ - tasks/homeward.rake
53
+ has_rdoc: true
54
+ homepage: http://github.com/sandro/homeward
55
+ post_install_message:
56
+ rdoc_options:
57
+ - --main
58
+ - README.txt
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: "0"
66
+ version:
67
+ required_rubygems_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: "0"
72
+ version:
73
+ requirements: []
74
+
75
+ rubyforge_project: homeward
76
+ rubygems_version: 1.2.0
77
+ signing_key:
78
+ specification_version: 2
79
+ summary: Personal rails methods I always use
80
+ test_files: []
81
+