whowish_word 0.6.5 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. data/.gitignore +2 -2
  2. data/Gemfile +2 -4
  3. data/lib/whowish_word/action_controller/base.rb +6 -46
  4. data/lib/whowish_word/action_view/base.rb +18 -40
  5. data/lib/whowish_word/backends/defer_to_i18n.rb +18 -0
  6. data/lib/whowish_word/backends/flat_file_store.rb +75 -0
  7. data/lib/whowish_word/constant.rb +1 -3
  8. data/lib/whowish_word/initializer.rb +10 -29
  9. data/lib/whowish_word/rails/app/controllers/whowish_word_controller.rb +31 -85
  10. data/lib/whowish_word/whowish_word.rb +3 -6
  11. data/rails/Gemfile +2 -12
  12. data/rails/Gemfile.lock +30 -44
  13. data/rails/app/views/layouts/integration.html.erb +0 -1
  14. data/rails/config/application.rb +0 -17
  15. data/rails/config/boot.rb +0 -3
  16. data/rails/config/environment.rb +0 -9
  17. data/rails/config/routes.rb +0 -3
  18. data/rails/spec/controllers/whowish_word_controller_spec.rb +36 -10
  19. data/rails/spec/features/whowish_word_spec.rb +75 -0
  20. data/rails/spec/spec_helper.rb +15 -11
  21. data/rails/spec/support/browser_helper.rb +31 -0
  22. data/rails/spec/support/json_rspec_helper.rb +0 -3
  23. data/whowish_word.gemspec +4 -4
  24. metadata +24 -48
  25. data/lib/whowish_word/action_mailer/base.rb +0 -7
  26. data/lib/whowish_word/action_view/template.rb +0 -31
  27. data/lib/whowish_word/authentication.rb +0 -14
  28. data/lib/whowish_word/db_migration/active_record/whowish_word_html.rb +0 -15
  29. data/lib/whowish_word/db_migration/mongoid/whowish_word_html.rb +0 -6
  30. data/lib/whowish_word/rails/app/models/active_record/whowish_word_html.rb +0 -4
  31. data/lib/whowish_word/rails/app/models/mongoid/whowish_word_html.rb +0 -9
  32. data/lib/whowish_word/word_for.rb +0 -94
  33. data/rails/app/assets/javascripts/home2.js +0 -2
  34. data/rails/app/assets/javascripts/integration.js +0 -2
  35. data/rails/app/assets/javascripts/test_javascript.js +0 -2
  36. data/rails/app/assets/javascripts/test_word_for.js +0 -2
  37. data/rails/app/assets/stylesheets/home2.css +0 -4
  38. data/rails/app/assets/stylesheets/integration.css +0 -4
  39. data/rails/app/assets/stylesheets/test_javascript.css +0 -4
  40. data/rails/app/assets/stylesheets/test_word_for.css +0 -4
  41. data/rails/app/controllers/home2_controller.rb +0 -2
  42. data/rails/app/controllers/test_javascript_controller.rb +0 -11
  43. data/rails/app/controllers/test_word_for_controller.rb +0 -5
  44. data/rails/app/helpers/home2_helper.rb +0 -2
  45. data/rails/app/helpers/test_javascript_helper.rb +0 -2
  46. data/rails/app/helpers/test_word_for_helper.rb +0 -2
  47. data/rails/app/views/home2/index.html.erb +0 -2
  48. data/rails/app/views/home2/test.html.erb +0 -3
  49. data/rails/app/views/test_javascript/change_value.html.erb +0 -32
  50. data/rails/app/views/test_javascript/index.html.erb +0 -87
  51. data/rails/app/views/test_javascript/replace_with_html.html.erb +0 -96
  52. data/rails/app/views/test_word_for/_partial.html.erb +0 -5
  53. data/rails/app/views/test_word_for/index.html.erb +0 -9
  54. data/rails/config/database.yml +0 -25
  55. data/rails/config/mongoid.rb +0 -6
  56. data/rails/config/mongoid.yml +0 -14
  57. data/rails/db/.gitdummy +0 -0
  58. data/rails/mongo.bat +0 -5
  59. data/rails/public/jasmine/MIT.LICENSE +0 -20
  60. data/rails/public/jasmine/jasmine-html.js +0 -190
  61. data/rails/public/jasmine/jasmine.css +0 -166
  62. data/rails/public/jasmine/jasmine.js +0 -2476
  63. data/rails/public/jasmine/jasmine_favicon.png +0 -0
  64. data/rails/public/javascripts/jquery.loading_button.js +0 -72
  65. data/rails/public/sinonjs/sinonjs.js +0 -2821
  66. data/rails/public/test/jquery_version.html +0 -26
  67. data/rails/spec/integration/whowish_word_spec.rb +0 -102
  68. data/rails/spec/support/browser.rb +0 -194
  69. data/spec/spec_helper.rb +0 -19
@@ -1,9 +1,6 @@
1
- # encoding: utf-8
2
1
  module JsonRspecHelper
3
-
4
2
  def expect_json_response
5
3
  response.should be_success
6
4
  return ActiveSupport::JSON.decode(response.body)
7
5
  end
8
-
9
6
  end
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "whowish_word"
6
- s.version = "0.6.5"
6
+ s.version = "1.0.0"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Tanin Na Nakorn"]
9
9
  s.email = ["tanin47@yahoo.com"]
@@ -14,9 +14,9 @@ Gem::Specification.new do |s|
14
14
  s.rubyforge_project = "whowish_word"
15
15
 
16
16
  s.files = `git ls-files`.split("\n")
17
- s.test_files = `git ls-files -- {rails,spec}/*`.split("\n")
18
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
+ s.test_files = `git ls-files -- {rails}/*`.split("\n")
19
18
  s.require_paths = ["lib"]
20
19
 
21
- s.add_dependency('rubyzip')
20
+ s.add_development_dependency('rubyzip')
21
+ s.add_development_dependency('rspec')
22
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whowish_word
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.5
4
+ version: 1.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-30 00:00:00.000000000 Z
12
+ date: 2014-01-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rubyzip
@@ -19,7 +19,23 @@ dependencies:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
21
  version: '0'
22
- type: :runtime
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rspec
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
23
39
  prerelease: false
24
40
  version_requirements: !ruby/object:Gem::Requirement
25
41
  none: false
@@ -43,18 +59,13 @@ files:
43
59
  - idea.md
44
60
  - lib/whowish_word.rb
45
61
  - lib/whowish_word/action_controller/base.rb
46
- - lib/whowish_word/action_mailer/base.rb
47
62
  - lib/whowish_word/action_view/base.rb
48
- - lib/whowish_word/action_view/template.rb
49
- - lib/whowish_word/authentication.rb
63
+ - lib/whowish_word/backends/defer_to_i18n.rb
64
+ - lib/whowish_word/backends/flat_file_store.rb
50
65
  - lib/whowish_word/config.rb
51
66
  - lib/whowish_word/constant.rb
52
- - lib/whowish_word/db_migration/active_record/whowish_word_html.rb
53
- - lib/whowish_word/db_migration/mongoid/whowish_word_html.rb
54
67
  - lib/whowish_word/initializer.rb
55
68
  - lib/whowish_word/rails/app/controllers/whowish_word_controller.rb
56
- - lib/whowish_word/rails/app/models/active_record/whowish_word_html.rb
57
- - lib/whowish_word/rails/app/models/mongoid/whowish_word_html.rb
58
69
  - lib/whowish_word/rails/public/javascripts/0_class.js
59
70
  - lib/whowish_word/rails/public/javascripts/0_jquery-1.6.4-whowish_word.js
60
71
  - lib/whowish_word/rails/public/javascripts/1_csrf_token_hook.js
@@ -83,33 +94,16 @@ files:
83
94
  - lib/whowish_word/rails/public/javascripts/7_whowish_word_value_handler.js
84
95
  - lib/whowish_word/rails/public/stylesheets/whowish_word.css
85
96
  - lib/whowish_word/whowish_word.rb
86
- - lib/whowish_word/word_for.rb
87
97
  - rails/Gemfile
88
98
  - rails/Gemfile.lock
89
99
  - rails/Rakefile
90
- - rails/app/assets/javascripts/home2.js
91
- - rails/app/assets/javascripts/integration.js
92
- - rails/app/assets/javascripts/test_javascript.js
93
- - rails/app/assets/javascripts/test_word_for.js
94
- - rails/app/assets/stylesheets/home2.css
95
- - rails/app/assets/stylesheets/integration.css
96
- - rails/app/assets/stylesheets/test_javascript.css
97
- - rails/app/assets/stylesheets/test_word_for.css
98
100
  - rails/app/controllers/application_controller.rb
99
- - rails/app/controllers/home2_controller.rb
100
101
  - rails/app/controllers/home_controller.rb
101
102
  - rails/app/controllers/integration_controller.rb
102
- - rails/app/controllers/test_javascript_controller.rb
103
- - rails/app/controllers/test_word_for_controller.rb
104
- - rails/app/helpers/home2_helper.rb
105
103
  - rails/app/helpers/integration_helper.rb
106
- - rails/app/helpers/test_javascript_helper.rb
107
- - rails/app/helpers/test_word_for_helper.rb
108
104
  - rails/app/views/home/index.html.erb
109
105
  - rails/app/views/home/static_edit.html.erb
110
106
  - rails/app/views/home/static_edit_select.html.erb
111
- - rails/app/views/home2/index.html.erb
112
- - rails/app/views/home2/test.html.erb
113
107
  - rails/app/views/integration/attr.html.erb
114
108
  - rails/app/views/integration/index.html.erb
115
109
  - rails/app/views/integration/select.html.erb
@@ -119,15 +113,9 @@ files:
119
113
  - rails/app/views/layouts/nested_test_word_for.html.erb
120
114
  - rails/app/views/layouts/test_javascript.html.erb
121
115
  - rails/app/views/layouts/test_word_for.html.erb
122
- - rails/app/views/test_javascript/change_value.html.erb
123
- - rails/app/views/test_javascript/index.html.erb
124
- - rails/app/views/test_javascript/replace_with_html.html.erb
125
- - rails/app/views/test_word_for/_partial.html.erb
126
- - rails/app/views/test_word_for/index.html.erb
127
116
  - rails/config.ru
128
117
  - rails/config/application.rb
129
118
  - rails/config/boot.rb
130
- - rails/config/database.yml
131
119
  - rails/config/environment.rb
132
120
  - rails/config/initializers/whowish_word.rb
133
121
  - rails/config/locales/whowish_word/en.yml
@@ -135,29 +123,16 @@ files:
135
123
  - rails/config/locales/whowish_word/home2/test_en.yml
136
124
  - rails/config/locales/whowish_word/jp.yml
137
125
  - rails/config/locales/whowish_word/th.yml
138
- - rails/config/mongoid.rb
139
- - rails/config/mongoid.yml
140
126
  - rails/config/routes.rb
141
- - rails/db/.gitdummy
142
127
  - rails/log/.gitignore
143
- - rails/mongo.bat
144
- - rails/public/jasmine/MIT.LICENSE
145
- - rails/public/jasmine/jasmine-html.js
146
- - rails/public/jasmine/jasmine.css
147
- - rails/public/jasmine/jasmine.js
148
- - rails/public/jasmine/jasmine_favicon.png
149
128
  - rails/public/javascripts/jquery-1.6.4.js
150
- - rails/public/javascripts/jquery.loading_button.js
151
- - rails/public/sinonjs/sinonjs.js
152
129
  - rails/public/stylesheets/main.css
153
- - rails/public/test/jquery_version.html
154
130
  - rails/script/rails
155
131
  - rails/spec/controllers/whowish_word_controller_spec.rb
156
- - rails/spec/integration/whowish_word_spec.rb
132
+ - rails/spec/features/whowish_word_spec.rb
157
133
  - rails/spec/spec_helper.rb
158
- - rails/spec/support/browser.rb
134
+ - rails/spec/support/browser_helper.rb
159
135
  - rails/spec/support/json_rspec_helper.rb
160
- - spec/spec_helper.rb
161
136
  - whowish_word.gemspec
162
137
  homepage: http://github.com/tanin47/whowish_word
163
138
  licenses: []
@@ -184,3 +159,4 @@ signing_key:
184
159
  specification_version: 3
185
160
  summary: whowish_word
186
161
  test_files: []
162
+ has_rdoc:
@@ -1,7 +0,0 @@
1
- if defined?(ActionMailer) and defined?(ActionMailer::Base)
2
- class ActionMailer::Base
3
- # def word_for(id, *p)
4
- # WhowishWord.word_for(mailer_name + "/" + @template+".html.erb",id,*p)
5
- # end
6
- end
7
- end
@@ -1,31 +0,0 @@
1
-
2
- # if defined?(ActionView) and defined?(ActionView::Base)
3
-
4
- # class ActionView::Template
5
-
6
- # alias_method :render_original, :render
7
-
8
- # def render(view, locals, buffer=nil, &block)
9
-
10
- # previous_whowish_word_page = nil
11
-
12
- # if view.instance_variable_defined?(:@whowish_word_page)
13
- # previous_whowish_word_page = view.instance_variable_get(:@whowish_word_page)
14
- # end
15
-
16
- # view.instance_variable_set(:@whowish_word_page, @identifier)
17
-
18
- # if view.controller.respond_to?(:whowish_word_edit_mode)
19
- # view.instance_variable_set(:@whowish_word_edit_mode, view.controller.whowish_word_edit_mode)
20
- # end
21
-
22
- # html = render_original(view, locals, buffer, &block)
23
-
24
- # view.instance_variable_set(:@whowish_word_page, previous_whowish_word_page)
25
-
26
- # return html
27
- # end
28
-
29
- # end
30
-
31
- # end
@@ -1,14 +0,0 @@
1
- # module WhowishWord
2
-
3
- # module Authentication
4
-
5
- # attr_accessor :username, :password
6
-
7
- # def init_username_and_password
8
- # @username ||= "whowishword"
9
- # @password ||= "pass"
10
- # end
11
-
12
- # end
13
-
14
- # end
@@ -1,15 +0,0 @@
1
- # begin
2
- # ActiveRecord::Schema.define do
3
-
4
- # create_table "whowish_word_htmls", :force => false do |t|
5
- # t.string "word_id", :null => false
6
- # t.text "content", :null => false
7
- # end
8
-
9
- # add_index :whowish_word_htmls, :word_id, :unique => true
10
-
11
- # end
12
-
13
- # rescue Exception=>e
14
-
15
- # end
@@ -1,6 +0,0 @@
1
- # begin
2
- # WhowishWordHtml.collection.drop_indexes
3
- # WhowishWordHtml.create_indexes
4
- # rescue Exception=>e
5
-
6
- # end
@@ -1,4 +0,0 @@
1
- # class WhowishWordHtml < ActiveRecord::Base
2
-
3
-
4
- # end
@@ -1,9 +0,0 @@
1
- # class WhowishWordHtml
2
- # include Mongoid::Document
3
-
4
- # field :word_id,:type=>String
5
- # field :content, :type=>String
6
-
7
- # index [[ :word_id, Mongo::DESCENDING ]], :unique=>true
8
-
9
- # end
@@ -1,94 +0,0 @@
1
- require File.expand_path("../constant", __FILE__)
2
-
3
- module WhowishWord
4
-
5
- module WordFor
6
- include WhowishWord::Constant
7
-
8
- def word_for(namespace, id, locale, *variables)
9
- return word_for_normal_mode(namespace, id, locale, *variables)
10
- end
11
-
12
- def word_for_attr(namespace, id, locale, *variables)
13
- return word_for_normal_mode(namespace, id, locale, *variables)
14
- end
15
-
16
- def word_for_in_edit_mode(namespace, id, locale, *variables)
17
- return "<dfn>#{word_for_edit_mode(namespace, id, locale, *variables)}</dfn>".html_safe
18
- end
19
-
20
- def word_for_attr_in_edit_mode(namespace, id, locale, *variables)
21
- return word_for_edit_mode(namespace, id, locale, *variables)
22
- end
23
-
24
-
25
- def word_for_edit_mode(namespace, id, locale, *variables)
26
-
27
- variables = sanitize_variables_arg(variables)
28
-
29
- variable_suffix = ""
30
- if variables.length > 0
31
-
32
- var_keys = []
33
- variables.map { |key,val| var_keys.push("#{key}") }
34
-
35
- variable_suffix = "|#{var_keys.join(",")}"
36
-
37
- end
38
-
39
- return PREFIX + \
40
- SEPARATOR + \
41
- get_whowish_word_id(namespace, id, locale) + \
42
- variable_suffix + \
43
- SEPARATOR + \
44
- word_for_normal_mode(namespace, id, locale, variables)
45
-
46
- end
47
-
48
- def sanitize_variables_arg(variables)
49
-
50
- if variables.length > 0
51
- variables = variables[0]
52
- else
53
- variables = {}
54
- end
55
-
56
- return variables
57
-
58
- end
59
-
60
- def word_for_normal_mode(namespace, id, locale, *variables)
61
-
62
- variables = sanitize_variables_arg(variables)
63
-
64
- word_id = get_whowish_word_id(namespace, id, locale)
65
-
66
- if @words[word_id]
67
-
68
- content = "#{@words[word_id]}"
69
- variables.each_pair { |key,val| content.gsub!("{#{key}}","#{val}") }
70
-
71
- else
72
-
73
- content = "#{id}(#{locale})"
74
-
75
- if variables.length > 0
76
- content_params = []
77
- variables.each_pair { |key,val| content_params.push("#{key}") }
78
- content += "{#{content_params.join(',')}}"
79
- end
80
-
81
- end
82
-
83
- return content.html_safe
84
-
85
- end
86
-
87
- private
88
- def get_whowish_word_id(namespace, id, locale)
89
- "#{namespace}:#{id}(#{locale})".downcase
90
- end
91
-
92
- end
93
-
94
- end
@@ -1,2 +0,0 @@
1
- // Place all the behaviors and hooks related to the matching controller here.
2
- // All this logic will automatically be available in application.js.
@@ -1,2 +0,0 @@
1
- // Place all the behaviors and hooks related to the matching controller here.
2
- // All this logic will automatically be available in application.js.
@@ -1,2 +0,0 @@
1
- // Place all the behaviors and hooks related to the matching controller here.
2
- // All this logic will automatically be available in application.js.
@@ -1,2 +0,0 @@
1
- // Place all the behaviors and hooks related to the matching controller here.
2
- // All this logic will automatically be available in application.js.
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,2 +0,0 @@
1
- class Home2Controller < ApplicationController
2
- end
@@ -1,11 +0,0 @@
1
- class TestJavascriptController < ApplicationController
2
-
3
- layout "test_javascript"
4
-
5
- before_filter :always_activate_whowish_word
6
-
7
- def always_activate_whowish_word
8
- activate_whowish_word_edit_mode
9
- end
10
-
11
- end
@@ -1,5 +0,0 @@
1
- class TestWordForController < ApplicationController
2
-
3
- layout "nested_test_word_for"
4
-
5
- end
@@ -1,2 +0,0 @@
1
- module Home2Helper
2
- end
@@ -1,2 +0,0 @@
1
- module TestJavascriptHelper
2
- end
@@ -1,2 +0,0 @@
1
- module TestWordForHelper
2
- end