phraseapp-in-context-editor-ruby 1.0.6 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/CHANGELOG.md +20 -1
- data/README.md +2 -11
- data/lib/phraseapp-in-context-editor-ruby.rb +9 -1
- data/lib/phraseapp-in-context-editor-ruby/config.rb +65 -124
- data/lib/phraseapp-in-context-editor-ruby/engine.rb +2 -4
- data/lib/phraseapp-in-context-editor-ruby/key_names_cache.rb +1 -1
- data/lib/phraseapp-in-context-editor-ruby/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cdfdab7c2d226806be3b94c62dcbf1e371139917
|
4
|
+
data.tar.gz: 53a0f7c4065ce2c72d8e3df1830c203fe6707b7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce15350f192f740f52bf84838954638d4fc9743ea1c3e245cd867690903eb1e3503c2167fe32b7ce39001955fe37de2d670e352a07f837bb813ab561aaedc393
|
7
|
+
data.tar.gz: f36383b6b2c563a35336e94c71c8876694071445e1be698d8d9ff27e6b623dfaed26a7522cf5bff06d5ec6c981df96b0a8a63f9dccc2571e32c23f64118c3fca
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,24 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [v1.1.0](https://github.com/phrase/phraseapp-in-context-editor-ruby/tree/v1.1.0) (2016-10-04)
|
4
|
+
[Full Changelog](https://github.com/phrase/phraseapp-in-context-editor-ruby/compare/v1.0.2...v1.1.0)
|
5
|
+
|
6
|
+
**Closed issues:**
|
7
|
+
|
8
|
+
- rails\_admin json issue with phraseapp and rails\_admin-i18n [\#16](https://github.com/phrase/phraseapp-in-context-editor-ruby/issues/16)
|
9
|
+
- Per thread config [\#14](https://github.com/phrase/phraseapp-in-context-editor-ruby/issues/14)
|
10
|
+
- RuntimeError: not found? [\#12](https://github.com/phrase/phraseapp-in-context-editor-ruby/issues/12)
|
11
|
+
- Editor conflicts the angular router [\#9](https://github.com/phrase/phraseapp-in-context-editor-ruby/issues/9)
|
12
|
+
- Edit icons missing if the enabled false by default [\#8](https://github.com/phrase/phraseapp-in-context-editor-ruby/issues/8)
|
13
|
+
- Introduce a changelog [\#7](https://github.com/phrase/phraseapp-in-context-editor-ruby/issues/7)
|
14
|
+
|
15
|
+
**Merged pull requests:**
|
16
|
+
|
17
|
+
- Proper storage of config on Thread.current [\#15](https://github.com/phrase/phraseapp-in-context-editor-ruby/pull/15) ([docstun](https://github.com/docstun))
|
18
|
+
- disable dependency loading on before as fix for rails5 [\#13](https://github.com/phrase/phraseapp-in-context-editor-ruby/pull/13) ([koljaa](https://github.com/koljaa))
|
19
|
+
- Update LICENSE [\#11](https://github.com/phrase/phraseapp-in-context-editor-ruby/pull/11) ([sbruhns](https://github.com/sbruhns))
|
20
|
+
- i18n set to \>= 0.6 [\#10](https://github.com/phrase/phraseapp-in-context-editor-ruby/pull/10) ([jethroo](https://github.com/jethroo))
|
21
|
+
|
3
22
|
## [v1.0.2](https://github.com/phrase/phraseapp-in-context-editor-ruby/tree/v1.0.2) (2015-10-12)
|
4
23
|
[Full Changelog](https://github.com/phrase/phraseapp-in-context-editor-ruby/compare/v1.0.1...v1.0.2)
|
5
24
|
|
@@ -9,7 +28,7 @@
|
|
9
28
|
|
10
29
|
**Merged pull requests:**
|
11
30
|
|
12
|
-
- 18n delegate refactoring [\#6](https://github.com/phrase/phraseapp-in-context-editor-ruby/pull/6) ([
|
31
|
+
- 18n delegate refactoring [\#6](https://github.com/phrase/phraseapp-in-context-editor-ruby/pull/6) ([koljaa](https://github.com/koljaa))
|
13
32
|
|
14
33
|
## [v1.0.1](https://github.com/phrase/phraseapp-in-context-editor-ruby/tree/v1.0.1) (2015-10-07)
|
15
34
|
[Full Changelog](https://github.com/phrase/phraseapp-in-context-editor-ruby/compare/v1.0.0...v1.0.1)
|
data/README.md
CHANGED
@@ -54,18 +54,9 @@ If you don't want to use the helper but add the plain Javascript yourself, head
|
|
54
54
|
|
55
55
|
Restart your application to see the In-Context-Editor in action!
|
56
56
|
|
57
|
-
|
58
|
-
### Upgrading from the old phrase gem
|
59
|
-
|
60
|
-
If you're upgrading from the `phrase` gem (which is now deprecated), you will notice several changes:
|
61
|
-
|
62
|
-
1. The gem no longer provides the `push`/`pull` commands. This functionality is now provided by our new [command line client](https://github.com/phrase/phraseapp-client).
|
63
|
-
2. The gem also no longer implements it's own API client, but uses the [phraseapp-ruby gem](https://github.com/phrase/phraseapp-ruby) for API communication.
|
64
|
-
|
65
|
-
|
66
57
|
### OpenSSL issues
|
67
58
|
|
68
|
-
Please note that outdated certificates or old versions of OpenSSL may cause connection issues, especially on Mac OSX. We recommend using Ruby 2.2.2 with OpenSSL 1.0.2d or later. If you experience OpenSSL-related errors, try the following.
|
59
|
+
Please note that outdated certificates or old versions of OpenSSL may cause connection issues, especially on Mac OSX. We recommend using Ruby 2.2.2 with OpenSSL 1.0.2d or later. If you experience OpenSSL-related errors, try the following.
|
69
60
|
|
70
61
|
Upgrade OpenSSL using Homebrew:
|
71
62
|
|
@@ -87,7 +78,7 @@ As a workaround, you can disable SSL certificate verification in your `config/in
|
|
87
78
|
config.skip_ssl_verification = true
|
88
79
|
```
|
89
80
|
|
90
|
-
This is **not recommended** and should only be used as a temporary workaround.
|
81
|
+
This is **not recommended** and should only be used as a temporary workaround.
|
91
82
|
|
92
83
|
|
93
84
|
## Further Information
|
@@ -88,7 +88,15 @@ module PhraseApp
|
|
88
88
|
end
|
89
89
|
|
90
90
|
def self.configure
|
91
|
-
yield(
|
91
|
+
yield(PhraseApp::InContextEditor::Config)
|
92
|
+
end
|
93
|
+
|
94
|
+
def self.with_config(config_options={}, &block)
|
95
|
+
original_config = self.config.dup
|
96
|
+
config.assign_values(config_options)
|
97
|
+
yield
|
98
|
+
ensure
|
99
|
+
self.config = original_config
|
92
100
|
end
|
93
101
|
end
|
94
102
|
|
@@ -1,142 +1,83 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
|
-
|
3
2
|
module PhraseApp
|
4
3
|
module InContextEditor
|
5
4
|
class Config
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
5
|
+
CONFIG_OPTIONS = {
|
6
|
+
project_id: nil,
|
7
|
+
access_token: nil,
|
8
|
+
enabled: false,
|
9
|
+
skip_ssl_verification: false,
|
10
|
+
backend: PhraseApp::InContextEditor::BackendService.new,
|
11
|
+
prefix: "{{__",
|
12
|
+
suffix: "__}}",
|
13
|
+
api_host: "https://api.phraseapp.com",
|
14
|
+
js_host: "phraseapp.com",
|
15
|
+
js_use_ssl: true,
|
16
|
+
js_path: "/assets/in-context-editor/2.0/app.js",
|
17
|
+
js_options: {},
|
18
|
+
cache_key_segments_initial: ["simple_form"],
|
19
|
+
cache_lifetime: 300,
|
20
|
+
ignored_keys: [],
|
21
|
+
}.freeze
|
22
|
+
|
23
|
+
CONFIG_OPTIONS_GLOBAL_ONLY = [
|
24
|
+
:access_token,
|
25
|
+
:skip_ssl_verification,
|
26
|
+
:api_host
|
27
|
+
].freeze
|
28
|
+
|
29
|
+
CONFIG_OPTIONS.each do |option, default_value|
|
30
|
+
class_eval "@@#{option} = CONFIG_OPTIONS[:#{option}]"
|
31
|
+
|
32
|
+
define_method("#{option}=") do |value|
|
33
|
+
instance_eval "@#{option} = value; self.class.invalidate_api_client"
|
34
|
+
end unless CONFIG_OPTIONS_GLOBAL_ONLY.include?(option)
|
35
|
+
|
36
|
+
define_method("#{option}") do
|
37
|
+
instance_eval "defined?(@#{option}) ? @#{option} : self.class.#{option}"
|
38
|
+
end
|
39
|
+
|
40
|
+
define_singleton_method("#{option}=") do |value|
|
41
|
+
instance_eval "@@#{option} = value; invalidate_api_client"
|
42
|
+
end
|
43
|
+
|
44
|
+
define_singleton_method("#{option}") do
|
45
|
+
instance_eval "@@#{option}"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.api_client
|
50
|
+
@@api_client ||= build_api_client
|
48
51
|
end
|
49
52
|
|
50
53
|
def api_client
|
51
|
-
|
52
|
-
end
|
53
|
-
|
54
|
-
def prefix
|
55
|
-
@@prefix ||= "{{__"
|
54
|
+
self.class.api_client
|
56
55
|
end
|
57
56
|
|
58
|
-
def
|
59
|
-
|
57
|
+
def assign_values(config_options={})
|
58
|
+
config_options.each do |config_option, value|
|
59
|
+
self.send("#{config_option}=", value)
|
60
|
+
end
|
60
61
|
end
|
61
62
|
|
62
|
-
def
|
63
|
-
|
63
|
+
def self.reset_to_defaults!
|
64
|
+
CONFIG_OPTIONS.each do |option, default_value|
|
65
|
+
send("#{option}=", default_value)
|
66
|
+
end
|
64
67
|
end
|
65
68
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
def api_host
|
71
|
-
@@api_host = "https://api.phraseapp.com" if !defined? @@api_host or @@api_host.nil?
|
72
|
-
@@api_host
|
73
|
-
end
|
74
|
-
|
75
|
-
def api_host=(api_host)
|
76
|
-
@@api_host = api_host
|
77
|
-
end
|
78
|
-
|
79
|
-
def js_host
|
80
|
-
@@js_host ||= 'phraseapp.com'
|
81
|
-
end
|
82
|
-
|
83
|
-
def js_host=(js_host)
|
84
|
-
@@js_host = js_host
|
85
|
-
end
|
86
|
-
|
87
|
-
def js_use_ssl
|
88
|
-
@@js_use_ssl = true if !defined? @@js_use_ssl or @@js_use_ssl.nil?
|
89
|
-
@@js_use_ssl
|
90
|
-
end
|
91
|
-
|
92
|
-
def js_use_ssl=(js_use_ssl)
|
93
|
-
@@js_use_ssl = js_use_ssl
|
94
|
-
end
|
95
|
-
|
96
|
-
def js_path
|
97
|
-
@@js_path ||= "/assets/in-context-editor/2.0/app.js"
|
98
|
-
end
|
99
|
-
|
100
|
-
def js_path=(js_path)
|
101
|
-
@@js_path = js_path
|
102
|
-
end
|
103
|
-
|
104
|
-
def js_options
|
105
|
-
@@js_options ||= {}
|
106
|
-
end
|
107
|
-
|
108
|
-
def js_options=(js_options)
|
109
|
-
@@js_options = js_options
|
110
|
-
end
|
111
|
-
|
112
|
-
def cache_key_segments_initial
|
113
|
-
@@cache_key_segments_initial ||= ["simple_form"]
|
114
|
-
end
|
115
|
-
|
116
|
-
def cache_key_segments_initial=(cache_key_segments_initial=[])
|
117
|
-
@@cache_key_segments_initial = cache_key_segments_initial
|
118
|
-
end
|
119
|
-
|
120
|
-
def cache_lifetime
|
121
|
-
@@cache_lifetime ||= 300
|
122
|
-
end
|
123
|
-
|
124
|
-
def cache_lifetime=(cache_lifetime)
|
125
|
-
@@cache_lifetime = cache_lifetime
|
126
|
-
end
|
127
|
-
|
128
|
-
def ignored_keys
|
129
|
-
@@ignored_keys ||= []
|
130
|
-
end
|
131
|
-
|
132
|
-
def ignored_keys=(ignored_keys)
|
133
|
-
@@ignored_keys = ignored_keys
|
69
|
+
protected
|
70
|
+
def self.invalidate_api_client
|
71
|
+
@@api_client = nil
|
134
72
|
end
|
135
73
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
74
|
+
def self.build_api_client
|
75
|
+
credentials = PhraseApp::Auth::Credentials.new(
|
76
|
+
token: @@access_token,
|
77
|
+
host: @@api_host,
|
78
|
+
skip_ssl_verification: @@skip_ssl_verification
|
79
|
+
)
|
80
|
+
PhraseApp::Client.new(credentials)
|
140
81
|
end
|
141
82
|
end
|
142
83
|
end
|
@@ -7,10 +7,8 @@ if defined? Rails
|
|
7
7
|
module InContextEditor
|
8
8
|
class Engine < Rails::Engine
|
9
9
|
initializer 'phraseapp-in-context-editor-ruby', before: :disable_dependency_loading do |app|
|
10
|
-
|
11
|
-
|
12
|
-
require 'phraseapp-in-context-editor-ruby/adapters/fast_gettext'
|
13
|
-
end
|
10
|
+
require 'phraseapp-in-context-editor-ruby/adapters/i18n'
|
11
|
+
require 'phraseapp-in-context-editor-ruby/adapters/fast_gettext'
|
14
12
|
|
15
13
|
ActionView::Base.send :include, PhraseApp::InContextEditor::ViewHelpers
|
16
14
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phraseapp-in-context-editor-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dynport GmbH
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -194,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
194
194
|
version: 1.3.6
|
195
195
|
requirements: []
|
196
196
|
rubyforge_project: phraseapp-in-context-editor-ruby
|
197
|
-
rubygems_version: 2.
|
197
|
+
rubygems_version: 2.4.8
|
198
198
|
signing_key:
|
199
199
|
specification_version: 4
|
200
200
|
summary: Translation management solution for web and mobile applications
|