clone 1.0.0.beta → 1.0.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -2
  3. data/VERSION +1 -1
  4. data/samples/grape/init/Gemfile +2 -2
  5. data/samples/grape/init/{docs → doc}/grape/documentation.txt +0 -0
  6. data/samples/grape/init/lib/grape.rb +12 -2
  7. data/samples/grape/init/lib/grape/mount/rest_api.rb +22 -0
  8. data/samples/grape/vendor/lib/grape/vendors/{v1/rest.rb → v1.rb} +4 -2
  9. data/samples/helper/init/Gemfile +5 -0
  10. data/samples/helper/init/lib/boot.rb +23 -0
  11. data/samples/mongoid/init/Gemfile +1 -3
  12. data/samples/mongoid/init/lib/mongoid.rb +9 -40
  13. data/samples/mongoid/init/lib/mongoid/meta/{mongoid.yml → config.yml} +0 -0
  14. data/samples/rack/init/Gemfile +1 -4
  15. data/samples/rack/init/lib/rack.rb +1 -1
  16. metadata +8 -44
  17. data/samples/blather/restlike/Gemfile +0 -4
  18. data/samples/blather/restlike/cmd.yml +0 -1
  19. data/samples/blather/restlike/lib/blather.rb +0 -9
  20. data/samples/blather/restlike/lib/blather/dsl/api.rb +0 -78
  21. data/samples/blather/restlike/lib/blather/dsl/call.rb +0 -13
  22. data/samples/blather/restlike/lib/blather/dsl/client.rb +0 -58
  23. data/samples/blather/restlike/lib/blather/dsl/config.rb +0 -11
  24. data/samples/blather/restlike/lib/blather/dsl/extraDSL.rb +0 -163
  25. data/samples/blather/restlike/lib/blather/meta/require.rb +0 -8
  26. data/samples/blather/restlike/lib/blather/meta/xmpp.yml +0 -5
  27. data/samples/blather/restlike/lib/blather/vendors/xmpp_default.rb +0 -27
  28. data/samples/blather/restlike/readme +0 -2
  29. data/samples/grape/init/docs/grape/generate_rest_routes.rb +0 -37
  30. data/samples/grape/init/docs/grape/ls_routes.rb +0 -31
  31. data/samples/grape/init/lib/grape/meta/subclasses.rb +0 -20
  32. data/samples/grape/init/lib/grape/xpath/app.rb +0 -30
  33. data/samples/grape/init/lib/grape/xpath/ruotes.rb +0 -6
  34. data/samples/mongoid/cmd.yml +0 -1
  35. data/samples/mongoid/init/docs/mongoid/ModelsRelations.rb +0 -11
  36. data/samples/mongoid/init/docs/mongoid/generate_modelsToDocs.rb +0 -25
  37. data/samples/mongoid/init/docs/mongoid/modelsToDocs.rb +0 -25
  38. data/samples/mongoid/init/lib/mongoid/dsl/extraDSL_CRUD.rb +0 -446
  39. data/samples/mongoid/init/lib/mongoid/dsl/extraDSL_MP.rb +0 -517
  40. data/samples/mongoid/init/lib/mongoid/dsl/init.rb +0 -37
  41. data/samples/mongoid/init/lib/mongoid/dsl/params.rb +0 -67
  42. data/samples/mongoid/init/lib/mongoid/meta/banned.rb +0 -147
  43. data/samples/mongoid/init/lib/mongoid/meta/control.yml +0 -13
  44. data/samples/mongoid/init/lib/mongoid/meta/mpatch.rb +0 -14
  45. data/samples/rack/init/lib/rack/meta/webserver/thin.rb +0 -45
  46. data/samples/rack/init/lib/rack/meta/webserver/thin.yml +0 -6
  47. data/samples/rack/init/server.rb +0 -0
  48. data/samples/rest_client/init/Gemfile +0 -5
  49. data/samples/rest_client/init/boot.rb +0 -2
  50. data/samples/rest_client/init/cmd.yml +0 -1
  51. data/samples/rest_client/init/config/rest_client/defaults.rb +0 -16
  52. data/samples/rest_client/init/docs/rest_client/simple overlook +0 -251
  53. data/samples/rest_client/init/test/rest_client/rest_dsl.rb +0 -5
  54. data/samples/rest_client/readme +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5f1bf7364749820489fcb871623e253dcf406190
4
- data.tar.gz: dda9b9b6d4a9c09673bd47c4fca0db7e54c92ccc
3
+ metadata.gz: 0c08ace8fef8e8de4b18f14f34f83623464e6450
4
+ data.tar.gz: 53b4279e91c0d76e3d899e730d4f8ad39ae52888
5
5
  SHA512:
6
- metadata.gz: cd087415c29cb49867504199a7303d762bbe6777d62372114f99db6294c19cbe0918910e3064322e778d0d46467baf15b48ea8a05f4474cceba0877838df1be2
7
- data.tar.gz: 8146a894a19ee4b52c35b2c0c93dfcae80bb629f1d416d8c8c079ae6e952c206c0cf6c3d17cf5dae94a72efcd09126842247cc83ef7b06ec267fc0314763ed73
6
+ metadata.gz: b24d35db9d9097ac2298b853b13938feec9069308cb008280411c992201917cced0cf73ea54eb63d96054385249867c67f8df7bbe6f0fea8ccfb62f0993b5e02
7
+ data.tar.gz: d2ffbb1b6ca2258f2035259f604c25e71dcbc0296e8c1324bfcef37b597a44c4fdf3dfa12082d15839f982eeec77470904b79527896fdbb3c798b2727d9a444b
data/.gitignore CHANGED
@@ -33,6 +33,5 @@ build/
33
33
  # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
34
34
  .rvmrc
35
35
 
36
- Gemfile.lock
37
36
  /pkg/
38
- Gemfile.lock
37
+ /Gemfile.lock
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0.beta
1
+ 1.0.0.beta2
@@ -1,2 +1,2 @@
1
- #A Ruby framework for rapid API development with great conventions.
2
- gem "grape"
1
+ gem 'grape'
2
+ gem 'grape-dsl'
@@ -1,4 +1,14 @@
1
+ require 'grape-dsl'
2
+ require 'grape'
3
+ require 'argv'
1
4
 
2
5
  ### Load Grape API parts
3
- require_relative_directory File.join "grape","vendors"
4
- require_relative_directory File.join "grape","xpath"
6
+ require_relative_directory_r File.join "grape","vendors"
7
+ require_relative_directory_r File.join "grape","mount"
8
+
9
+ if ARGV.to_hash(m:true,s:true)[:generate].include?(:grape)
10
+
11
+ Grape.create_wiki_doc path: (File.join(Dir.pwd,"README")),
12
+ type: :github
13
+
14
+ end
@@ -0,0 +1,22 @@
1
+ # -*- encoding : utf-8 -*-
2
+ module REST
3
+ class API < Grape::API
4
+
5
+ begin
6
+
7
+ version 'v1.0.0',
8
+ using: :header,
9
+ vendor: 'APP'
10
+
11
+ default_format :txt
12
+ format :json
13
+ content_type :txt, "application/text"
14
+ content_type :json, "application/json"
15
+
16
+ end
17
+
18
+ mount_subclasses
19
+ #console_write_out_routes
20
+
21
+ end
22
+ end
@@ -12,15 +12,17 @@ module REST
12
12
  #format :json
13
13
 
14
14
 
15
- resource :RESOURCE do
15
+ namespace :RESOURCE do
16
16
 
17
17
  desc ""
18
18
  params do
19
+
19
20
  #requires :id, type: Integer
20
21
  #optional :text, type: String, regexp: /^[a-z]+$/
21
22
  #group :media do
22
23
  # requires :url
23
24
  #end
25
+
24
26
  end
25
27
  get do
26
28
 
@@ -44,8 +46,8 @@ module REST
44
46
 
45
47
  end
46
48
 
47
-
48
49
  end
50
+
49
51
  end
50
52
  end
51
53
 
@@ -0,0 +1,5 @@
1
+ gem 'mpatch'
2
+ gem 'argv'
3
+ gem 'tmp'
4
+ gem 'configer'
5
+ gem 'daemon-ogre'
@@ -0,0 +1,23 @@
1
+ # -*- encoding : utf-8 -*-
2
+
3
+ # set program directory
4
+ unless Dir.pwd == File.expand_path(File.join(File.dirname(__FILE__),'..'))
5
+ Dir.chdir(File.join(File.dirname(__FILE__),'..'))
6
+ end
7
+
8
+ # Require Gemfile gems
9
+ require File.join 'bundler','setup'
10
+ Bundler.require(:default, :development)
11
+
12
+ # daemonize if app started with right tags
13
+ DaemonOgre.init
14
+
15
+ # use the __CONFIG__ object to get the config variables
16
+ # place yaml files under each module named folders meta folder
17
+ Loader.metaloader_framework config_obj: __CONFIG__
18
+
19
+ # set app name based on project folder
20
+ $0= TMP.project_folder
21
+
22
+ # show help if started with -h / --help
23
+ ARGV.show_help
@@ -1,3 +1 @@
1
- ### Mongoid is an ODM (Object Document Mapper)
2
- ## Framework for MongoDB, written in Ruby.
3
- gem "mongoid", "~> 3.1.4"
1
+ gem "mongoid", ">= 3.1.4"
@@ -1,44 +1,13 @@
1
+ # -*- encoding : utf-8 -*-
1
2
 
2
- ### connect to the database
3
- #CONFIGURATION OPTIONS
4
- #
5
- #Mongoid currently supports the following configuration options, either
6
- #provided in the mongoid.yml or programatically (defaults in parenthesis).
7
- #
8
- # allow_dynamic_fields (true): When attributes are not defined as
9
- # fields but added to an object, they will get fields added for them dynamically and will get persisted. If set to false an error will get raised when attempting to set a value that has no field defined.
10
- # autocreate_indexes (false): When set to true Mongoid will attempt to create indexes each time a class is loaded. This is not recommended for any environment other than development or test.
11
- # identity_map_enabled (false): When set to true Mongoid will store
12
- # documents loaded from the database in the identity map by their ids,
13
- # so subsequent database queries for the same document in the same unit
14
- # of work do not hit the database. This is only for relation queries at
15
- # the moment. See the identity map documentation for more info.
16
- #
17
- # include_root_in_json (false): When set to true mongoid will include the
18
- # name of the root document and the name of each association as the root
19
- # element when calling #to_json on a model.
20
- #
21
- #max_retries_on_connection_failure (0): If you would like Mongoid to retry
22
- #operations if a Mongo::ConnectionFailure occurs you may specify this option
23
- #in your config. Mongoid will retry the operation every half second up to the
24
- #limit that is set. This is particularly useful when using replica sets.
25
- # parameterize_keys (true): Tells Mongoid to convert basic special characters in composite keys to SEO friendly substrings.
26
- # persist_in_safe_mode (false): Tells Mongoid to perform all database operations in MongoDB's safe mode. This will cause the driver to double check operations and raise an error if they failed. Switching to true will be safe but will be a slight performance hit.
27
- #preload_models (false): Tells Mongoid to preload all application model classes
28
- #on each request in environments where classes are not being cached. This should
29
- #only be used by applications that use single collection inheritance due to
30
- #performance issues with enabling this.
31
- #
32
- #raise_not_found_error (true): Will raise a Mongoid::Errors::DocumentNotFound
33
- # when attempting to find a document by an id that doesnt exist. When set to
34
- #false will only return nil for the same query.
35
- #skip_version_check (false): If you are having issues authenticating against
36
- #MongoHQ or MongoMachine because of access to the system collection being not
37
- #allowed, set this to true.
38
3
  Mongoid.configure do |config|
39
- config.master = Mongo::Connection.new.db("default")
4
+ config.sessions= __CONFIG__[:development][:sessions]
40
5
  end
41
6
 
42
- ### Require Mongoid parts
43
- require_relative_directory File.join "mongoid","dsl"
44
- require_relative_directory File.join "mongoid","models"
7
+ # load models
8
+ require_relative_directory "mongoid/functions",:r
9
+ require_relative_directory "mongoid/models",:r
10
+
11
+ if ARGV.to_hash(s: true)[:db] == "drop"
12
+ Mongoid.purge!
13
+ end
@@ -1,8 +1,5 @@
1
-
2
- ### Require Rack compatible gems
3
1
  gem "rack"
4
- gem "thin", "~> 1.5.1"
5
- #gem "webrick"
2
+ gem "webrick"
6
3
  #gem "ebb"
7
4
  #gem "fcgi"
8
5
  #gem "scgi"
@@ -1 +1 @@
1
- require_relative_directory File.join "rack"
1
+ require_relative_directory_ File.join "rack"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clone
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta
4
+ version: 1.0.0.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Luzsi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-26 00:00:00.000000000 Z
11
+ date: 2014-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -63,7 +63,6 @@ extra_rdoc_files: []
63
63
  files:
64
64
  - ".gitignore"
65
65
  - Gemfile
66
- - Gemfile.lock
67
66
  - LICENSE
68
67
  - LICENSE.txt
69
68
  - README.md
@@ -179,48 +178,23 @@ files:
179
178
  - module/prerelease_specs.4.8.gz
180
179
  - module/specs.4.8
181
180
  - module/specs.4.8.gz
182
- - samples/blather/restlike/Gemfile
183
- - samples/blather/restlike/cmd.yml
184
- - samples/blather/restlike/lib/blather.rb
185
- - samples/blather/restlike/lib/blather/dsl/api.rb
186
- - samples/blather/restlike/lib/blather/dsl/call.rb
187
- - samples/blather/restlike/lib/blather/dsl/client.rb
188
- - samples/blather/restlike/lib/blather/dsl/config.rb
189
- - samples/blather/restlike/lib/blather/dsl/extraDSL.rb
190
- - samples/blather/restlike/lib/blather/meta/require.rb
191
- - samples/blather/restlike/lib/blather/meta/xmpp.yml
192
- - samples/blather/restlike/lib/blather/vendors/xmpp_default.rb
193
- - samples/blather/restlike/readme
194
181
  - samples/grape/init/Gemfile
195
182
  - samples/grape/init/cmd.yml
196
183
  - samples/grape/init/config.ru
197
- - samples/grape/init/docs/grape/documentation.txt
198
- - samples/grape/init/docs/grape/generate_rest_routes.rb
199
- - samples/grape/init/docs/grape/ls_routes.rb
184
+ - samples/grape/init/doc/grape/documentation.txt
200
185
  - samples/grape/init/lib/grape.rb
201
- - samples/grape/init/lib/grape/meta/subclasses.rb
202
- - samples/grape/init/lib/grape/xpath/app.rb
203
- - samples/grape/init/lib/grape/xpath/ruotes.rb
186
+ - samples/grape/init/lib/grape/mount/rest_api.rb
204
187
  - samples/grape/init/readme
205
188
  - samples/grape/readme
206
- - samples/grape/vendor/lib/grape/vendors/v1/rest.rb
207
- - samples/mongoid/cmd.yml
189
+ - samples/grape/vendor/lib/grape/vendors/v1.rb
190
+ - samples/helper/init/Gemfile
191
+ - samples/helper/init/lib/boot.rb
208
192
  - samples/mongoid/init/Gemfile
209
193
  - samples/mongoid/init/cmd.yml
210
- - samples/mongoid/init/docs/mongoid/ModelsRelations.rb
211
194
  - samples/mongoid/init/docs/mongoid/documents.xls
212
- - samples/mongoid/init/docs/mongoid/generate_modelsToDocs.rb
213
- - samples/mongoid/init/docs/mongoid/modelsToDocs.rb
214
195
  - samples/mongoid/init/docs/mongoid/relations.txt
215
196
  - samples/mongoid/init/lib/mongoid.rb
216
- - samples/mongoid/init/lib/mongoid/dsl/extraDSL_CRUD.rb
217
- - samples/mongoid/init/lib/mongoid/dsl/extraDSL_MP.rb
218
- - samples/mongoid/init/lib/mongoid/dsl/init.rb
219
- - samples/mongoid/init/lib/mongoid/dsl/params.rb
220
- - samples/mongoid/init/lib/mongoid/meta/banned.rb
221
- - samples/mongoid/init/lib/mongoid/meta/control.yml
222
- - samples/mongoid/init/lib/mongoid/meta/mongoid.yml
223
- - samples/mongoid/init/lib/mongoid/meta/mpatch.rb
197
+ - samples/mongoid/init/lib/mongoid/meta/config.yml
224
198
  - samples/mongoid/model/lib/mongoid/models/model.rb
225
199
  - samples/mongoid/readme
226
200
  - samples/rack/init/Gemfile
@@ -234,17 +208,7 @@ files:
234
208
  - samples/rack/init/docs/rack/webservers/passenger
235
209
  - samples/rack/init/docs/rack/webservers/scgi
236
210
  - samples/rack/init/lib/rack.rb
237
- - samples/rack/init/lib/rack/meta/webserver/thin.rb
238
- - samples/rack/init/lib/rack/meta/webserver/thin.yml
239
- - samples/rack/init/server.rb
240
211
  - samples/rack/readme
241
- - samples/rest_client/init/Gemfile
242
- - samples/rest_client/init/boot.rb
243
- - samples/rest_client/init/cmd.yml
244
- - samples/rest_client/init/config/rest_client/defaults.rb
245
- - samples/rest_client/init/docs/rest_client/simple overlook
246
- - samples/rest_client/init/test/rest_client/rest_dsl.rb
247
- - samples/rest_client/readme
248
212
  - samples/scripts/lines_counter/lines_number.rb
249
213
  - samples/scripts/lines_counter/readme
250
214
  - samples/scripts/readme
@@ -1,4 +0,0 @@
1
- ### easy XMPP client gem based on EventMachine
2
- gem 'blather', '~> 0.8.5'
3
- ### JSON
4
- gem 'json'
@@ -1 +0,0 @@
1
- helper: init
@@ -1,9 +0,0 @@
1
- ### Load Blather config
2
- require_relative_directory File.join "blather","meta"
3
- ### Load the blather extraDSL
4
- require_relative_directory File.join "blather","dsl"
5
- ### Load the blather Snippet Vendors!
6
- require_relative_directory File.join "blather","vendors"
7
-
8
- ### Fire up Blather Engine
9
- XMPP::Client.start
@@ -1,78 +0,0 @@
1
- module XMPP
2
- class API
3
- ### class var
4
- begin
5
- @@route_path ||= Array.new.push(nil)
6
- @@route_version ||= "v0"
7
- end
8
- ### syntax sugar
9
- begin
10
- ### main class dsl
11
- begin
12
- class << self
13
- def version(version)
14
- if !version.nil?
15
- @@route_version= version.to_s
16
- end
17
- end
18
- def namespace(space, &block)
19
- @@route_path.push space.to_s.downcase
20
- index_of_space= (@@route_path.count-1)
21
- yield
22
- @@route_path.delete_at index_of_space
23
- return true
24
- end
25
- def rout_path(join='/')
26
- return @@route_path.join(join)
27
- end
28
- def route(method, paths, options, &block)
29
-
30
- ### generate method path
31
- begin
32
- full_path= rout_path('_')
33
- if !paths.nil?
34
- full_path+= '_'+paths.to_s
35
- end
36
- end
37
-
38
- ### generate name
39
- begin
40
- name_hash= Hash.new
41
- name_hash['method']= method.to_s
42
- name_hash['path']= full_path
43
- name_hash['version']= @@route_version
44
- method_name= XMPP.generate_method_name(name_hash)
45
- end
46
-
47
- ### generate new xmpp path/method
48
- begin
49
- XMPP::Call.create_singleton_method method_name, &block
50
- end
51
-
52
- end
53
- def get(paths = nil, options = {}, &block); route(:get, paths, options, &block) end
54
- def post(paths = nil, options = {}, &block); route(:post, paths, options, &block) end
55
- def put(paths = nil, options = {}, &block); route(:put, paths, options, &block) end
56
- def head(paths = nil, options = {}, &block); route(:head, paths, options, &block) end
57
- def delete(paths = nil, options = {}, &block); route(:delete, paths, options, &block) end
58
- def self.inherited(subclass)
59
- @classes ||= Array.new
60
- @classes.push subclass.name.constantize
61
- end
62
- def self.classes
63
- @classes
64
- end
65
- end
66
- end
67
- ### sugar alias
68
- begin
69
- class << self
70
- alias_method :group, :namespace
71
- alias_method :resource, :namespace
72
- alias_method :resources, :namespace
73
- alias_method :segment, :namespace
74
- end
75
- end
76
- end
77
- end
78
- end
@@ -1,13 +0,0 @@
1
- module XMPP
2
- module Call
3
- ### meta defs
4
- begin
5
- def self.create_singleton_method(method,&block)
6
- define_singleton_method method, &block
7
- end
8
- def self.method_missing (method_name)
9
- return {:error => "invalid method or version"}
10
- end
11
- end
12
- end
13
- end
@@ -1,58 +0,0 @@
1
- module XMPP
2
- class Client
3
- include Blather::DSL
4
- class << self
5
- attr_accessor :engine,
6
- :ready,
7
- :answers
8
-
9
- def start
10
-
11
- thread = Thread.new do
12
- ### config
13
- begin
14
- XMPP::Client.engine ||= XMPP::Client.new
15
- XMPP::Client.answers ||= Hash.new
16
- jid = XMPP::CONFIG::JID
17
- pwd = XMPP::CONFIG::PWD
18
- host = XMPP::CONFIG::HOST
19
- port = XMPP::CONFIG::PORT
20
- end
21
- ### settings
22
- begin
23
- XMPP::Client.engine.setup jid,pwd,host,port
24
- XMPP::Client.engine.when_ready do
25
- XMPP::Client.ready= true
26
- end
27
- XMPP::Client.engine.subscription :request? do |s|
28
- XMPP::Client.engine.write_to_stream s.approve!
29
- end
30
- XMPP::Client.engine.disconnected do
31
- begin
32
- EM.run do
33
- XMPP::Client.engine.run
34
- end
35
- rescue Exception
36
- retry
37
- end
38
- end
39
- XMPP::Client.engine.message :chat?, :body do |m|
40
- XMPP::Client.engine.say m.from, XMPP.receive(m.body)
41
- end
42
- end
43
- ### launch
44
- begin
45
- EM.run do
46
- XMPP::Client.engine.run
47
- end
48
- rescue Exception
49
- retry
50
- end
51
- end
52
- thread.abort_on_exception = true
53
- return true
54
- end
55
-
56
- end
57
- end
58
- end