volt 0.8.13 → 0.8.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 585521e16cdbd729347af62203cacb7048b3e156
4
- data.tar.gz: a74df5b4aecfd6d947aec1a4597778615b169d2c
3
+ metadata.gz: 9ef1ff0f6f37905ecc83687721e258cd17b7da32
4
+ data.tar.gz: c6cf6a5c1df1ccf476185e6abd0df31271775bfc
5
5
  SHA512:
6
- metadata.gz: c1004177eb3aa270849933ae22bc61545a976af9b7f3f48ce538c8227683a88918885be1f22fb30516d9a23391ceca5581af1e109e31398ea307019055ee1177
7
- data.tar.gz: bbc37c59c6db0def60388e50c994c164c25543ff044b5317957ecd89835059f4c8c5b29add5dd3a3a6dc402b5e4ed4ddbc92b16db5bd857db4d7e75942d06d02
6
+ metadata.gz: 19ef4e5c647e1897197d327cc27106b533b474cc5d668c41823f3833d0a8bb59f4884fa9399d740b0872725d09c0b67a88935275867f996dfdf47d4ca64c1eea
7
+ data.tar.gz: cfe27008bccf191c05ae9e7dd2ab6a1d39dc52d724d09f2707ccd5c4271eb54887d5f3b4761dc0d7914b270ff8b91314385f6ee670ed5e23e00b892d4cd6bb35
data/Readme.md CHANGED
@@ -15,9 +15,9 @@ Instead of syncing data between the client and server via HTTP, Volt uses a pers
15
15
  Pages HTML is written in a template language where you can put ruby between ```{{``` and ```}}```. Volt uses data flow/reactive programming to automatically and intelligently propagate changes to the DOM (or any other code wanting to know when a value updates). When something in the DOM changes, Volt intelligently updates only the nodes that need to be changed.
16
16
 
17
17
  See some demo videos here:
18
- ** Note: These videos are outdated, new videos coming tomorrow.
19
- - [Volt Todos Example](https://www.youtube.com/watch?v=6ZIvs0oKnYs)
20
- - [Build a Blog with Volt](https://www.youtube.com/watch?v=c478sMlhx1o)
18
+ - [Volt Todos Example](https://www.youtube.com/watch?v=Tg-EtRnMz7o)
19
+ - [Build a Blog with Volt](https://www.youtube.com/watch?v=c478sMlhx1o)
20
+ ** Note: The blog video is outdated, expect an updated version soon.
21
21
 
22
22
  Check out demo apps:
23
23
  - https://github.com/voltrb/todos3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.13
1
+ 0.8.14
data/lib/volt/cli.rb CHANGED
@@ -1,10 +1,13 @@
1
1
  require 'bundler/setup'
2
2
  require 'thor'
3
3
  require 'volt/extra_core/extra_core'
4
+ require 'volt/cli/generate'
4
5
 
5
6
  class CLI < Thor
6
7
  include Thor::Actions
7
8
 
9
+ register(Generate, 'generate', 'generate GENERATOR [args]', 'Run a generator.')
10
+
8
11
  desc "new PROJECT_NAME", "generates a new project."
9
12
  def new(name)
10
13
  # Grab the current volt version
@@ -78,24 +81,6 @@ class CLI < Thor
78
81
  NewGem.new(self, name, options)
79
82
  end
80
83
 
81
- desc "model NAME COMPONENT", "Creates a model named NAME in the component named COMPONENT"
82
- method_option :name, :type => :string, :banner => "The name of the model."
83
- method_option :component, :type => :string, :default => 'main', :banner => "The component the model should be created in.", :required => false
84
- def model(name, component='main')
85
- output_file = Dir.pwd + "/app/#{component.underscore}/models/#{name.underscore.singularize}.rb"
86
- template("model/model.rb.tt", output_file, {model_name: name.camelize.singularize})
87
- end
88
-
89
- desc "component NAME", "Creates a component named NAME in the app folder."
90
- method_option :name, :type => :string, :banner => "The name of the component."
91
- def component(name)
92
- name = name.underscore
93
- component_folder = Dir.pwd + "/app/#{name}"
94
- @component_name = name
95
- directory("component", component_folder, {component_name: name})
96
- end
97
-
98
-
99
84
  def self.source_root
100
85
  File.expand_path(File.join(File.dirname(__FILE__), '../../templates'))
101
86
  end
@@ -0,0 +1,26 @@
1
+ class Generate < Thor
2
+ include Thor::Actions
3
+
4
+ desc "model NAME COMPONENT", "Creates a model named NAME in the component named COMPONENT"
5
+ method_option :name, :type => :string, :banner => "The name of the model."
6
+ method_option :component, :type => :string, :default => 'main', :banner => "The component the model should be created in.", :required => false
7
+ def model(name, component='main')
8
+ output_file = Dir.pwd + "/app/#{component.underscore}/models/#{name.underscore.singularize}.rb"
9
+ template("model/model.rb.tt", output_file, {model_name: name.camelize.singularize})
10
+ end
11
+
12
+ desc "component NAME", "Creates a component named NAME in the app folder."
13
+ method_option :name, :type => :string, :banner => "The name of the component."
14
+ def component(name)
15
+ name = name.underscore
16
+ component_folder = Dir.pwd + "/app/#{name}"
17
+ @component_name = name
18
+ directory("component", component_folder, {component_name: name})
19
+ end
20
+
21
+
22
+ def self.source_root
23
+ File.expand_path(File.join(File.dirname(__FILE__), '../../../templates'))
24
+ end
25
+
26
+ end
@@ -6,9 +6,9 @@ class String
6
6
 
7
7
  # Turns a string into the camel case version. If it is already camel case, it should
8
8
  # return the same string.
9
- def camelize
9
+ def camelize(first_letter = :upper)
10
10
  new_str = self.gsub(/_[a-z]/) { |a| a[1].upcase }
11
- new_str = new_str[0].capitalize + new_str[1..-1]
11
+ new_str = new_str[0].capitalize + new_str[1..-1] if first_letter == :upper
12
12
 
13
13
  return new_str
14
14
  end
@@ -38,10 +38,9 @@ class URL
38
38
  matcher = url.match(/^(#{protocol[0..-2]})[:]\/\/([^\/]+)(.*)$/)
39
39
  self.scheme = matcher[1]
40
40
  host, port = matcher[2].split(':')
41
- port ||= 80
42
41
 
43
42
  self.host = host
44
- self.port = port
43
+ self.port = (port || 80).to_i
45
44
 
46
45
  path = matcher[3]
47
46
  path, fragment = path.split('#', 2)
@@ -61,7 +60,7 @@ class URL
61
60
 
62
61
  # Full url rebuilds the url from it's constituent parts
63
62
  def full_url
64
- if port
63
+ if port && port != 80
65
64
  host_with_port = "#{host}:#{port}"
66
65
  else
67
66
  host_with_port = host
@@ -0,0 +1,41 @@
1
+ CamelToUnderscore = {
2
+ "Product" => "product",
3
+ "SpecialGuest" => "special_guest",
4
+ "ApplicationController" => "application_controller",
5
+ "Area51Controller" => "area51_controller"
6
+ }
7
+
8
+ UnderscoreToLowerCamel = {
9
+ "product" => "product",
10
+ "special_guest" => "specialGuest",
11
+ "application_controller" => "applicationController",
12
+ "area51_controller" => "area51Controller"
13
+ }
14
+
15
+ SymbolToLowerCamel = {
16
+ :product => 'product',
17
+ :special_guest => 'specialGuest',
18
+ :application_controller => 'applicationController',
19
+ :area51_controller => 'area51Controller'
20
+ }
21
+
22
+ CamelToUnderscoreWithoutReverse = {
23
+ "HTMLTidy" => "html_tidy",
24
+ "HTMLTidyGenerator" => "html_tidy_generator",
25
+ "FreeBSD" => "free_bsd",
26
+ "HTML" => "html",
27
+ "ForceXMLController" => "force_xml_controller",
28
+ }
29
+
30
+ CamelWithModuleToUnderscoreWithSlash = {
31
+ "Admin::Product" => "admin/product",
32
+ "Users::Commission::Department" => "users/commission/department",
33
+ "UsersSection::CommissionDepartment" => "users_section/commission_department",
34
+ }
35
+
36
+ UnderscoresToDashes = {
37
+ "street" => "street",
38
+ "street_address" => "street-address",
39
+ "person_street_address" => "person-street-address"
40
+ }
41
+
@@ -0,0 +1,49 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+ require 'extra_core/string_transformation_test_cases'
4
+ require 'volt/extra_core/string'
5
+
6
+ describe "#camelize" do
7
+ CamelToUnderscore.each do |camel, underscore|
8
+ it "camelizes" do
9
+ expect(underscore.camelize).to eq(camel)
10
+ end
11
+ end
12
+
13
+ it "camelizes lower" do
14
+ expect('capital_city'.camelize(:lower)).to eq('capitalCity')
15
+ end
16
+
17
+ it "camelizes upper" do
18
+ expect('capital_city'.camelize(:upper)).to eq('CapitalCity')
19
+ end
20
+
21
+ it "camelizes upper default" do
22
+ expect('capital_city'.camelize).to eq('CapitalCity')
23
+ end
24
+
25
+ UnderscoreToLowerCamel.each do |underscored, lower_camel|
26
+ it "camelizes lower" do
27
+ expect(underscored.camelize(:lower)).to eq(lower_camel)
28
+ end
29
+ end
30
+
31
+ UnderscoresToDashes.each do |underscored, dasherized|
32
+ it "dasherizes" do
33
+ expect(underscored.dasherize).to eq(dasherized)
34
+ end
35
+ end
36
+
37
+ CamelToUnderscore.each do |camel, underscore|
38
+ it "underscores" do
39
+ expect(camel.underscore).to eq(underscore)
40
+ end
41
+ end
42
+
43
+ it "underscores acronyms" do
44
+ expect("HTMLTidy".underscore).to eq("html_tidy")
45
+ expect("HTMLTidyGenerator".underscore).to eq("html_tidy_generator")
46
+ end
47
+
48
+ end
49
+
data/volt.gemspec CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.add_dependency "thor", "~> 0.18.0"
22
+ spec.add_dependency "thor", "~> 0.19.0"
23
23
  spec.add_dependency "pry", "~> 0.9.12.0"
24
24
  spec.add_dependency "rack", "~> 1.5.0"
25
25
  spec.add_dependency "sprockets-sass", "~> 1.0.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: volt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.13
4
+ version: 0.8.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Stout
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-14 00:00:00.000000000 Z
11
+ date: 2014-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.18.0
19
+ version: 0.19.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.18.0
26
+ version: 0.19.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pry
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -379,6 +379,7 @@ files:
379
379
  - lib/volt/boot.rb
380
380
  - lib/volt/cli.rb
381
381
  - lib/volt/cli/asset_compile.rb
382
+ - lib/volt/cli/generate.rb
382
383
  - lib/volt/cli/new_gem.rb
383
384
  - lib/volt/config.rb
384
385
  - lib/volt/console.rb
@@ -511,6 +512,8 @@ files:
511
512
  - spec/apps/kitchen_sink/public/index.html
512
513
  - spec/controllers/reactive_accessors_spec.rb
513
514
  - spec/extra_core/inflector_spec.rb
515
+ - spec/extra_core/string_transformation_test_cases.rb
516
+ - spec/extra_core/string_transformations_spec.rb
514
517
  - spec/integration/bindings_spec.rb
515
518
  - spec/integration/templates_spec.rb
516
519
  - spec/models/model_spec.rb
@@ -634,6 +637,8 @@ test_files:
634
637
  - spec/apps/kitchen_sink/public/index.html
635
638
  - spec/controllers/reactive_accessors_spec.rb
636
639
  - spec/extra_core/inflector_spec.rb
640
+ - spec/extra_core/string_transformation_test_cases.rb
641
+ - spec/extra_core/string_transformations_spec.rb
637
642
  - spec/integration/bindings_spec.rb
638
643
  - spec/integration/templates_spec.rb
639
644
  - spec/models/model_spec.rb