nautilus 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/Gemfile +4 -0
- data/README.markdown +69 -0
- data/Rakefile +2 -0
- data/bin/nautilus +21 -0
- data/lib/nautilus/create.rb +62 -0
- data/lib/nautilus/errors.rb +12 -0
- data/lib/nautilus/version.rb +3 -0
- data/lib/nautilus.rb +24 -0
- data/nautilus.gemspec +22 -0
- data/spec/spec_helper.rb +1 -0
- metadata +91 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.markdown
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
# Welcome to Nautilus
|
2
|
+
|
3
|
+
This Shell program is meant to be a template to get a team up and started
|
4
|
+
as soon as possible.
|
5
|
+
|
6
|
+
|
7
|
+
## Getting Started
|
8
|
+
|
9
|
+
1. Export the Project
|
10
|
+
|
11
|
+
2. bundle install
|
12
|
+
|
13
|
+
3. rake db:create:all
|
14
|
+
|
15
|
+
4. rake db:migrate
|
16
|
+
|
17
|
+
2. Start Coding
|
18
|
+
|
19
|
+
## Configurations To Be Mindful
|
20
|
+
|
21
|
+
Change the following when starting the application
|
22
|
+
|
23
|
+
### AWS SES Settings
|
24
|
+
|
25
|
+
* `application.rb` or specific environment file
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
config.action_mailer.delivery_method = :ses
|
29
|
+
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
|
30
|
+
```
|
31
|
+
|
32
|
+
* `config/initializers/amazone_ses_config.rb` for credentials (default set the ENV vars)
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
ActionMailer::Base.add_delivery_method :ses, AWS::SES::Base,
|
36
|
+
:access_key_id => ENV['AMAZON_ACCESS_KEY'],
|
37
|
+
:secret_access_key => ENV['AMAZON_SECRET_KEY']
|
38
|
+
```
|
39
|
+
|
40
|
+
* Amazon SES will not send emails unless it is from an authorized "from", remember to
|
41
|
+
set up the mailer_sender in `config/initializers/clearance.rb`
|
42
|
+
|
43
|
+
### Clearance Overrides
|
44
|
+
|
45
|
+
Clearance is used as the base user admin module. Some overrides have been supplied:
|
46
|
+
* `routes.rb`
|
47
|
+
* `config/initializers/admin_authentication.rb`
|
48
|
+
|
49
|
+
A default admin user id has been provided as:
|
50
|
+
* id: `admin@example.com`
|
51
|
+
* pw: `abc123`
|
52
|
+
|
53
|
+
Change this after first time install!!
|
54
|
+
|
55
|
+
|
56
|
+
# Standards
|
57
|
+
In order to facilitate rapid development we use the following standards:
|
58
|
+
|
59
|
+
* HTML/CSS/JavaScript for UI
|
60
|
+
* Authentication: thoughtbot/clearance
|
61
|
+
* CSS is based on blueprint-css as a framework for developers. Designers to code in this context
|
62
|
+
* Charting: Javascript SVG Based and Open Source
|
63
|
+
* Raphel based
|
64
|
+
* https://github.com/uiteoi/ico
|
65
|
+
* http://g.raphaeljs.com
|
66
|
+
* Others:
|
67
|
+
* http://code.google.com/p/flot/
|
68
|
+
* http://vis.stanford.edu/protovis/
|
69
|
+
* http://thejit.org/demos/
|
data/Rakefile
ADDED
data/bin/nautilus
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'rubygems'
|
3
|
+
require 'nautilus'
|
4
|
+
include Nautilus::Errors
|
5
|
+
|
6
|
+
def usage
|
7
|
+
"Usage: #{File.basename(__FILE__)} create new_project_name"
|
8
|
+
end
|
9
|
+
|
10
|
+
case ARGV[0]
|
11
|
+
when 'create', '--create'
|
12
|
+
begin
|
13
|
+
Nautilus::Create.run!(ARGV[1])
|
14
|
+
rescue Nautilus::InvalidInput => e
|
15
|
+
error_with_message(e.message)
|
16
|
+
end
|
17
|
+
when 'help', '--help'
|
18
|
+
puts usage
|
19
|
+
else
|
20
|
+
puts "Unknown subcommand: #{ARGV[0]}\n#{usage}"
|
21
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + "/errors")
|
3
|
+
|
4
|
+
module Nautilus
|
5
|
+
class Create
|
6
|
+
attr_accessor :project_path
|
7
|
+
|
8
|
+
def self.run!(project_path)
|
9
|
+
creator = self.new(project_path)
|
10
|
+
creator.create_project!
|
11
|
+
end
|
12
|
+
|
13
|
+
def initialize(project_path)
|
14
|
+
self.project_path = project_path
|
15
|
+
validate_project_path
|
16
|
+
validate_project_name
|
17
|
+
end
|
18
|
+
|
19
|
+
def create_project!
|
20
|
+
Nautilus.run("git clone git@github.com:newtonlabs/nautilus-project.git #{project_path}")
|
21
|
+
|
22
|
+
Dir.glob("#{project_path}/**/*").each do |file|
|
23
|
+
Nautilus.search_and_replace(file, "nautilus", project_path)
|
24
|
+
Nautilus.search_and_replace(file, "Nautilus", project_path.capitalize)
|
25
|
+
end
|
26
|
+
|
27
|
+
# Clear git history
|
28
|
+
FileUtils.rm_rf ("#{project_path}/.git")
|
29
|
+
|
30
|
+
# TODO Change the secret_token.rb
|
31
|
+
# Nautilus.search_and_replace secret_token.rb
|
32
|
+
|
33
|
+
Dir.chdir(project_path) or fail("Couldn't change to #{project_path}")
|
34
|
+
|
35
|
+
rake_cmd = RUBY_PLATFORM =~ /mswin/ ? "rake.bat" : "rake"
|
36
|
+
|
37
|
+
Nautilus.run("#{rake_cmd} db:create")
|
38
|
+
Nautilus.run("#{rake_cmd} db:create RAILS_ENV=test")
|
39
|
+
Nautilus.run("#{rake_cmd} db:migrate")
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def validate_project_name
|
45
|
+
project_name = File.basename(project_path)
|
46
|
+
unless project_name =~ /^[a-z0-9_]+$/
|
47
|
+
raise InvalidInput.new("Project name must only contain [a-z0-9_]")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def validate_project_path
|
52
|
+
base_directory = Dir.pwd
|
53
|
+
full_path = File.join(base_directory, project_path)
|
54
|
+
|
55
|
+
# This is for the common case for the user's convenience; the race
|
56
|
+
# condition can still occur.
|
57
|
+
if File.exists?(full_path)
|
58
|
+
raise InvalidInput.new("Project directory (#{project_path}) already exists")
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
data/lib/nautilus.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
module Nautilus
|
2
|
+
def self.run(cmd)
|
3
|
+
puts "Running '#{cmd}'"
|
4
|
+
out = `#{cmd}`
|
5
|
+
if $? != 0
|
6
|
+
fail "Command #{cmd} failed: #$?\n#{out}"
|
7
|
+
end
|
8
|
+
out
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.search_and_replace(file, search, replace)
|
12
|
+
if File.file?(file)
|
13
|
+
contents = File.read(file)
|
14
|
+
if contents[search]
|
15
|
+
puts "Replacing #{search} with #{replace} in #{file}"
|
16
|
+
contents.gsub!(search, replace)
|
17
|
+
File.open(file, "w") { |f| f << contents }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
require 'nautilus/errors'
|
24
|
+
require 'nautilus/create'
|
data/nautilus.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "nautilus/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.add_development_dependency "rspec"
|
7
|
+
s.name = "nautilus"
|
8
|
+
s.version = Nautilus::VERSION
|
9
|
+
s.platform = Gem::Platform::RUBY
|
10
|
+
s.authors = ["Thomas Newton"]
|
11
|
+
s.email = ["tnewton@gmail.comß"]
|
12
|
+
s.homepage = ""
|
13
|
+
s.summary = %q{Create a shell project to get started rapidly}
|
14
|
+
s.description = %q{Get developing quickly}
|
15
|
+
|
16
|
+
s.rubyforge_project = "nautilus"
|
17
|
+
|
18
|
+
s.files = `git ls-files`.split("\n")
|
19
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
20
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
21
|
+
s.require_paths = ["lib"]
|
22
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'nautilus'
|
metadata
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: nautilus
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Thomas Newton
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-05-18 00:00:00 -04:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: rspec
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
type: :development
|
34
|
+
version_requirements: *id001
|
35
|
+
description: Get developing quickly
|
36
|
+
email:
|
37
|
+
- "tnewton@gmail.com\xC3\x9F"
|
38
|
+
executables:
|
39
|
+
- nautilus
|
40
|
+
extensions: []
|
41
|
+
|
42
|
+
extra_rdoc_files: []
|
43
|
+
|
44
|
+
files:
|
45
|
+
- .gitignore
|
46
|
+
- Gemfile
|
47
|
+
- README.markdown
|
48
|
+
- Rakefile
|
49
|
+
- bin/nautilus
|
50
|
+
- lib/nautilus.rb
|
51
|
+
- lib/nautilus/create.rb
|
52
|
+
- lib/nautilus/errors.rb
|
53
|
+
- lib/nautilus/version.rb
|
54
|
+
- nautilus.gemspec
|
55
|
+
- spec/spec_helper.rb
|
56
|
+
has_rdoc: true
|
57
|
+
homepage: ""
|
58
|
+
licenses: []
|
59
|
+
|
60
|
+
post_install_message:
|
61
|
+
rdoc_options: []
|
62
|
+
|
63
|
+
require_paths:
|
64
|
+
- lib
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
hash: 3
|
71
|
+
segments:
|
72
|
+
- 0
|
73
|
+
version: "0"
|
74
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
hash: 3
|
80
|
+
segments:
|
81
|
+
- 0
|
82
|
+
version: "0"
|
83
|
+
requirements: []
|
84
|
+
|
85
|
+
rubyforge_project: nautilus
|
86
|
+
rubygems_version: 1.3.7
|
87
|
+
signing_key:
|
88
|
+
specification_version: 3
|
89
|
+
summary: Create a shell project to get started rapidly
|
90
|
+
test_files:
|
91
|
+
- spec/spec_helper.rb
|