to_sps 0.0.1.alpha

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format d
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Michel Boaventura
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,30 @@
1
+ = to_sps plugin
2
+
3
+ Exports a collection of activerecords to a SPSS syntax.
4
+
5
+ == Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'to_sps'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install to_sps
18
+
19
+ == Usage
20
+
21
+ Just call #to_sps into any activerecord relation, like:
22
+ User.all.to_sps
23
+
24
+ == Contributing
25
+
26
+ 1. Fork it
27
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
28
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
29
+ 4. Push to the branch (`git push origin my-new-feature`)
30
+ 5. Create new Pull Request
@@ -0,0 +1,5 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+ task :default => :spec
@@ -0,0 +1,16 @@
1
+ require 'active_record'
2
+
3
+ module ToSps
4
+ def to_sps
5
+ end
6
+ end
7
+
8
+ ActiveRecord::Base.extend ToSps
9
+
10
+ class ActiveRecord::Relation
11
+ def to_sps
12
+ scoping do
13
+ @klass.to_csv
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,3 @@
1
+ module ToSps
2
+ VERSION = "0.0.1.alpha"
3
+ end
@@ -0,0 +1,10 @@
1
+ ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:")
2
+
3
+ ActiveRecord::Schema.define do
4
+ create_table :surveys, force: true do |t|
5
+ t.string :title
6
+ t.integer :director_id
7
+ t.date :released_on
8
+ t.timestamps
9
+ end
10
+ end
@@ -0,0 +1,4 @@
1
+ require 'to_sps'
2
+ require 'schema'
3
+
4
+ Dir[File.expand_path("../support/**/*.rb", __FILE__)].each {|f| require f}
@@ -0,0 +1,2 @@
1
+ class Survey < ActiveRecord::Base
2
+ end
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'to_sps' do
4
+ context 'basic start' do
5
+ it 'injects #to_sps into Model' do
6
+ expect(ActiveRecord::Base).to respond_to(:to_sps)
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'to_sps/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = 'to_sps'
8
+ gem.version = ToSps::VERSION
9
+ gem.authors = ['Michel Boaventura']
10
+ gem.email = ['michel.boaventura@gmail.com']
11
+ gem.description = 'Exports a collection of Active Record Relation to a SPSS syntax'
12
+ gem.summary = 'Add #to_sps into ActiveRecord::Relation'
13
+
14
+ gem.homepage = 'https://github.com/michelboaventura/to_sps'
15
+
16
+ gem.files = `git ls-files`.split($/)
17
+ gem.test_files = gem.files.grep(%r{^(spec)/})
18
+
19
+ gem.add_dependency('activerecord', '~> 3.2.11')
20
+
21
+ gem.add_development_dependency('rspec', '~> 2.12.0')
22
+ gem.add_development_dependency('sqlite3', '~> 1.3.7')
23
+
24
+ gem.require_paths = ['lib']
25
+ end
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: to_sps
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1.alpha
5
+ prerelease: 6
6
+ platform: ruby
7
+ authors:
8
+ - Michel Boaventura
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-01-29 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: activerecord
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 3.2.11
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 3.2.11
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: 2.12.0
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 2.12.0
46
+ - !ruby/object:Gem::Dependency
47
+ name: sqlite3
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 1.3.7
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 1.3.7
62
+ description: Exports a collection of Active Record Relation to a SPSS syntax
63
+ email:
64
+ - michel.boaventura@gmail.com
65
+ executables: []
66
+ extensions: []
67
+ extra_rdoc_files: []
68
+ files:
69
+ - .gitignore
70
+ - .rspec
71
+ - Gemfile
72
+ - LICENSE.txt
73
+ - README.rdoc
74
+ - Rakefile
75
+ - lib/to_sps.rb
76
+ - lib/to_sps/version.rb
77
+ - spec/schema.rb
78
+ - spec/spec_helper.rb
79
+ - spec/support/models/survey.rb
80
+ - spec/to_sps_spec.rb
81
+ - to_sps.gemspec
82
+ homepage: https://github.com/michelboaventura/to_sps
83
+ licenses: []
84
+ post_install_message:
85
+ rdoc_options: []
86
+ require_paths:
87
+ - lib
88
+ required_ruby_version: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ required_rubygems_version: !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ! '>'
98
+ - !ruby/object:Gem::Version
99
+ version: 1.3.1
100
+ requirements: []
101
+ rubyforge_project:
102
+ rubygems_version: 1.8.19
103
+ signing_key:
104
+ specification_version: 3
105
+ summary: ! 'Add #to_sps into ActiveRecord::Relation'
106
+ test_files:
107
+ - spec/schema.rb
108
+ - spec/spec_helper.rb
109
+ - spec/support/models/survey.rb
110
+ - spec/to_sps_spec.rb