copycopter_client 1.0.4 → 1.1.0

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/Rakefile CHANGED
@@ -3,8 +3,7 @@ require 'bundler/setup'
3
3
  require 'appraisal'
4
4
  require 'rake'
5
5
  require 'rake/testtask'
6
- require 'rake/rdoctask'
7
- require 'rake/gempackagetask'
6
+ require 'rubygems/package_task'
8
7
  require 'cucumber/rake/task'
9
8
  require 'rspec/core/rake_task'
10
9
  require 'yard'
@@ -31,7 +30,7 @@ YARD::Rake::YardocTask.new do |t|
31
30
  end
32
31
 
33
32
  eval("$specification = begin; #{IO.read('copycopter_client.gemspec')}; end")
34
- Rake::GemPackageTask.new($specification) do |package|
33
+ Gem::PackageTask.new($specification) do |package|
35
34
  package.need_zip = true
36
35
  package.need_tar = true
37
36
  end
@@ -1,11 +1,17 @@
1
1
  When "I generate a rails application" do
2
2
  if Rails::VERSION::MAJOR == 3
3
3
  subcommand = 'new'
4
+ if Rails::VERSION::MINOR == 0
5
+ options = ''
6
+ else
7
+ options = '--skip-bundle'
8
+ end
4
9
  else
5
10
  subcommand = ''
11
+ options = ''
6
12
  end
7
13
 
8
- run_simple("rails _#{Rails::VERSION::STRING}_ #{subcommand} testapp")
14
+ run_simple("rails _#{Rails::VERSION::STRING}_ #{subcommand} testapp #{options}")
9
15
  cd("testapp")
10
16
 
11
17
  if Rails::VERSION::MAJOR == 3
@@ -15,6 +21,8 @@ When "I generate a rails application" do
15
21
  gem "sinatra"
16
22
  gem "json"
17
23
  GEMS
24
+
25
+ When %{I remove lines containing "rjs" from "config/environments/development.rb"}
18
26
  end
19
27
  end
20
28
 
@@ -142,6 +150,22 @@ When /^I run a short lived process that sets the key "([^"]*)" to "([^"]*)"$/ do
142
150
  end
143
151
  end
144
152
 
153
+ When /^I remove lines containing "([^"]*)" from "([^"]*)"$/ do |content, filename|
154
+ in_current_dir do
155
+ result = ""
156
+ File.open(filename, "r") do |file|
157
+ file.each_line do |line|
158
+ result << line unless line.include?(content)
159
+ end
160
+ end
161
+
162
+ File.open(filename, "w") do |file|
163
+ file.write(result)
164
+ end
165
+ end
166
+ end
167
+
168
+
145
169
  After do
146
170
  RailsServer.stop
147
171
  end
@@ -61,7 +61,7 @@ module CopycopterClient
61
61
  # @raise [ConnectionError] if the connection fails
62
62
  def upload(data)
63
63
  connect do |http|
64
- response = http.post(uri("draft_blurbs"), data.to_json)
64
+ response = http.post(uri("draft_blurbs"), data.to_json, 'Content-Type' => 'application/json')
65
65
  check(response)
66
66
  log("Uploaded missing translations")
67
67
  end
@@ -1,6 +1,6 @@
1
1
  module CopycopterClient
2
2
  # Client version
3
- VERSION = "1.0.4".freeze
3
+ VERSION = "1.1.0"
4
4
 
5
5
  # API version being used to communicate with the server
6
6
  API_VERSION = "2.0".freeze
@@ -60,7 +60,7 @@ describe CopycopterClient::I18nBackend do
60
60
 
61
61
  it "queues missing keys without default" do
62
62
  expect { subject.translate('en', 'test.key') }.
63
- to raise_error(I18n::MissingTranslationData)
63
+ to throw_symbol(:exception)
64
64
 
65
65
  cache['en.test.key'].should == ""
66
66
  end
@@ -3,9 +3,15 @@ require 'json'
3
3
  require 'thin'
4
4
 
5
5
  class FakeCopycopterApp < Sinatra::Base
6
+ disable :show_exceptions
7
+
6
8
  def self.start
7
9
  Thread.new do
8
- Thin::Logging.silent = true
10
+ if ENV['DEBUG']
11
+ Thin::Logging.debug = true
12
+ else
13
+ Thin::Logging.silent = true
14
+ end
9
15
  Rack::Handler::Thin.run(self, :Port => port)
10
16
  end
11
17
  end
@@ -52,9 +58,18 @@ class FakeCopycopterApp < Sinatra::Base
52
58
 
53
59
  post "/api/v2/projects/:api_key/draft_blurbs" do |api_key|
54
60
  with_project(api_key) do |project|
55
- data = JSON.parse(request.body.read)
56
- project.update('draft' => data)
57
- 201
61
+ with_json_data do |data|
62
+ project.update('draft' => data)
63
+ 201
64
+ end
65
+ end
66
+ end
67
+
68
+ def with_json_data
69
+ if request.content_type == 'application/json'
70
+ yield(JSON.parse(request.body.read))
71
+ else
72
+ 406
58
73
  end
59
74
  end
60
75
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: copycopter_client
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
+ - 1
8
9
  - 0
9
- - 4
10
- version: 1.0.4
10
+ version: 1.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - thoughtbot
@@ -15,13 +15,15 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-08-31 00:00:00 Z
18
+ date: 2011-09-09 00:00:00 -04:00
19
+ default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
22
+ type: :runtime
21
23
  requirement: &id001 !ruby/object:Gem::Requirement
22
24
  none: false
23
25
  requirements:
24
- - - ~>
26
+ - - ">="
25
27
  - !ruby/object:Gem::Version
26
28
  hash: 11
27
29
  segments:
@@ -32,8 +34,8 @@ dependencies:
32
34
  version_requirements: *id001
33
35
  name: i18n
34
36
  prerelease: false
35
- type: :runtime
36
37
  - !ruby/object:Gem::Dependency
38
+ type: :runtime
37
39
  requirement: &id002 !ruby/object:Gem::Requirement
38
40
  none: false
39
41
  requirements:
@@ -46,7 +48,6 @@ dependencies:
46
48
  version_requirements: *id002
47
49
  name: json
48
50
  prerelease: false
49
- type: :runtime
50
51
  description:
51
52
  email: support@thoughtbot.com
52
53
  executables: []
@@ -101,6 +102,7 @@ files:
101
102
  - features/step_definitions/rails_steps.rb
102
103
  - features/support/env.rb
103
104
  - features/support/rails_server.rb
105
+ has_rdoc: true
104
106
  homepage: http://github.com/thoughtbot/copycopter_client
105
107
  licenses: []
106
108
 
@@ -130,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
132
  requirements: []
131
133
 
132
134
  rubyforge_project: copycopter_client
133
- rubygems_version: 1.8.6
135
+ rubygems_version: 1.6.1
134
136
  signing_key:
135
137
  specification_version: 3
136
138
  summary: Client for the Copycopter content management service