opal-activesupport 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 90b539607dcedd36bbcb5db0833542391f4a0ed9
4
+ data.tar.gz: 7af139aa05432e39150879073bcb0d7b49c66286
5
+ SHA512:
6
+ metadata.gz: b74b483d8eac451ba6b634d3dd8e13919a95bf9f6daf0c4f0f0a939bef48e060a3a0f2c87dce3f68dcf0a2b223e9ff95955000bc847b0588149745e5277f154b
7
+ data.tar.gz: 6e4814521411680f50b0d09de37b7657f0ecc729c680ee003f28f101f7b844a560be8dd234253f3b77fb9b7fd0b2493d4bd9d65b5ec9c8d95e8a3ba3a5dd9915
data/.gitignore ADDED
@@ -0,0 +1,18 @@
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
18
+ /original-activesupport
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Elia Schito
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.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Opal::Activesupport
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'opal-activesupport'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install opal-activesupport
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require 'bundler'
2
+ Bundler.require
3
+
4
+ require 'opal/spec/rake_task'
5
+ Opal::Spec::RakeTask.new(:default)
6
+
7
+ require 'bundler/gem_tasks'
@@ -0,0 +1,5 @@
1
+ module Opal
2
+ module Activesupport
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ require 'opal'
2
+ require 'opal/activesupport/version'
3
+
4
+ # Just register our opal code path with opal build tools
5
+ Opal.append_path File.expand_path('../../../opal', __FILE__)
@@ -0,0 +1 @@
1
+ require 'opal/activesupport'
@@ -0,0 +1,27 @@
1
+ class String
2
+ def dasherize
3
+ `#{self}.replace(/[-_\\s]+/g, '-')
4
+ .replace(/([A-Z\\d]+)([A-Z][a-z])/g, '$1-$2')
5
+ .replace(/([a-z\\d])([A-Z])/g, '$1-$2')
6
+ .toLowerCase()`
7
+ end
8
+
9
+ def demodulize
10
+ %x{
11
+ var idx = #{self}.lastIndexOf('::');
12
+
13
+ if (idx > -1) {
14
+ return #{self}.substr(idx + 2);
15
+ }
16
+
17
+ return #{self};
18
+ }
19
+ end
20
+
21
+ def underscore
22
+ `#{self}.replace(/[-\\s]+/g, '_')
23
+ .replace(/([A-Z\\d]+)([A-Z][a-z])/g, '$1_$2')
24
+ .replace(/([a-z\\d])([A-Z])/g, '$1_$2')
25
+ .toLowerCase()`
26
+ end
27
+ end
@@ -0,0 +1 @@
1
+ require 'active_support/core_ext/string'
@@ -0,0 +1 @@
1
+ require 'active_support/core_ext'
@@ -0,0 +1 @@
1
+ require 'opal/activesupport'
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'opal/activesupport/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = 'opal-activesupport'
8
+ gem.version = Opal::Activesupport::VERSION
9
+ gem.authors = ['Elia Schito']
10
+ gem.email = ['elia@schito.me']
11
+ gem.description = %q{The port of the glorious ActiveSupport for Opal}
12
+ gem.summary = %q{The port of the glorious ActiveSupport for Opal}
13
+ gem.homepage = 'http://opalrb.org'
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ['lib']
19
+
20
+ gem.add_dependency 'opal', '~> 0.3.36'
21
+ gem.add_development_dependency 'opal-spec', '~> 0.2.8'
22
+ end
@@ -0,0 +1 @@
1
+ require 'opal-spec'
@@ -0,0 +1,46 @@
1
+ require 'spec_helper'
2
+ require 'active_support/core_ext/string'
3
+
4
+ describe 'String' do
5
+
6
+ describe "#demodulize" do
7
+ it "removes any preceding module name from the string" do
8
+ "Foo::Bar".demodulize.should == "Bar"
9
+ "Foo::Bar::Baz".demodulize.should == "Baz"
10
+ end
11
+
12
+ it "has no affect on strings with no module seperator" do
13
+ "SomeClassName".demodulize.should == "SomeClassName"
14
+ end
15
+ end
16
+
17
+ describe '#underscore' do
18
+ it "replaces '-' in dasherized strings with underscores" do
19
+ "well-hello-there".underscore.should == "well_hello_there"
20
+ end
21
+
22
+ it "converts single all-upcase strings into lowercase" do
23
+ "OMG".underscore.should == "omg"
24
+ end
25
+
26
+ it "splits word bounderies and seperates using underscore" do
27
+ "AdamBeynon".underscore.should == "adam_beynon"
28
+ end
29
+
30
+ it "does not split when 2 or more capitalized letters together" do
31
+ "HTMLParser".underscore.should == "html_parser"
32
+ end
33
+ end
34
+
35
+ describe '#dasherize' do
36
+ it 'dasherizes' do
37
+ {
38
+ "street" => "street",
39
+ "street_address" => "street-address",
40
+ "person_street_address" => "person-street-address",
41
+ }.each_pair do |underscore, dashes|
42
+ underscore.dasherize.should == dashes
43
+ end
44
+ end
45
+ end
46
+ end
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: opal-activesupport
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Elia Schito
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-05-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: opal
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 0.3.36
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 0.3.36
27
+ - !ruby/object:Gem::Dependency
28
+ name: opal-spec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 0.2.8
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: 0.2.8
41
+ description: The port of the glorious ActiveSupport for Opal
42
+ email:
43
+ - elia@schito.me
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - .gitignore
49
+ - Gemfile
50
+ - LICENSE.txt
51
+ - README.md
52
+ - Rakefile
53
+ - lib/opal-activesupport.rb
54
+ - lib/opal/activesupport.rb
55
+ - lib/opal/activesupport/version.rb
56
+ - opal-activesupport.gemspec
57
+ - opal/active_support.rb
58
+ - opal/active_support/core_ext.rb
59
+ - opal/active_support/core_ext/string.rb
60
+ - opal/opal-activesupport.rb
61
+ - spec/spec_helper.rb
62
+ - spec/string_spec.rb
63
+ homepage: http://opalrb.org
64
+ licenses: []
65
+ metadata: {}
66
+ post_install_message:
67
+ rdoc_options: []
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - '>='
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ requirements: []
81
+ rubyforge_project:
82
+ rubygems_version: 2.0.3
83
+ signing_key:
84
+ specification_version: 4
85
+ summary: The port of the glorious ActiveSupport for Opal
86
+ test_files:
87
+ - spec/spec_helper.rb
88
+ - spec/string_spec.rb