Using SwiftyJSON with Swift3 - swift3

How do I use SwiftyJSON with Swift3? I've installed the pod.
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git', :branch => 'swift3'
But it throws a lot of errors using Xcode 8 GM.
Can someone help me install it properly?

Update: as Marcus notes, SwiftyJSON now supports Swift 3. In order to get bug fixes, I recommend not pinning yourself to 3.0.0, but rather:
pod 'SwiftyJSON', '>= 3.0.0'
…or if you don’t want to accidentally pick up whatever API-breaking changes may arrive in 4.x:
pod 'SwiftyJSON', '~> 3.0'
[Old answer] There is an actively maintained fork that works:
pod 'SwiftyJSON', git: 'https://github.com/BaiduHiDeviOS/SwiftyJSON.git', branch: 'swift3'
Hopefully the project maintainers merge it. Until then, you can just use the fork.

SwiftyJSON now supports Swift 3.
pod 'SwiftyJSON', '3.0.0'

Please try this. I had a trouble for days. And this solve the issue for me.
pod 'SwiftyJSON', '3.1.4'

Related

DDMathParser 3.0.0 with CocoaPods

Hey there and Merry Xmas,
I would like to add the DDMathParser to my Swift 3 project using the latest CocoaPods version. The problem is I only get DDMathParser 2.0.0 installed. What do I miss?
my podfile is:
platform :osx, '10.11'
target 'DDTest02' do
use_frameworks!
pod 'DDMathParser', :git => 'https://github.com/davedelong/DDMathParser.git'
When I try using:
pod 'DDMathParser', :git => 'https://github.com/davedelong/DDMathParser.git', :branch => 'swift-3.0'
It throws an error warning: Could not find remote branch swift-3.0 to clone.
fatal: Remote branch swift-3.0 not found in upstream origin
DDMathParser author here...
There is no swift-3.0 branch, so I'm not sure why you're trying that. Try specifying the 3.0.0 tag using:
pod 'DDMathParser', :git => 'https://github.com/davedelong/DDMathParser.git', :tag ⇒ '3.0.0'

Rails 4.2 Time_zone_conversion.rb Error. How do I fix this?

I am totally lost on this one. I'm using ruby 2.2.4 and upgrading an app from rails 4.1.0 to 4.2. The app was working fine. I changed my Gemfile to use:
gem 'rails', '~>4.2'
Then ran my spec tests and the app blew up with this error:
usr/local/rvm/rubies/ruby-2.2.4/bin/ruby -I/path-to-my-app/vendor/bundle/ruby/2.2.0/gems/rspec-core-3.5.0/lib:/path-to-my-app/vendor/bundle/ruby/2.2.0/gems/rspec-support-3.5.0/lib /path-to-my-app/vendor/bundle/ruby/2.2.0/gems/rspec-core-3.5.0/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb
Coverage report generated for RSpec to /path-to-my-app/coverage. 22 / 1206 LOC (1.82%) covered.
/path-to-my-app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.7.1/lib/active_record/attribute_methods/time_zone_conversion.rb:64:in `create_time_zone_conversion_attribute?': undefined method `type' for "NUMBER(38)":String (NoMethodError)
from /path-to-my-app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.7.1/lib/active_record/attribute_methods/time_zone_conversion.rb:53:in `block (2 levels) in inherited'
When I try to load the app in a browser I get an error:
undefined method 'type' for "NUMBER(38)":String
I Google'd on this and found one post. It was here in StackOverflow: NoMethodError: Undefined method 'type' for nil:NilClass in Rails, which led me to: https://gist.github.com/alsemyonov/88826/revisions
I tried the fix posted in the github app, but I still get the same error.
A mention of 'time_zone_conversion.rb' in the error and something I read made me think this was :datetime related. I have one method in a couple of models that works on the date field "updated_at". Not sure if this is related or not.
def updated_at_formatted
self.updated_at.strftime("%m/%d/%Y")
end
I'm also using the gem 'american_date'.
Any ideas on what is causing this and how to fix it would be greatly appreciated.
Thanks,
Found it:
Oracle enhanced adapter version 1.6 just supports Rails 4.2 and does not support Rails 4.1 or lower version of Rails.
When using Ruby on Rails version 4.2 then in Gemfile include
gem 'activerecord-oracle_enhanced-adapter', '~> 1.6.0'
A co-worker and I stepped through the stacktrace on the error. He felt that the line:
undefined method 'type' for "NUMBER(38)":String
was somehow tied to a database issue, which for this app is Oracle. Googling on issues on the Rails 4.2 upgrade and the above oracle gem led us to the above answer.

How do I enable the Ruby 2.3 `--enable-frozen-string-literal` globally in Rails?

I am building a greenfield Rails application on top of Ruby 2.3, and I would like all Rails commands (e.g. rails s, rails c) and all Ruby commands (e.g. rake do:something) to use the new immutable-String functionality introduced in Ruby 2.3. (See, e.g. https://wyeworks.com/blog/2015/12/1/immutable-strings-in-ruby-2-dot-3/)
So, how do I pass that lovely --enable-frozen-string-literal Ruby option down to Ruby in all possible contexts where some command I issue bottoms out in Ruby?
Thanks in advance!
As far as I know, best way to do it is setting environment variable like followings:
export RUBYOPT=--enable-frozen-string-literal
or
setenv RUBYOPT --enable-frozen-string-literal
However, don't try it right now. It simply doesn't work because some codes in Bundler gem are attempting to modify frozen String. Wait until they fix the problem.

can't install simple_captcha produces uninitialized constant Sprockets::Helpers

I have included the simple_captcha gem as instructed on their site:
gem 'simple_captcha', :git => 'git://github.com/galetahub/simple-captcha.git'
I have then run bundler to install it.
Finally when I go to run the following command I get an error:
rails generate simple_captcha
.rvm/gems/ruby-1.9.3-p327#eapi4/bundler/gems/simple-captcha-e99cc7e8bf6b/lib/simple_captcha/form_builder.rb:7:in `included': uninitialized constant Sprockets::Helpers (NameError)
I've searched on the web and can't find any other users with this problem.
Any help appreciated
They say in this pull request that the plugin doesn't support rails 4, You can download their branch and try it out.
Looking at the diff it shows your problem
- base.send(:include, Sprockets::Helpers::RailsHelper)
- base.send(:include, Sprockets::Helpers::IsolatedHelper)
+ base.send(:include, Sprockets::Rails::Helper)
https://github.com/galetahub/simple-captcha/pull/39/files
you could this as the previous version of simple_captcha is not supported on rails 3.
Azdaroth forked of simple_captcha
gem 'simple_captcha', :git => 'git://github.com/Azdaroth/simple-captcha.git', :branch => 'rails-4'

jasmine with jscoverage automated testing

Had been looking at the jsunit and jcoverage demos here (click on coverage report link. Open this in a new tab).
I was wondering if any one had done anything similar with Jasmine and JSCoverage ? I'm a little unsure on how to proceed.
[EDIT]
I am wondering if there is something I can do with a jasmine reporter. My Jasmine "hello world" example makes reference to a TrivialReporter. Maybe this can be extended ??
[EDIT]
I've wired up js-test-runner with jasmine right now. Now If I could think of a way to get coverage ??
If you're working on a ruby project and using jasmine via jasmine-gem, I have a patch that adds jscoverage support[1].
If you're using bundler, you can use this version of jasmine with the following command in your Gemfile:
gem 'jasmine',
:git => 'git://github.com/hjdivad/jasmine-gem',
:submodules => true,
:branch => 'jscoverage'
Make sure you've downloaded jscoverage and it's in your $PATH.
You can then add the following to jasmine.yml
coverage:
enabled: true
encoding: utf-8
tmp_dir: tmp
report_dir: public/coverage
skip_paths:
- public/javascripts/vendor
If this works for you, you may want to speak up on the pull request[2] to get it, or some variation, into jasmine-gem proper.
[1] https://github.com/hjdivad/jasmine-gem/tree/jscoverage
[2] https://github.com/pivotal/jasmine-gem/pull/37
If you're not using the jasmine-gem, or don't want to have to run a server to check coverage, I've written a gem that pulls together jscoverage and jasmine. It can run as a rake task in your CI builds.
It can be found here: https://github.com/firstbanco/jasmine-coverage
Install it, then just run
bundle exec rake jasmine:coverage
You're done.
EDIT: As the author of jasmine-coverage, I feel duty bound to to tell you about a better alternative: teaspoon. It requires more setup, but also allows running in the browser so you can use the Chrome debugger.