optimacms 0.1.56 → 0.1.57

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: 2f101211f56b650bfa8d000f61939d493f11063a
4
- data.tar.gz: 0810dcf625799ae274889d90e72d668dcbf29b71
3
+ metadata.gz: a3d4e52c4c4f6ee80e2e2cc715fe5942ee76800f
4
+ data.tar.gz: ab6c741215c43f9a2ab6da485b835a7c4bfdd765
5
5
  SHA512:
6
- metadata.gz: 6e56b2404fc66b518e6f14202f48db55e78814b943b3f797e778691387a1fb3d86db6a6bc8debbc5c17e86afa8d62f8c759ba996216bdcad12ca10d77105f32f
7
- data.tar.gz: 202bb78a078a84bb6f3bbbfa307925547a2ba3a07e9e5c7d2ab7d64509ddaeeb341c32edc75992b927bbd3ae117147ba51e523940579d3aed674b256cbadb8b0
6
+ metadata.gz: 14df3169bf11dab1293192bae129fb27a2fb7e581f22b355038f3f68c9a03ab134ea80a22da4dcca5f50b99aa9ddcf2882c4fc7920e6ecc0edf85aff2d2d938c
7
+ data.tar.gz: 512efcbef77513ee9d20b0281842a0d71280171dfed7265470f12925435c059ef48ec5b5a72c8954d5b59ee75e7e0f1347ecb8d1b58fbe609e48407eb2ed59a8
@@ -24,13 +24,38 @@ module Optimacms
24
24
  end
25
25
 
26
26
  def addadminuser
27
- return
27
+ #return
28
28
 
29
- row = Optimacms::CmsAdminUser.new
29
+ row = Optimacms::CmsAdminUser.where(email: 'admin@example.com').first || Optimacms::CmsAdminUser.new
30
30
  row.email = 'admin@example.com'
31
31
  row.password = 'password'
32
+ row.password_confirmation = row.password
32
33
 
33
- row.save
34
+ row.save!
35
+ end
36
+
37
+ def url1
38
+ v = '[a-z\d\_]+'
39
+
40
+ p = '(:pg)'
41
+ p.gsub! /(\(\:#{v}\))([-\.]|$)/, '([^/]+|)\2'
42
+
43
+ x = 0
44
+
45
+ end
46
+
47
+ def url2
48
+ u = "news/3"
49
+ r = /^news\/([^\/]+|)$/
50
+
51
+ if u =~ /^news(\/.*|)$/
52
+
53
+ x = $1
54
+ y = $2
55
+
56
+ z=0
57
+
58
+ end
34
59
  end
35
60
  end
36
61
 
@@ -63,7 +63,11 @@ module Optimacms
63
63
 
64
64
  url_parts = url.split '/'
65
65
  a = []
66
+ i_part = 0
66
67
  url_parts.each do |part|
68
+ i_part+=1
69
+
70
+
67
71
  # check for brackets inside brackets
68
72
  return nil if part =~ /\{[^{}]*[{}][^{}]*\}/
69
73
 
@@ -72,9 +76,20 @@ module Optimacms
72
76
 
73
77
  p = part
74
78
 
79
+
80
+ # variables inside (.) - optional
81
+
82
+ if i_part>1
83
+ # add / to the beginning - / is optional too
84
+ p.gsub! /(\(\:#{REGEX_VARIABLE}\))([-\.]|$)/, '(\/[^/]+)*\2'
85
+ else
86
+ # the first param
87
+ p.gsub! /(\(\:#{REGEX_VARIABLE}\))([-\.]|$)/, '([^/]+)*\2'
88
+ end
89
+
75
90
  # variables
76
91
  #p.gsub! /\{\$[^}]+\}/, '([^/]+)'
77
- p.gsub! /(\:#{REGEX_VARIABLE})([-\.]|$)/, '([^/]+)\2'
92
+ p.gsub! /(\:#{REGEX_VARIABLE})([-\.]|$)/, '\/([^/]+)\2'
78
93
 
79
94
 
80
95
  # escape system symbols
@@ -85,7 +100,7 @@ module Optimacms
85
100
  a << p
86
101
  end
87
102
 
88
- return '^'+url_parts.join('\/')+'$'
103
+ return '^'+url_parts.join('')+'$'
89
104
  end
90
105
 
91
106
  def self.count_url_parts(url)
@@ -173,4 +188,4 @@ module Optimacms
173
188
  end
174
189
 
175
190
  end
176
- end
191
+ end
@@ -1,3 +1,3 @@
1
1
  module Optimacms
2
- VERSION = "0.1.56"
2
+ VERSION = "0.1.57"
3
3
  end
@@ -4,6 +4,8 @@ class NewsController < ApplicationController
4
4
 
5
5
  def index
6
6
 
7
+ x = params[:pg]
8
+
7
9
  @items = News.all
8
10
 
9
11
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: optimacms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.56
4
+ version: 0.1.57
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Ivak
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-19 00:00:00.000000000 Z
11
+ date: 2016-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails