choco 0.1.2 → 0.1.3

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/HISTORY CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.1.3 [08-31-10]
2
+ * Add $ choco server command to launch a local rack server
3
+ * A config.ru file is created at the root of each new project
4
+
1
5
  == 0.1.2 [08-27-10]
2
6
  * Add fixtures generate (mock ajax requests)
3
7
 
@@ -25,6 +25,8 @@ A sample project based on Rails 3 is available here : http://github.com/ahe/choc
25
25
  An awesome screencast with an awesome belgian accent is available here :
26
26
  http://www.2dconcept.com/images/choco.mov
27
27
 
28
+ Follow us on Twitter : https://twitter.com/choco_js
29
+
28
30
  == Installation
29
31
 
30
32
  Choco is a Ruby gem, simply install it :
@@ -40,10 +42,18 @@ This will generate your project structure.
40
42
  You can then install the required JS dependencies (jQuery, Sammy, ...) by executing the following command at the root of your project :
41
43
 
42
44
  $ rake choco:js:install
45
+
46
+ Launch your local server :
47
+
48
+ $ choco server
49
+
43
50
 
44
51
  == Location
45
52
 
46
53
  A Choco app is composed of static files (js, css, images, ...), it must be directly accessible on your web server.
54
+
55
+ A local Rack web server can be launched directly using the '$ choco server' command. You'll have to install WEBRick or Mongrel.
56
+
47
57
  If you use Rails, you can for example put your Choco app inside the public/javascripts folder.
48
58
 
49
59
  Once you've chosen the location where your application will reside, don't forget to configure the path to your view files.
data/Rakefile CHANGED
@@ -19,7 +19,8 @@ begin
19
19
  gem.add_dependency "jim"
20
20
  gem.add_dependency "fssm"
21
21
  gem.add_dependency "thor"
22
- gem.add_dependency "activesupport"
22
+ gem.add_dependency "activesupport"
23
+ gem.add_dependency "rack"
23
24
 
24
25
  gem.add_development_dependency "rspec", ">= 1.2.9"
25
26
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{choco}
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Anthony Heukmes"]
12
- s.date = %q{2010-07-28}
12
+ s.date = %q{2010-07-31}
13
13
  s.default_executable = %q{choco}
14
14
  s.description = %q{Choco brings the MVC to the client side! It allows you to easily develop maintainable Rich Internet Applications using Javascript.}
15
15
  s.email = %q{anthony.heukmes@skynet.be}
@@ -42,6 +42,7 @@ Gem::Specification.new do |s|
42
42
  "lib/choco/generators/templates/Rakefile",
43
43
  "lib/choco/generators/templates/application.css",
44
44
  "lib/choco/generators/templates/choco",
45
+ "lib/choco/generators/templates/config.ru",
45
46
  "lib/choco/generators/templates/controllers/application_controller.js",
46
47
  "lib/choco/generators/templates/controllers/base_controller.js",
47
48
  "lib/choco/generators/templates/controllers/rest_controller.js",
@@ -87,12 +88,14 @@ Gem::Specification.new do |s|
87
88
  s.add_runtime_dependency(%q<fssm>, [">= 0"])
88
89
  s.add_runtime_dependency(%q<thor>, [">= 0"])
89
90
  s.add_runtime_dependency(%q<activesupport>, [">= 0"])
91
+ s.add_runtime_dependency(%q<rack>, [">= 0"])
90
92
  s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
91
93
  else
92
94
  s.add_dependency(%q<jim>, [">= 0"])
93
95
  s.add_dependency(%q<fssm>, [">= 0"])
94
96
  s.add_dependency(%q<thor>, [">= 0"])
95
97
  s.add_dependency(%q<activesupport>, [">= 0"])
98
+ s.add_dependency(%q<rack>, [">= 0"])
96
99
  s.add_dependency(%q<rspec>, [">= 1.2.9"])
97
100
  end
98
101
  else
@@ -100,6 +103,7 @@ Gem::Specification.new do |s|
100
103
  s.add_dependency(%q<fssm>, [">= 0"])
101
104
  s.add_dependency(%q<thor>, [">= 0"])
102
105
  s.add_dependency(%q<activesupport>, [">= 0"])
106
+ s.add_dependency(%q<rack>, [">= 0"])
103
107
  s.add_dependency(%q<rspec>, [">= 1.2.9"])
104
108
  end
105
109
  end
@@ -3,7 +3,7 @@ require 'thor/group'
3
3
  require 'active_support/inflector'
4
4
 
5
5
  module Choco
6
- VERSION = '0.1.2'
6
+ VERSION = '0.1.3'
7
7
 
8
8
  autoload :DependencyManager, 'choco/dependency_manager'
9
9
  autoload :CLI, 'choco/cli'
@@ -13,7 +13,8 @@ module Choco
13
13
  @args << '--help' if @args.empty?
14
14
 
15
15
  aliases = {
16
- "g" => "generate"
16
+ "g" => "generate",
17
+ "s" => "server"
17
18
  }
18
19
 
19
20
  command = @args.shift
@@ -28,6 +29,14 @@ module Choco
28
29
  else
29
30
  @output = template('generators')
30
31
  end
32
+
33
+ when 'server'
34
+ port = 9292
35
+ port = @args[@args.index('-p') + 1] if @args.include?('-p')
36
+ port = @args[@args.index('--port') + 1] if @args.include?('--port')
37
+ puts "*** Choco server is now running on port #{port}"
38
+ puts "*** Launch http://localhost:#{port}/index.html to start your Choco application"
39
+ system "rackup #{@args.join(' ')}"
31
40
 
32
41
  when '--watch'
33
42
  require 'fssm'
@@ -62,6 +62,10 @@ module Choco
62
62
  template('templates/Rakefile', "#{name}/Rakefile")
63
63
  end
64
64
 
65
+ def create_rackup_file
66
+ template('templates/config.ru', "#{name}/config.ru")
67
+ end
68
+
65
69
  def create_readme_file
66
70
  create_file "#{name}/README.rdoc"
67
71
  end
@@ -0,0 +1,3 @@
1
+ map '/' do
2
+ run Rack::Directory.new('.')
3
+ end
@@ -2,7 +2,7 @@ var app = $.sammy(function() {
2
2
 
3
3
  this.element_selector = '#choco';
4
4
  this.template_engine = 'template';
5
- this.project_path = '/<%= name %>';
5
+ this.project_path = '';
6
6
  this.fixtures = true;
7
7
 
8
8
  // Configure your Sammy JS plugins
@@ -9,4 +9,8 @@ The choco script responds to the following commands and options :
9
9
  generate <generator_name> <resource_name> [options]
10
10
  Available generators are : controller, model, scaffold, fixture, layout, plugin
11
11
  Run '$ choco generate', for more information.
12
-
12
+
13
+ server [options]
14
+ -s, --server SERVER serve using SERVER (webrick/mongrel)
15
+ -p, --port PORT use PORT (default: 9292)
16
+
@@ -64,14 +64,6 @@ describe "Generators" do
64
64
 
65
65
  describe "templates" do
66
66
 
67
- describe "ApplicationController" do
68
-
69
- it "should set the views path to the project views folder" do
70
- file = get_file_as_string(@project_path + '/app/controllers/application_controller.js')
71
- file.include?("this.project_path = '/spec/tmp/test_project';").should be_true
72
- end
73
- end
74
-
75
67
  describe "index.html" do
76
68
 
77
69
  before(:all) do
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 2
9
- version: 0.1.2
8
+ - 3
9
+ version: 0.1.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Anthony Heukmes
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-07-28 00:00:00 +02:00
17
+ date: 2010-07-31 00:00:00 +02:00
18
18
  default_executable: choco
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -66,9 +66,21 @@ dependencies:
66
66
  type: :runtime
67
67
  version_requirements: *id004
68
68
  - !ruby/object:Gem::Dependency
69
- name: rspec
69
+ name: rack
70
70
  prerelease: false
71
71
  requirement: &id005 !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ segments:
76
+ - 0
77
+ version: "0"
78
+ type: :runtime
79
+ version_requirements: *id005
80
+ - !ruby/object:Gem::Dependency
81
+ name: rspec
82
+ prerelease: false
83
+ requirement: &id006 !ruby/object:Gem::Requirement
72
84
  requirements:
73
85
  - - ">="
74
86
  - !ruby/object:Gem::Version
@@ -78,7 +90,7 @@ dependencies:
78
90
  - 9
79
91
  version: 1.2.9
80
92
  type: :development
81
- version_requirements: *id005
93
+ version_requirements: *id006
82
94
  description: Choco brings the MVC to the client side! It allows you to easily develop maintainable Rich Internet Applications using Javascript.
83
95
  email: anthony.heukmes@skynet.be
84
96
  executables:
@@ -112,6 +124,7 @@ files:
112
124
  - lib/choco/generators/templates/Rakefile
113
125
  - lib/choco/generators/templates/application.css
114
126
  - lib/choco/generators/templates/choco
127
+ - lib/choco/generators/templates/config.ru
115
128
  - lib/choco/generators/templates/controllers/application_controller.js
116
129
  - lib/choco/generators/templates/controllers/base_controller.js
117
130
  - lib/choco/generators/templates/controllers/rest_controller.js