Skip to content

Commit

Permalink
Merge branch 'release/v0.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
roothybrid7 committed Jun 6, 2011
2 parents 409520f + 35c7f5b commit 38561c5
Show file tree
Hide file tree
Showing 162 changed files with 26,851 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitignore
@@ -0,0 +1,9 @@
.bundle
Gemfile.lock
db/*.sqlite3
db/seeds*.rb
log/*.log
tmp/*
!tmp/README
vendor/bundle/*
nohup.out
1 change: 1 addition & 0 deletions .rspec
@@ -0,0 +1 @@
--colour
62 changes: 62 additions & 0 deletions Gemfile
@@ -0,0 +1,62 @@
source 'http://rubygems.org'

gem 'rails', '3.0.7'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'mongoid', '~> 2.0'
gem 'bson_ext', '~> 1.3'
gem 'SystemTimer'
gem 'rails3-generators'
gem 'jquery-rails'
gem 'mongoid_i18n'
gem 'i18n_generators'
gem 'haml-rails'
gem 'devise'
gem 'devise_invitable'
gem 'will_paginate'

gem 'unicorn'
gem 'fastthread'
gem 'dnsruby'

# Backend
gem 'wirble'
gem 'rake', '~> 0.8.7'

group :development, :test do
gem 'erb2haml'
gem 'mongoid-rspec'
gem 'rspec-rails'
gem 'rspec'
gem 'capybara'
gem 'database_cleaner'
gem 'cucumber-rails'
gem 'cucumber'
gem 'spork'
gem 'launchy'
gem 'ruby-debug'
end
# Use unicorn as the web server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
# gem 'ruby-debug'
# gem 'ruby-debug19', :require => 'ruby-debug'

# Bundle the extra gems:
# gem 'bj'
# gem 'nokogiri'
# gem 'sqlite3-ruby', :require => 'sqlite3'
# gem 'aws-s3', :require => 'aws/s3'

# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
# group :development, :test do
# gem 'webrat'
# end
68 changes: 68 additions & 0 deletions README.md
@@ -0,0 +1,68 @@
= BeagleNsupdate

Nsupdate Web console(DynamicDNS)

== Requirements

* Ruby v1.8.7
* Rails v3.x.x
* Mongodb v1.8.x

== Step

1. Set up:

$ bundle install --path vendor/bundle
$ cp db/seeds.rb.sample db/seeds.rb
$ vim db/seeds.rb

# db/seeds.rb
def adduser(email, password)
@user = User.invite!(:email => email) do |u|
u.skip_invitation = true
end
User.accept_invitation!(:invitation_token => @user.invitation_token, :password => password, :password_confirmation => password)

puts "Created User #{email} with password #{password}"
end

adduser("admin@example.com", "passwd") # Add initial user

2. Add initial user
$ rake db:seed

3. Modified environment settings

# config/initializers/devise.rb
[...]
Devise.setup do |config|
# ==> Mailer Configuration
# Configure the e-mail address which will be shown in DeviseMailer.
config.mailer_sender = "beagle-nsupdate@prod.example.com" #<= modify the mail address

# Configure the class responsible to send e-mails.
# config.mailer = "Devise::Mailer"
[...]

if development:

# config/environments/development.rb
[...]
#config.action_mailer.raise_delivery_errors = false
config.action_mailer.default_url_options = {:host => 'dev-server:3000'} #<= modify the app url
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true

if production:

# config/environments/production.rb
[...]
#config.action_mailer.raise_delivery_errors = false
config.action_mailer.default_url_options = {:host => 'prod-server.prod.domain.com'} #<= modify the app url
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true


4. Launch

$ rails server
7 changes: 7 additions & 0 deletions Rakefile
@@ -0,0 +1,7 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require File.expand_path('../config/application', __FILE__)
require 'rake'

BeagleNsupdate::Application.load_tasks
1 change: 1 addition & 0 deletions VERSION
@@ -0,0 +1 @@
v0.1.0
17 changes: 17 additions & 0 deletions app/controllers/application_controller.rb
@@ -0,0 +1,17 @@
class ApplicationController < ActionController::Base
before_filter :authenticate_user!

protect_from_forgery

protected

def authenticate_inviter!
authenticate_user!
end

private

def detect_locale
I18n.locale = request.headers['Accept-Language'].scan(/^[a-z]{2}/).first
end
end
6 changes: 6 additions & 0 deletions app/controllers/dashboard_controller.rb
@@ -0,0 +1,6 @@
class DashboardController < ApplicationController
def index
@users = User.all
end

end
94 changes: 94 additions & 0 deletions app/controllers/groups_controller.rb
@@ -0,0 +1,94 @@
class GroupsController < ApplicationController
respond_to :html, :xml, :json
before_filter :load_group, :only => [:show, :edit, :update, :destroy]
before_filter :load_groups, :only => [:index]

protected
def load_group
@group = Group.find(params[:id])
end

def load_groups
@search_form = SearchForm.new(params[:search_form])

if @search_form.q.present?
@groups = Group.name_matches(@search_form.q)
else
@groups = Group.all
end

@groups = @groups.asc(:name)
@groups = @groups.paginate(:page => params[:page], :per_page => params[:per_page]) if params[:per_page]
end

public
# GET /groups
# GET /groups.xml
def index
respond_with @groups
end

# GET /groups/1
# GET /groups/1.xml
def show
respond_with @group
end

# GET /groups/new
# GET /groups/new.xml
def new
@group = Group.new

respond_with @group
end

# GET /groups/1/edit
def edit
end

# POST /groups
# POST /groups.xml
def create
@group = Group.new(params[:group])

respond_to do |format|
if @group.save
format.html { redirect_to(@group, :notice => 'Group was successfully created.') }
format.xml { render :xml => @group, :status => :created, :location => @group }
format.json { render :json => @group, :status => :created, :location => @group }
else
format.html { render :action => "new" }
format.xml { render :xml => @group.errors, :status => :unprocessable_entity }
format.json { render :json => @group.errors, :status => :unprocessable_entity }
end
end
end

# PUT /groups/1
# PUT /groups/1.xml
def update
respond_to do |format|
if @group.update_attributes(params[:group])
format.html { redirect_to(@group, :notice => 'Group was successfully updated.') }
format.xml { head :ok }
format.json { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @group.errors, :status => :unprocessable_entity }
format.json { render :json => @group.errors, :status => :unprocessable_entity }
end
end
end

# DELETE /groups/1
# DELETE /groups/1.xml
def destroy
@group.destroy

respond_to do |format|
format.html { redirect_to :back }
format.xml { head :ok }
format.json { head :ok }
end
end
end

0 comments on commit 38561c5

Please sign in to comment.