railstar 0.0.0 → 0.0.5

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.
Files changed (49) hide show
  1. data/MIT-LICENSE +1 -1
  2. data/README.rdoc +1 -3
  3. data/Rakefile +29 -29
  4. data/lib/railstar/version.rb +3 -0
  5. data/lib/railstar.rb +2 -1
  6. data/test/dummy/README.rdoc +261 -0
  7. data/test/dummy/Rakefile +7 -0
  8. data/test/dummy/app/assets/javascripts/application.js +15 -0
  9. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  10. data/test/dummy/app/controllers/application_controller.rb +3 -0
  11. data/test/dummy/app/helpers/application_helper.rb +2 -0
  12. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  13. data/test/dummy/config/application.rb +56 -0
  14. data/test/dummy/config/boot.rb +10 -0
  15. data/test/dummy/config/database.yml +25 -0
  16. data/test/dummy/config/environment.rb +5 -0
  17. data/test/dummy/config/environments/development.rb +37 -0
  18. data/test/dummy/config/environments/production.rb +67 -0
  19. data/test/dummy/config/environments/test.rb +37 -0
  20. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  21. data/test/dummy/config/initializers/inflections.rb +15 -0
  22. data/test/dummy/config/initializers/mime_types.rb +5 -0
  23. data/test/dummy/config/initializers/secret_token.rb +7 -0
  24. data/test/dummy/config/initializers/session_store.rb +8 -0
  25. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  26. data/test/dummy/config/locales/en.yml +5 -0
  27. data/test/dummy/config/routes.rb +58 -0
  28. data/test/dummy/config.ru +4 -0
  29. data/test/dummy/public/404.html +26 -0
  30. data/test/dummy/public/422.html +26 -0
  31. data/test/dummy/public/500.html +25 -0
  32. data/test/dummy/script/rails +6 -0
  33. data/test/railstar_test.rb +2 -3
  34. data/test/test_helper.rb +10 -3
  35. metadata +119 -57
  36. data/VERSION +0 -1
  37. data/generators/dbmaster/dbmaster_generator.rb +0 -16
  38. data/generators/dbmaster/templates/dbmaster.rake +0 -10
  39. data/generators/dbmaster/templates/load_masters.rb +0 -41
  40. data/generators/twitter/templates/twitter.rb +0 -44
  41. data/generators/twitter/twitter_generator.rb +0 -13
  42. data/init.rb +0 -5
  43. data/install.rb +0 -3
  44. data/lib/railstar_helper.rb +0 -47
  45. data/railstar_config.yml +0 -14
  46. data/spec/railstar_helper_spec.rb +0 -16
  47. data/uninstall.rb +0 -1
  48. /data/{tasks → lib/tasks}/railstar_tasks.rake +0 -0
  49. /data/{spec/spec_helper.rb → test/dummy/public/favicon.ico} +0 -0
@@ -0,0 +1,15 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format
4
+ # (all these examples are active by default):
5
+ # ActiveSupport::Inflector.inflections do |inflect|
6
+ # inflect.plural /^(ox)$/i, '\1en'
7
+ # inflect.singular /^(ox)en/i, '\1'
8
+ # inflect.irregular 'person', 'people'
9
+ # inflect.uncountable %w( fish sheep )
10
+ # end
11
+ #
12
+ # These inflection rules are supported but not enabled by default:
13
+ # ActiveSupport::Inflector.inflections do |inflect|
14
+ # inflect.acronym 'RESTful'
15
+ # end
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ Dummy::Application.config.secret_token = '88d0d4f8d30a8348d96d7ac4564dda940f3d49c93f4ff02e711e8a4f8a0a4c52344ac15c7efeef61cfe048816d42c6b1c9c5cc2941a9fde833ec5c352b48eb78'
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
4
+
5
+ # Use the database for sessions instead of the cookie-based default,
6
+ # which shouldn't be used to store highly confidential information
7
+ # (create the session table with "rails generate session_migration")
8
+ # Dummy::Application.config.session_store :active_record_store
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+ #
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json]
9
+ end
10
+
11
+ # Disable root element in JSON by default.
12
+ ActiveSupport.on_load(:active_record) do
13
+ self.include_root_in_json = false
14
+ end
@@ -0,0 +1,5 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: "Hello world"
@@ -0,0 +1,58 @@
1
+ Dummy::Application.routes.draw do
2
+ # The priority is based upon order of creation:
3
+ # first created -> highest priority.
4
+
5
+ # Sample of regular route:
6
+ # match 'products/:id' => 'catalog#view'
7
+ # Keep in mind you can assign values other than :controller and :action
8
+
9
+ # Sample of named route:
10
+ # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
11
+ # This route can be invoked with purchase_url(:id => product.id)
12
+
13
+ # Sample resource route (maps HTTP verbs to controller actions automatically):
14
+ # resources :products
15
+
16
+ # Sample resource route with options:
17
+ # resources :products do
18
+ # member do
19
+ # get 'short'
20
+ # post 'toggle'
21
+ # end
22
+ #
23
+ # collection do
24
+ # get 'sold'
25
+ # end
26
+ # end
27
+
28
+ # Sample resource route with sub-resources:
29
+ # resources :products do
30
+ # resources :comments, :sales
31
+ # resource :seller
32
+ # end
33
+
34
+ # Sample resource route with more complex sub-resources
35
+ # resources :products do
36
+ # resources :comments
37
+ # resources :sales do
38
+ # get 'recent', :on => :collection
39
+ # end
40
+ # end
41
+
42
+ # Sample resource route within a namespace:
43
+ # namespace :admin do
44
+ # # Directs /admin/products/* to Admin::ProductsController
45
+ # # (app/controllers/admin/products_controller.rb)
46
+ # resources :products
47
+ # end
48
+
49
+ # You can have the root of your site routed with "root"
50
+ # just remember to delete public/index.html.
51
+ # root :to => 'welcome#index'
52
+
53
+ # See how all your routes lay out with "rake routes"
54
+
55
+ # This is a legacy wild controller route that's not recommended for RESTful applications.
56
+ # Note: This route will make all actions in every controller accessible via GET requests.
57
+ # match ':controller(/:action(/:id))(.:format)'
58
+ end
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Dummy::Application
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ </div>
24
+ </body>
25
+ </html>
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -1,8 +1,7 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class RailstarTest < ActiveSupport::TestCase
4
- # Replace this with your real tests.
5
- test "the truth" do
6
- assert true
4
+ test "truth" do
5
+ assert_kind_of Module, Railstar
7
6
  end
8
7
  end
data/test/test_helper.rb CHANGED
@@ -1,3 +1,10 @@
1
- require 'rubygems'
2
- require 'active_support'
3
- require 'active_support/test_case'
1
+ # Configure Rails Environment
2
+ ENV["RAILS_ENV"] = "test"
3
+
4
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
+ require "rails/test_help"
6
+
7
+ Rails.backtrace_cleaner.remove_silencers!
8
+
9
+ # Load support files
10
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
metadata CHANGED
@@ -1,77 +1,139 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: railstar
3
- version: !ruby/object:Gem::Version
4
- version: 0.0.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.5
5
+ prerelease:
5
6
  platform: ruby
6
- authors:
7
- - Kazuya Yoshimi
7
+ authors:
8
+ - RAWHIDE. Co., Ltd.
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
-
12
- date: 2010-02-11 00:00:00 +09:00
13
- default_executable:
14
- dependencies: []
15
-
16
- description:
17
- email: yoshimi@raw-hide.co.jp
12
+ date: 2012-03-05 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: &70357814315860 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 3.2.2
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70357814315860
25
+ - !ruby/object:Gem::Dependency
26
+ name: sqlite3
27
+ requirement: &70357814313980 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *70357814313980
36
+ description: railstar
37
+ email:
38
+ - info@raw-hide.co.jp
18
39
  executables: []
19
-
20
40
  extensions: []
21
-
22
- extra_rdoc_files:
23
- - README.rdoc
24
- files:
41
+ extra_rdoc_files: []
42
+ files:
43
+ - lib/railstar/version.rb
44
+ - lib/railstar.rb
45
+ - lib/tasks/railstar_tasks.rake
25
46
  - MIT-LICENSE
26
- - README.rdoc
27
47
  - Rakefile
28
- - VERSION
29
- - generators/dbmaster/dbmaster_generator.rb
30
- - generators/dbmaster/templates/dbmaster.rake
31
- - generators/dbmaster/templates/load_masters.rb
32
- - generators/twitter/templates/twitter.rb
33
- - generators/twitter/twitter_generator.rb
34
- - init.rb
35
- - install.rb
36
- - lib/railstar.rb
37
- - lib/railstar_helper.rb
38
- - railstar_config.yml
39
- - spec/railstar_helper_spec.rb
40
- - spec/spec_helper.rb
41
- - tasks/railstar_tasks.rake
48
+ - README.rdoc
49
+ - test/dummy/app/assets/javascripts/application.js
50
+ - test/dummy/app/assets/stylesheets/application.css
51
+ - test/dummy/app/controllers/application_controller.rb
52
+ - test/dummy/app/helpers/application_helper.rb
53
+ - test/dummy/app/views/layouts/application.html.erb
54
+ - test/dummy/config/application.rb
55
+ - test/dummy/config/boot.rb
56
+ - test/dummy/config/database.yml
57
+ - test/dummy/config/environment.rb
58
+ - test/dummy/config/environments/development.rb
59
+ - test/dummy/config/environments/production.rb
60
+ - test/dummy/config/environments/test.rb
61
+ - test/dummy/config/initializers/backtrace_silencers.rb
62
+ - test/dummy/config/initializers/inflections.rb
63
+ - test/dummy/config/initializers/mime_types.rb
64
+ - test/dummy/config/initializers/secret_token.rb
65
+ - test/dummy/config/initializers/session_store.rb
66
+ - test/dummy/config/initializers/wrap_parameters.rb
67
+ - test/dummy/config/locales/en.yml
68
+ - test/dummy/config/routes.rb
69
+ - test/dummy/config.ru
70
+ - test/dummy/public/404.html
71
+ - test/dummy/public/422.html
72
+ - test/dummy/public/500.html
73
+ - test/dummy/public/favicon.ico
74
+ - test/dummy/Rakefile
75
+ - test/dummy/README.rdoc
76
+ - test/dummy/script/rails
42
77
  - test/railstar_test.rb
43
78
  - test/test_helper.rb
44
- - uninstall.rb
45
- has_rdoc: true
46
- homepage: http://github.com/yosm/railstar
79
+ homepage: http://raw-hide.co.jp
47
80
  licenses: []
48
-
49
81
  post_install_message:
50
- rdoc_options:
51
- - --charset=UTF-8
52
- require_paths:
82
+ rdoc_options: []
83
+ require_paths:
53
84
  - lib
54
- required_ruby_version: !ruby/object:Gem::Requirement
55
- requirements:
56
- - - ">="
57
- - !ruby/object:Gem::Version
58
- version: "0"
59
- version:
60
- required_rubygems_version: !ruby/object:Gem::Requirement
61
- requirements:
62
- - - ">="
63
- - !ruby/object:Gem::Version
64
- version: "0"
65
- version:
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ! '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ segments:
92
+ - 0
93
+ hash: -3802146287672330163
94
+ required_rubygems_version: !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ! '>='
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ segments:
101
+ - 0
102
+ hash: -3802146287672330163
66
103
  requirements: []
67
-
68
104
  rubyforge_project:
69
- rubygems_version: 1.3.5
105
+ rubygems_version: 1.8.12
70
106
  signing_key:
71
107
  specification_version: 3
72
- summary: railstar is a core plugin for RAWHIDE.
73
- test_files:
74
- - spec/railstar_helper_spec.rb
75
- - spec/spec_helper.rb
108
+ summary: RAWHIDE. Core Rails Lib
109
+ test_files:
110
+ - test/dummy/app/assets/javascripts/application.js
111
+ - test/dummy/app/assets/stylesheets/application.css
112
+ - test/dummy/app/controllers/application_controller.rb
113
+ - test/dummy/app/helpers/application_helper.rb
114
+ - test/dummy/app/views/layouts/application.html.erb
115
+ - test/dummy/config/application.rb
116
+ - test/dummy/config/boot.rb
117
+ - test/dummy/config/database.yml
118
+ - test/dummy/config/environment.rb
119
+ - test/dummy/config/environments/development.rb
120
+ - test/dummy/config/environments/production.rb
121
+ - test/dummy/config/environments/test.rb
122
+ - test/dummy/config/initializers/backtrace_silencers.rb
123
+ - test/dummy/config/initializers/inflections.rb
124
+ - test/dummy/config/initializers/mime_types.rb
125
+ - test/dummy/config/initializers/secret_token.rb
126
+ - test/dummy/config/initializers/session_store.rb
127
+ - test/dummy/config/initializers/wrap_parameters.rb
128
+ - test/dummy/config/locales/en.yml
129
+ - test/dummy/config/routes.rb
130
+ - test/dummy/config.ru
131
+ - test/dummy/public/404.html
132
+ - test/dummy/public/422.html
133
+ - test/dummy/public/500.html
134
+ - test/dummy/public/favicon.ico
135
+ - test/dummy/Rakefile
136
+ - test/dummy/README.rdoc
137
+ - test/dummy/script/rails
76
138
  - test/railstar_test.rb
77
139
  - test/test_helper.rb
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.0.0
@@ -1,16 +0,0 @@
1
- class DbmasterGenerator < 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.directory 'lib/tasks'
10
- m.file 'dbmaster.rake', 'lib/tasks/dbmaster.rake'
11
-
12
- m.directory 'lib'
13
- m.file 'load_masters.rb', 'lib/load_masters.rb'
14
- end
15
- end
16
- end
@@ -1,10 +0,0 @@
1
- namespace :db do
2
- namespace :master do
3
- desc "Load master data from/master/*.yml"
4
- task :load => :environment do |t, arg|
5
- puts "\n=== Loading YAML ..."
6
- require "load_masters.rb"
7
- MasterLoader.run
8
- end
9
- end
10
- end
@@ -1,41 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # -*- coding: utf-8 -*-
3
-
4
- unless defined? __DIR__
5
- def __DIR__
6
- filename = caller[0][/^(.*):/, 1]
7
- File.expand_path(File.dirname(filename))
8
- end
9
- end
10
- #puts fixture_dir
11
- def fixture_dir
12
- File.expand_path("../db/master", __DIR__)
13
- end
14
-
15
- class MasterLoader
16
- class << self
17
- def run
18
- Dir::glob(fixture_dir + "/*.yml").each do |file|
19
- klass_name = File::basename(file, '.yml')
20
- run_class(klass_name)
21
- end
22
- end
23
-
24
- def run_class(klass_name)
25
- file = File.join(fixture_dir, klass_name + '.yml')
26
- klass_name = klass_name.classify
27
-
28
- puts "\t loading from #{File::basename(file)} via #{klass_name}"
29
- klass = eval(klass_name)
30
- rawdata = File.read(file)
31
- records = YAML::load(rawdata)
32
- klass.delete_all
33
- records.each do |rec|
34
- copied = klass.new(rec[1])
35
- copied.id = rec[1]["id"]
36
- copied.save
37
- end
38
- end
39
- end
40
-
41
- end
@@ -1,44 +0,0 @@
1
- class Twitter < ActiveResource::Base
2
- self.user = ''
3
- self.password = ''
4
-
5
- self.site = "http://#{self.user}:#{self.password}@twitter.com/"
6
- self.logger = Logger.new($stdout)
7
-
8
- class Status < Twitter
9
- end
10
-
11
- class Follower < Twitter
12
- def self.ids(id=self.user)
13
- # 5000件しか取得しないので、それ以上のFollowersも考慮するならpageオプションを仕様すること。
14
- # 詳細はTwitterAPI参照
15
- begin
16
- followers = self.get(:ids, :id => id)
17
- followers.blank? ? followers : followers.first.second.map{|id| id.to_i}
18
- rescue ActiveResource::ResourceNotFound
19
- []
20
- end
21
- end
22
- end
23
-
24
- class User < Twitter
25
- attr_accessor :name, :icon, :location, :url, :description, :screen_name, :friends_count, :followers_count, :created_at
26
-
27
- def initialize(id=self.user)
28
- result = User.get(:show, :id => id)
29
- @name = result["name"]
30
- @icon = result["profile_image_url"]
31
- @location = result["location"]
32
- @url = result["url"]
33
- @description = result["description"]
34
- @screen_name = result["screen_name"]
35
- @followers_count = result["followers_count"]
36
- @friends_count = result["friends_count"]
37
- begin
38
- @created_at = Date.strptime(result["created_at"], "%a %b %d %T %z %Y")
39
- rescue
40
- @created_at = nil
41
- end
42
- end
43
- end
44
- end
@@ -1,13 +0,0 @@
1
- class TwitterGenerator < Rails::Generator::Base
2
- def initialize(runtime_args, runtime_options = {})
3
- Dir.mkdir("app/models") unless File.directory?("app/models")
4
- super
5
- end
6
-
7
- def manifest
8
- record do |m|
9
- m.directory 'app/models'
10
- m.file 'twitter.rb', 'app/models/twitter.rb'
11
- end
12
- end
13
- end
data/init.rb DELETED
@@ -1,5 +0,0 @@
1
- require File.dirname(__FILE__) + '/lib/railstar'
2
-
3
- require 'railstar_helper'
4
- ActionView::Base.send(:include, RailstarHelper)
5
-
data/install.rb DELETED
@@ -1,3 +0,0 @@
1
- FileUtils.copy(File.join(RAILS_ROOT, 'vendor', 'plugins', 'railstar', 'railstar_config.yml'), File.join(RAILS_ROOT, 'config'))
2
-
3
- puts "set config/railstar_config.yml"
@@ -1,47 +0,0 @@
1
- module RailstarHelper
2
- def title(page_title)
3
- content_for(:title) { page_title }
4
- end
5
-
6
- def stylesheet(*css)
7
- content_for(:head) { stylesheet_link_tag(*css) }
8
- end
9
-
10
- def javascript(*js)
11
- content_for(:head) { javascript_include_tag(*js) }
12
- end
13
-
14
- def auto_discovery_rss(rss)
15
- content_for(:head) do
16
- %Q(<link rel="alternate" type="application/rss+xml" href="#{rss}" title="RSS 2.0" />)
17
- end
18
- end
19
-
20
- def hbr(str)
21
- str = html_escape(str)
22
- br(str)
23
- end
24
-
25
- def br(str)
26
- str.gsub(/\r\n|\r|\n/, "<br />")
27
- end
28
-
29
- def url2link(str)
30
- str.gsub(/(https?:\/\/[-_.!~*'()a-zA-Z0-9;\/?:@&=+$,%#]+)/){"<a href='#{$1}'>#{$1}</a>"}
31
- end
32
-
33
- def params_to_hidden_tag(object, options={})
34
- p = params[object]
35
- str = ""
36
- str << hidden_field_tag('back', 1) if options[:back]
37
- return str unless p
38
- p.each do |method,value|
39
- if options[:except] && options[:except].include?(method.to_sym)
40
- else
41
- str << hidden_field(object,method, :value => p[method])
42
- end
43
- end
44
- str
45
- end
46
- end
47
-
data/railstar_config.yml DELETED
@@ -1,14 +0,0 @@
1
- common: &common
2
- product_name: railstar
3
-
4
- development:
5
- <<: *common
6
- base_url: "http://localhost:3000"
7
-
8
- test:
9
- <<: *common
10
- base_url: "http://localhost:3000"
11
-
12
- production:
13
- <<: *common
14
- base_url: "http://railstar.org"
@@ -1,16 +0,0 @@
1
- require './lib/railstar_helper'
2
- require 'erb'
3
- include RailstarHelper
4
- include ERB::Util
5
-
6
-
7
- describe RailstarHelper do
8
- it '改行コードをBRタグに変換できること' do
9
- text = <<-EOF
10
- abcd
11
- efghi
12
- jklm
13
- EOF
14
- hbr(text).should == "abcd<br />efghi<br />jklm<br />"
15
- end
16
- end