chaplin 0.0.3 → 0.0.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db428235e40febf17c34bb3a2091836828f1722c
4
- data.tar.gz: de03bacbdd6dab54e88688c09bbfb244c5254df4
3
+ metadata.gz: ac0c5ecdd0aef077f2507a0598322f41a767704d
4
+ data.tar.gz: d8b881871b606dde3c33b156ee3d6e82d4c8d9a4
5
5
  SHA512:
6
- metadata.gz: cff47ddbe4db3b6cb5697279651090465227b98de75c63c2852a8180adbf02f78a24c9ee16d8931671aa6f0aedc8121e2c61642a146886dd18603eded9a69b10
7
- data.tar.gz: acd1de9efd894c543b4d050c45e9d595b74f630ce4468c8a7cbc29db24a20bce10323b2033f0bc1fe215d44b1c3f37b56d6414419862ab76342b804890e422fd
6
+ metadata.gz: 23819dd64b1543a3496b75699d9b078320d5ef6fc1f69a717747fc4e60c740f10b5853678a4fa426b1fe3f640c02a2a5d10ba74629a38b57bf884384e13f39df
7
+ data.tar.gz: 376704c6af4096f98d85f1bfe5c5565ee57cf7e679a3c247b0f29bdb723aa9d232625dd340e85b93c337b3afc74321dd4734afd03c3ac2318479aa46d8602352
data/bin/chaplin CHANGED
@@ -9,12 +9,7 @@ if ARGV[0].nil?
9
9
  puts "$ chaplin new my_chaplin_project_directory_name"
10
10
  elsif ARGV[0] == 'new'
11
11
  new_project_path = ARGV[1]
12
-
13
- FileUtils.mkdir(new_project_path)
14
- FileUtils.cp_r("#{__dir__}/../sample_project/.", new_project_path)
15
-
16
- puts "New chaplin project created in #{new_project_path}"
17
- puts "Start the server with '$ chaplin #{new_project_path}'"
12
+ Chaplin::New.(new_project_path)
18
13
  else
19
14
  project_directory = ARGV[0]
20
15
  chaplin_server = Chaplin.new(project_directory).server
@@ -0,0 +1,16 @@
1
+
2
+ class Chaplin
3
+ module New
4
+
5
+ def self.call(new_project_path)
6
+ FileUtils.mkdir(new_project_path)
7
+ FileUtils.cp_r("#{__dir__}/../../sample_project/templates", new_project_path)
8
+ FileUtils.cp("#{__dir__}/../../sample_project/app.yml", new_project_path)
9
+ FileUtils.cp("#{__dir__}/../../sample_project/chaplin_config.yml", new_project_path)
10
+
11
+ puts "New chaplin project created in #{new_project_path}"
12
+ puts "Start the server with 'chaplin #{new_project_path}'"
13
+ end
14
+
15
+ end
16
+ end
@@ -18,8 +18,8 @@ class Chaplin
18
18
 
19
19
  def self.add_route(endpoint, response)
20
20
  send(endpoint.http_method, endpoint.path) do
21
- params_with_cookies = (params || {}).merge(cookies: cookies)
22
- response.execute(params_with_cookies, self)
21
+ params_with_cookies_and_session = (params || {}).merge(cookies: cookies, session: session)
22
+ response.execute(params_with_cookies_and_session, self)
23
23
  end
24
24
  end
25
25
  end
data/lib/chaplin.rb CHANGED
@@ -3,6 +3,8 @@ require_relative 'chaplin/parser/config'
3
3
  require_relative 'chaplin/server'
4
4
  require_relative 'chaplin/api_endpoint'
5
5
 
6
+ require_relative 'chaplin/new'
7
+
6
8
  class Chaplin
7
9
 
8
10
  def initialize(project_path)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chaplin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Mours
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-26 00:00:00.000000000 Z
11
+ date: 2015-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -233,6 +233,7 @@ files:
233
233
  - lib/chaplin/api_endpoint.rb
234
234
  - lib/chaplin/endpoint.rb
235
235
  - lib/chaplin/inline_partial.rb
236
+ - lib/chaplin/new.rb
236
237
  - lib/chaplin/parser.rb
237
238
  - lib/chaplin/parser/api_endpoints.rb
238
239
  - lib/chaplin/parser/config.rb
@@ -268,3 +269,4 @@ signing_key:
268
269
  specification_version: 4
269
270
  summary: Build HTML apps from JSON APIs in no time
270
271
  test_files: []
272
+ has_rdoc: