ccs_core_gem 0.0.2
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/.gitignore +3 -0
- data/Gemfile +4 -0
- data/Rakefile +2 -0
- data/app/controllers/application_controller.rb +4 -0
- data/app/controllers/service/site_details_controller.rb +82 -0
- data/app/controllers/service/site_signups_controller.rb +83 -0
- data/app/controllers/service_controller.rb +6 -0
- data/app/helpers/application_helper.rb +2 -0
- data/app/helpers/service/site_detail_helper.rb +2 -0
- data/app/helpers/site_details_helper.rb +2 -0
- data/app/helpers/site_signups_helper.rb +2 -0
- data/app/models/signup_service.rb +15 -0
- data/app/models/site_detail.rb +18 -0
- data/app/models/site_signup.rb +33 -0
- data/app/views/layouts/application.html.erb +14 -0
- data/app/views/service/site_details/_form.html.erb +37 -0
- data/app/views/service/site_details/edit.html.erb +6 -0
- data/app/views/service/site_details/index.html.erb +31 -0
- data/app/views/service/site_details/new.html.erb +5 -0
- data/app/views/service/site_details/show.html.erb +30 -0
- data/app/views/service/site_signups/_form.html.erb +33 -0
- data/app/views/service/site_signups/edit.html.erb +6 -0
- data/app/views/service/site_signups/index.html.erb +29 -0
- data/app/views/service/site_signups/new.html.erb +5 -0
- data/app/views/service/site_signups/show.html.erb +25 -0
- data/ccs_core_gem.gemspec +21 -0
- data/config/locales/en.yml +5 -0
- data/config/routes.rb +13 -0
- data/config/services.yml +17 -0
- data/db/development.sqlite3 +0 -0
- data/db/schema.rb +34 -0
- data/db/seeds.rb +7 -0
- data/db/test.sqlite3 +0 -0
- data/lib/ccs_core_gem/engine.rb +6 -0
- data/lib/ccs_core_gem/version.rb +3 -0
- data/lib/ccs_core_gem.rb +4 -0
- data/lib/generators/ccs_core_gem/ccs_core_gem_generator.rb +31 -0
- data/lib/generators/ccs_core_gem/templates/create_site_details.rb +17 -0
- data/lib/generators/ccs_core_gem/templates/create_site_signups.rb +16 -0
- data/lib/service_locator.rb +28 -0
- data/nbproject/private/config.properties +0 -0
- data/nbproject/private/private.properties +1 -0
- data/nbproject/private/private.xml +4 -0
- data/nbproject/private/rake-d.txt +3 -0
- data/nbproject/project.properties +8 -0
- data/nbproject/project.xml +16 -0
- metadata +114 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
class Service::SiteDetailsController < ServiceController
|
2
|
+
def index
|
3
|
+
@site_details = SiteDetail.all
|
4
|
+
|
5
|
+
respond_to do |format|
|
6
|
+
format.html # index.html.erb
|
7
|
+
format.xml { render :xml => @site_details }
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
# GET /site_details/1
|
12
|
+
# GET /site_details/1.xml
|
13
|
+
def show
|
14
|
+
@site_detail = SiteDetail.find(params[:id])
|
15
|
+
|
16
|
+
respond_to do |format|
|
17
|
+
format.html # show.html.erb
|
18
|
+
format.xml { render :xml => @site_detail }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# GET /site_details/new
|
23
|
+
# GET /site_details/new.xml
|
24
|
+
def new
|
25
|
+
@site_detail = SiteDetail.new
|
26
|
+
|
27
|
+
respond_to do |format|
|
28
|
+
format.html # new.html.erb
|
29
|
+
format.xml { render :xml => @site_detail }
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# GET /site_details/1/edit
|
34
|
+
def edit
|
35
|
+
@site_detail = SiteDetail.find(params[:id])
|
36
|
+
end
|
37
|
+
|
38
|
+
# POST /site_details
|
39
|
+
# POST /site_details.xml
|
40
|
+
def create
|
41
|
+
@site_detail = SiteDetail.new(params[:site_detail])
|
42
|
+
|
43
|
+
respond_to do |format|
|
44
|
+
if @site_detail.save
|
45
|
+
format.html { redirect_to([:service, @site_detail], :notice => 'Site detail was successfully created.') }
|
46
|
+
format.xml { render :xml => @site_detail, :status => :created, :location => [:service, @site_detail] }
|
47
|
+
else
|
48
|
+
format.html { render :action => "new" }
|
49
|
+
format.xml { render :xml => @site_detail.errors, :status => :unprocessable_entity }
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# PUT /site_details/1
|
55
|
+
# PUT /site_details/1.xml
|
56
|
+
def update
|
57
|
+
@site_detail = SiteDetail.find(params[:id])
|
58
|
+
|
59
|
+
respond_to do |format|
|
60
|
+
if @site_detail.update_attributes(params[:site_detail])
|
61
|
+
format.html { redirect_to([:service, @site_detail], :notice => 'Site detail was successfully updated.') }
|
62
|
+
format.xml { head :ok }
|
63
|
+
else
|
64
|
+
format.html { render :action => "edit" }
|
65
|
+
format.xml { render :xml => @site_detail.errors, :status => :unprocessable_entity }
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# DELETE /site_details/1
|
71
|
+
# DELETE /site_details/1.xml
|
72
|
+
def destroy
|
73
|
+
@site_detail = SiteDetail.find(params[:id])
|
74
|
+
@site_detail.destroy
|
75
|
+
|
76
|
+
respond_to do |format|
|
77
|
+
format.html { redirect_to(service_site_details_url) }
|
78
|
+
format.xml { head :ok }
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
class Service::SiteSignupsController < ServiceController
|
2
|
+
# GET /site_signups
|
3
|
+
# GET /site_signups.xml
|
4
|
+
def index
|
5
|
+
@site_signups = SiteSignup.all
|
6
|
+
|
7
|
+
respond_to do |format|
|
8
|
+
format.html # index.html.erb
|
9
|
+
format.xml { render :xml => @site_signups }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# GET /site_signups/1
|
14
|
+
# GET /site_signups/1.xml
|
15
|
+
def show
|
16
|
+
@site_signup = SiteSignup.find(params[:id])
|
17
|
+
|
18
|
+
respond_to do |format|
|
19
|
+
format.html # show.html.erb
|
20
|
+
format.xml { render :xml => @site_signup }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# GET /site_signups/new
|
25
|
+
# GET /site_signups/new.xml
|
26
|
+
def new
|
27
|
+
@site_signup = SiteSignup.new
|
28
|
+
|
29
|
+
respond_to do |format|
|
30
|
+
format.html # new.html.erb
|
31
|
+
format.xml { render :xml => @site_signup }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# GET /site_signups/1/edit
|
36
|
+
def edit
|
37
|
+
@site_signup = SiteSignup.find(params[:id])
|
38
|
+
end
|
39
|
+
|
40
|
+
# POST /site_signups
|
41
|
+
# POST /site_signups.xml
|
42
|
+
def create
|
43
|
+
@site_signup = SiteSignup.new(params[:site_signup])
|
44
|
+
|
45
|
+
respond_to do |format|
|
46
|
+
if @site_signup.save
|
47
|
+
format.html { redirect_to([:service, @site_signup], :notice => 'Site signup was successfully created.') }
|
48
|
+
format.xml { render :xml => @site_signup, :status => :created, :location => [:service, @site_signup] }
|
49
|
+
else
|
50
|
+
format.html { render :action => "new" }
|
51
|
+
format.xml { render :xml => @site_signup.errors, :status => :unprocessable_entity }
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# PUT /site_signups/1
|
57
|
+
# PUT /site_signups/1.xml
|
58
|
+
def update
|
59
|
+
@site_signup = SiteSignup.find(params[:id])
|
60
|
+
|
61
|
+
respond_to do |format|
|
62
|
+
if @site_signup.update_attributes(params[:site_signup])
|
63
|
+
format.html { redirect_to([:service, @site_signup], :notice => 'Site signup was successfully updated.') }
|
64
|
+
format.xml { head :ok }
|
65
|
+
else
|
66
|
+
format.html { render :action => "edit" }
|
67
|
+
format.xml { render :xml => @site_signup.errors, :status => :unprocessable_entity }
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# DELETE /site_signups/1
|
73
|
+
# DELETE /site_signups/1.xml
|
74
|
+
def destroy
|
75
|
+
@site_signup = SiteSignup.find(params[:id])
|
76
|
+
@site_signup.destroy
|
77
|
+
|
78
|
+
respond_to do |format|
|
79
|
+
format.html { redirect_to(service_site_signups_url) }
|
80
|
+
format.xml { head :ok }
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'service_locator'
|
2
|
+
class SignupService < Service(:crm)
|
3
|
+
puts "@@@@ Site Detail count #{SiteDetail.count}"
|
4
|
+
site_type = SiteDetail.first.site_type unless SiteDetail.first.blank?
|
5
|
+
if site_type && (site_type == "community" || site_type == "ccslocal" || site_type == "ccsmain")
|
6
|
+
self.element_name = "ccslocal_site"
|
7
|
+
self.collection_name = "ccslocal_sites"
|
8
|
+
self.prefix = "/services/"
|
9
|
+
else
|
10
|
+
self.element_name = "site"
|
11
|
+
self.collection_name = "sites"
|
12
|
+
self.prefix = "/services/"
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class SiteDetail < ActiveRecord::Base
|
2
|
+
before_save :downcase_site_url
|
3
|
+
|
4
|
+
|
5
|
+
def self.get_site_id
|
6
|
+
result = self.first.site_id.to_i unless self.first.blank?
|
7
|
+
return result
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.get_url
|
11
|
+
@site_url ||= self.first.site_url.downcase unless self.first.blank?
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
def downcase_site_url
|
16
|
+
self.site_url.downcase! unless self.site_url.blank?
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
class SiteSignup < ActiveRecord::Base
|
2
|
+
validates_format_of :email_address, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i
|
3
|
+
validates :email_address, :name, :requested_url, :presence => true
|
4
|
+
# validates_format_of :requested_url, :with => /^(?:[a-z0-9]_?)*[a-z](?:_?[a-z0-9])*$/i
|
5
|
+
validate :uniqueness_and_format_of_url
|
6
|
+
|
7
|
+
private
|
8
|
+
|
9
|
+
def uniqueness_and_format_of_url
|
10
|
+
website_url = "http://www.#{requested_url}.cloudcitysites.net"
|
11
|
+
reg = Regexp.new(/^[\w\#{-}]*$/)
|
12
|
+
|
13
|
+
result = reg.match(requested_url)? true : false
|
14
|
+
if !result
|
15
|
+
errors.add(:requested_url, 'Invalid url format! Use leters, numbers and _ ONLY')
|
16
|
+
return result
|
17
|
+
else
|
18
|
+
domain_names = get_all_domain_names
|
19
|
+
if domain_names
|
20
|
+
domain_names.each do |domain|
|
21
|
+
if requested_url == domain
|
22
|
+
result = false
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
result
|
28
|
+
end
|
29
|
+
|
30
|
+
def get_all_domain_names
|
31
|
+
result = SignupService.find(:all)
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<%= form_for([:service, @site_detail]) do |f| %>
|
2
|
+
<% if @site_detail.errors.any? %>
|
3
|
+
<div id="error_explanation">
|
4
|
+
<h2><%= pluralize(@site_detail.errors.count, "error") %> prohibited this site_detail from being saved:</h2>
|
5
|
+
|
6
|
+
<ul>
|
7
|
+
<% @site_detail.errors.full_messages.each do |msg| %>
|
8
|
+
<li><%= msg %></li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<div class="field">
|
15
|
+
<%= f.label :site_id %><br />
|
16
|
+
<%= f.text_field :site_id %>
|
17
|
+
</div>
|
18
|
+
<div class="field">
|
19
|
+
<%= f.label :site_url %><br />
|
20
|
+
<%= f.text_field :site_url %>
|
21
|
+
</div>
|
22
|
+
<div class="field">
|
23
|
+
<%= f.label :paypal_email_address %><br />
|
24
|
+
<%= f.text_field :paypal_email_address %>
|
25
|
+
</div>
|
26
|
+
<div class="field">
|
27
|
+
<%= f.label :owner_ip_address %><br />
|
28
|
+
<%= f.text_field :owner_ip_address %>
|
29
|
+
</div>
|
30
|
+
<div class="field">
|
31
|
+
<%= f.label :site_type %><br />
|
32
|
+
<%= f.text_field :site_type %>
|
33
|
+
</div>
|
34
|
+
<div class="actions">
|
35
|
+
<%= f.submit %>
|
36
|
+
</div>
|
37
|
+
<% end %>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<h1>Listing site_details</h1>
|
2
|
+
|
3
|
+
<table>
|
4
|
+
<tr>
|
5
|
+
<th>Site</th>
|
6
|
+
<th>Site url</th>
|
7
|
+
<th>Paypal email address</th>
|
8
|
+
<th>Owner ip address</th>
|
9
|
+
<th>Site type</th>
|
10
|
+
<th></th>
|
11
|
+
<th></th>
|
12
|
+
<th></th>
|
13
|
+
</tr>
|
14
|
+
|
15
|
+
<% @site_details.each do |site_detail| %>
|
16
|
+
<tr>
|
17
|
+
<td><%= site_detail.site_id %></td>
|
18
|
+
<td><%= site_detail.site_url %></td>
|
19
|
+
<td><%= site_detail.paypal_email_address %></td>
|
20
|
+
<td><%= site_detail.owner_ip_address %></td>
|
21
|
+
<td><%= site_detail.site_type %></td>
|
22
|
+
<td><%= link_to 'Show', [:service, site_detail] %></td>
|
23
|
+
<td><%= link_to 'Edit', edit_service_site_detail_path(site_detail) %></td>
|
24
|
+
<td><%= link_to 'Destroy', [:service, site_detail], :confirm => 'Are you sure?', :method => :delete %></td>
|
25
|
+
</tr>
|
26
|
+
<% end %>
|
27
|
+
</table>
|
28
|
+
|
29
|
+
<br />
|
30
|
+
|
31
|
+
<%= link_to 'New Site detail', new_site_detail_path %>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
2
|
+
|
3
|
+
<p>
|
4
|
+
<b>Site:</b>
|
5
|
+
<%= @site_detail.site_id %>
|
6
|
+
</p>
|
7
|
+
|
8
|
+
<p>
|
9
|
+
<b>Site url:</b>
|
10
|
+
<%= @site_detail.site_url %>
|
11
|
+
</p>
|
12
|
+
|
13
|
+
<p>
|
14
|
+
<b>Paypal email address:</b>
|
15
|
+
<%= @site_detail.paypal_email_address %>
|
16
|
+
</p>
|
17
|
+
|
18
|
+
<p>
|
19
|
+
<b>Owner ip address:</b>
|
20
|
+
<%= @site_detail.owner_ip_address %>
|
21
|
+
</p>
|
22
|
+
|
23
|
+
<p>
|
24
|
+
<b>Site type:</b>
|
25
|
+
<%= @site_detail.site_type %>
|
26
|
+
</p>
|
27
|
+
|
28
|
+
|
29
|
+
<%= link_to 'Edit', edit_service_site_detail_path(@site_detail) %> |
|
30
|
+
<%= link_to 'Back', service_site_details_path %>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<%= form_for(@site_signup) do |f| %>
|
2
|
+
<% if @site_signup.errors.any? %>
|
3
|
+
<div id="error_explanation">
|
4
|
+
<h2><%= pluralize(@site_signup.errors.count, "error") %> prohibited this site_signup from being saved:</h2>
|
5
|
+
|
6
|
+
<ul>
|
7
|
+
<% @site_signup.errors.full_messages.each do |msg| %>
|
8
|
+
<li><%= msg %></li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<div class="field">
|
15
|
+
<%= f.label :name %><br />
|
16
|
+
<%= f.text_field :name %>
|
17
|
+
</div>
|
18
|
+
<div class="field">
|
19
|
+
<%= f.label :email_address %><br />
|
20
|
+
<%= f.text_field :email_address %>
|
21
|
+
</div>
|
22
|
+
<div class="field">
|
23
|
+
<%= f.label :request_url %><br />
|
24
|
+
<%= f.text_field :requested_url %>
|
25
|
+
</div>
|
26
|
+
<div class="field">
|
27
|
+
<%= f.label :active %><br />
|
28
|
+
<%= f.check_box :active %>
|
29
|
+
</div>
|
30
|
+
<div class="actions">
|
31
|
+
<%= f.submit %>
|
32
|
+
</div>
|
33
|
+
<% end %>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<h1>Listing site_signups</h1>
|
2
|
+
|
3
|
+
<table>
|
4
|
+
<tr>
|
5
|
+
<th>Name</th>
|
6
|
+
<th>Email address</th>
|
7
|
+
<th>Request url</th>
|
8
|
+
<th>Active</th>
|
9
|
+
<th></th>
|
10
|
+
<th></th>
|
11
|
+
<th></th>
|
12
|
+
</tr>
|
13
|
+
|
14
|
+
<% @site_signups.each do |site_signup| %>
|
15
|
+
<tr>
|
16
|
+
<td><%= site_signup.name %></td>
|
17
|
+
<td><%= site_signup.email_address %></td>
|
18
|
+
<td><%= site_signup.requested_url %></td>
|
19
|
+
<td><%= site_signup.active %></td>
|
20
|
+
<td><%= link_to 'Show', site_signup %></td>
|
21
|
+
<td><%= link_to 'Edit', edit_site_signup_path(site_signup) %></td>
|
22
|
+
<td><%= link_to 'Destroy', site_signup, :confirm => 'Are you sure?', :method => :delete %></td>
|
23
|
+
</tr>
|
24
|
+
<% end %>
|
25
|
+
</table>
|
26
|
+
|
27
|
+
<br />
|
28
|
+
|
29
|
+
<%= link_to 'New Site signup', new_site_signup_path %>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
2
|
+
|
3
|
+
<p>
|
4
|
+
<b>Name:</b>
|
5
|
+
<%= @site_signup.name %>
|
6
|
+
</p>
|
7
|
+
|
8
|
+
<p>
|
9
|
+
<b>Email address:</b>
|
10
|
+
<%= @site_signup.email_address %>
|
11
|
+
</p>
|
12
|
+
|
13
|
+
<p>
|
14
|
+
<b>Requested url:</b>
|
15
|
+
<%= @site_signup.requested_url %>
|
16
|
+
</p>
|
17
|
+
|
18
|
+
<p>
|
19
|
+
<b>Active:</b>
|
20
|
+
<%= @site_signup.active %>
|
21
|
+
</p>
|
22
|
+
|
23
|
+
|
24
|
+
<%= link_to 'Edit', edit_site_signup_path(@site_signup) %> |
|
25
|
+
<%= link_to 'Back', site_signups_path %>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "ccs_core_gem/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "ccs_core_gem"
|
7
|
+
s.version = CcsCoreGem::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["James West"]
|
10
|
+
s.email = ["jamesw@cloudcitysites.com"]
|
11
|
+
s.homepage = "http://www.ccslocal.com"
|
12
|
+
s.summary = %q{Core site details functionality for ccs local}
|
13
|
+
s.description = %q{A gem providing site details and site signup functionality specific to ccslocal websites}
|
14
|
+
|
15
|
+
s.rubyforge_project = "ccs_core_gem"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib", "app"]
|
21
|
+
end
|
data/config/routes.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Rails.application.routes.draw do
|
2
|
+
resources :accounts, :controller => 'authr/accounts', :only => [:new, :create]
|
3
|
+
# CcsCore::Application.routes.draw do
|
4
|
+
|
5
|
+
resources :site_signups
|
6
|
+
|
7
|
+
resources :site_details
|
8
|
+
|
9
|
+
namespace :service do
|
10
|
+
resources :site_details
|
11
|
+
resources :site_signups
|
12
|
+
end
|
13
|
+
end
|
data/config/services.yml
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
development:
|
2
|
+
crm: http://amberleaf:includes1@localhost:3002/
|
3
|
+
site: https://cloudcitysites.com/
|
4
|
+
reports: localhost:3001/
|
5
|
+
|
6
|
+
production:
|
7
|
+
crm: https://amberleaf:includes1@cloudcityservices.com/
|
8
|
+
site: https://cloudcitysites.com/
|
9
|
+
reports: reports.example.com/
|
10
|
+
|
11
|
+
test:
|
12
|
+
crm: http://amberleaf:includes1@localhost:3002/
|
13
|
+
reports: reports.example.com/
|
14
|
+
|
15
|
+
cucumber:
|
16
|
+
crm: http://amberleaf:includes1@localhost:3002/
|
17
|
+
reports: reports.example.com/
|
Binary file
|
data/db/schema.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# This file is auto-generated from the current state of the database. Instead
|
2
|
+
# of editing this file, please use the migrations feature of Active Record to
|
3
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
4
|
+
#
|
5
|
+
# Note that this schema.rb definition is the authoritative source for your
|
6
|
+
# database schema. If you need to create the application database on another
|
7
|
+
# system, you should be using db:schema:load, not running all the migrations
|
8
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
9
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
10
|
+
#
|
11
|
+
# It's strongly recommended to check this file into your version control system.
|
12
|
+
|
13
|
+
ActiveRecord::Schema.define(:version => 20110112101405) do
|
14
|
+
|
15
|
+
create_table "site_details", :force => true do |t|
|
16
|
+
t.integer "site_id"
|
17
|
+
t.string "site_url"
|
18
|
+
t.string "paypal_email_address"
|
19
|
+
t.string "owner_ip_address"
|
20
|
+
t.string "site_type"
|
21
|
+
t.datetime "created_at"
|
22
|
+
t.datetime "updated_at"
|
23
|
+
end
|
24
|
+
|
25
|
+
create_table "site_signups", :force => true do |t|
|
26
|
+
t.string "name"
|
27
|
+
t.string "email_address"
|
28
|
+
t.string "requested_url"
|
29
|
+
t.boolean "active"
|
30
|
+
t.datetime "created_at"
|
31
|
+
t.datetime "updated_at"
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
data/db/seeds.rb
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
# This file should contain all the record creation needed to seed the database with its default values.
|
2
|
+
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
3
|
+
#
|
4
|
+
# Examples:
|
5
|
+
#
|
6
|
+
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
|
7
|
+
# Mayor.create(:name => 'Daley', :city => cities.first)
|
data/db/test.sqlite3
ADDED
Binary file
|
data/lib/ccs_core_gem.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
require 'rails/generators/migration'
|
3
|
+
#require 'rails/generators/create_site_signups'
|
4
|
+
|
5
|
+
class CcsCoreGemGenerator < Rails::Generators::Base
|
6
|
+
include Rails::Generators::Migration
|
7
|
+
|
8
|
+
def self.source_root
|
9
|
+
@source_root ||= File.join(File.dirname(__FILE__), 'templates')
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.next_migration_number(dirname)
|
13
|
+
if ActiveRecord::Base.timestamped_migrations
|
14
|
+
Time.now.utc.strftime("%Y%m%d%H%M%S")
|
15
|
+
else
|
16
|
+
"%.3d" % (current_migration_number(dirname) + 1)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def create_migration_files
|
21
|
+
begin
|
22
|
+
migration_template 'create_site_details.rb', 'db/migrate/create_site_details.rb'
|
23
|
+
rescue
|
24
|
+
end
|
25
|
+
sleep 2
|
26
|
+
begin
|
27
|
+
migration_template 'create_site_signups.rb', 'db/migrate/create_site_signups.rb'
|
28
|
+
rescue
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreateSiteDetails < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :site_details do |t|
|
4
|
+
t.integer :site_id
|
5
|
+
t.string :site_url
|
6
|
+
t.string :paypal_email_address
|
7
|
+
t.string :owner_ip_address
|
8
|
+
t.string :site_type
|
9
|
+
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.down
|
15
|
+
drop_table :site_details
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreateSiteSignups < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :site_signups do |t|
|
4
|
+
t.string :name
|
5
|
+
t.string :email_address
|
6
|
+
t.string :requested_url
|
7
|
+
t.boolean :active
|
8
|
+
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.down
|
14
|
+
drop_table :site_signups
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'active_resource'
|
3
|
+
|
4
|
+
class ServiceLocator
|
5
|
+
|
6
|
+
API_KEY = "kittens"
|
7
|
+
|
8
|
+
def self.services
|
9
|
+
return @services if @services
|
10
|
+
config_file = File.join(Rails.root.to_s, %w[config services.yml])
|
11
|
+
config = YAML.load_file(config_file)
|
12
|
+
@services = config[Rails.env]
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.[](name)
|
16
|
+
"#{services[name.to_s]}"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def Service(name)
|
21
|
+
Class.new(ActiveResource::Base) do
|
22
|
+
self.site = "#{ServiceLocator[name]}"
|
23
|
+
self.user = "amberleaf"
|
24
|
+
self.password = "includes1"
|
25
|
+
self.timeout = 30
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
platform.active=Ruby
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project xmlns="http://www.netbeans.org/ns/project/1">
|
3
|
+
<type>org.netbeans.modules.ruby.rubyproject</type>
|
4
|
+
<configuration>
|
5
|
+
<data xmlns="http://www.netbeans.org/ns/ruby-project/1">
|
6
|
+
<name>ccs_core_gem</name>
|
7
|
+
<source-roots>
|
8
|
+
<root id="src.app.dir"/>
|
9
|
+
<root id="src.lib.dir"/>
|
10
|
+
<root id="src.config.dir"/>
|
11
|
+
<root id="src.db.dir"/>
|
12
|
+
</source-roots>
|
13
|
+
<test-roots/>
|
14
|
+
</data>
|
15
|
+
</configuration>
|
16
|
+
</project>
|
metadata
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ccs_core_gem
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- James West
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-01-13 00:00:00 +00:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description: A gem providing site details and site signup functionality specific to ccslocal websites
|
23
|
+
email:
|
24
|
+
- jamesw@cloudcitysites.com
|
25
|
+
executables: []
|
26
|
+
|
27
|
+
extensions: []
|
28
|
+
|
29
|
+
extra_rdoc_files: []
|
30
|
+
|
31
|
+
files:
|
32
|
+
- .gitignore
|
33
|
+
- Gemfile
|
34
|
+
- Rakefile
|
35
|
+
- app/controllers/application_controller.rb
|
36
|
+
- app/controllers/service/site_details_controller.rb
|
37
|
+
- app/controllers/service/site_signups_controller.rb
|
38
|
+
- app/controllers/service_controller.rb
|
39
|
+
- app/helpers/application_helper.rb
|
40
|
+
- app/helpers/service/site_detail_helper.rb
|
41
|
+
- app/helpers/site_details_helper.rb
|
42
|
+
- app/helpers/site_signups_helper.rb
|
43
|
+
- app/models/signup_service.rb
|
44
|
+
- app/models/site_detail.rb
|
45
|
+
- app/models/site_signup.rb
|
46
|
+
- app/views/layouts/application.html.erb
|
47
|
+
- app/views/service/site_details/_form.html.erb
|
48
|
+
- app/views/service/site_details/edit.html.erb
|
49
|
+
- app/views/service/site_details/index.html.erb
|
50
|
+
- app/views/service/site_details/new.html.erb
|
51
|
+
- app/views/service/site_details/show.html.erb
|
52
|
+
- app/views/service/site_signups/_form.html.erb
|
53
|
+
- app/views/service/site_signups/edit.html.erb
|
54
|
+
- app/views/service/site_signups/index.html.erb
|
55
|
+
- app/views/service/site_signups/new.html.erb
|
56
|
+
- app/views/service/site_signups/show.html.erb
|
57
|
+
- ccs_core_gem.gemspec
|
58
|
+
- config/locales/en.yml
|
59
|
+
- config/routes.rb
|
60
|
+
- config/services.yml
|
61
|
+
- db/development.sqlite3
|
62
|
+
- db/schema.rb
|
63
|
+
- db/seeds.rb
|
64
|
+
- db/test.sqlite3
|
65
|
+
- lib/ccs_core_gem.rb
|
66
|
+
- lib/ccs_core_gem/engine.rb
|
67
|
+
- lib/ccs_core_gem/version.rb
|
68
|
+
- lib/generators/ccs_core_gem/ccs_core_gem_generator.rb
|
69
|
+
- lib/generators/ccs_core_gem/templates/create_site_details.rb
|
70
|
+
- lib/generators/ccs_core_gem/templates/create_site_signups.rb
|
71
|
+
- lib/service_locator.rb
|
72
|
+
- nbproject/private/config.properties
|
73
|
+
- nbproject/private/private.properties
|
74
|
+
- nbproject/private/private.xml
|
75
|
+
- nbproject/private/rake-d.txt
|
76
|
+
- nbproject/project.properties
|
77
|
+
- nbproject/project.xml
|
78
|
+
has_rdoc: true
|
79
|
+
homepage: http://www.ccslocal.com
|
80
|
+
licenses: []
|
81
|
+
|
82
|
+
post_install_message:
|
83
|
+
rdoc_options: []
|
84
|
+
|
85
|
+
require_paths:
|
86
|
+
- lib
|
87
|
+
- app
|
88
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
hash: 3
|
94
|
+
segments:
|
95
|
+
- 0
|
96
|
+
version: "0"
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
hash: 3
|
103
|
+
segments:
|
104
|
+
- 0
|
105
|
+
version: "0"
|
106
|
+
requirements: []
|
107
|
+
|
108
|
+
rubyforge_project: ccs_core_gem
|
109
|
+
rubygems_version: 1.3.7
|
110
|
+
signing_key:
|
111
|
+
specification_version: 3
|
112
|
+
summary: Core site details functionality for ccs local
|
113
|
+
test_files: []
|
114
|
+
|