-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
103 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ coverage.* | |
data/* | ||
!data/.htaccess | ||
log | ||
pkg | ||
tmp | ||
rdoc | ||
index.rdf | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
source 'https://rubygems.org' | ||
|
||
gem 'tdiary' unless File.exist?('tdiary.rb') | ||
|
||
gem 'rake' | ||
|
||
gem 'rack' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env ruby | ||
lib = File.expand_path('../../', __FILE__) | ||
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) | ||
|
||
require 'tdiary/cli' | ||
|
||
TDiary::CLI.start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# coding: utf-8 | ||
lib = File.expand_path('../', __FILE__) | ||
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) | ||
require 'tdiary/version' | ||
|
||
Gem::Specification.new do |spec| | ||
spec.name = "tdiary" | ||
spec.version = TDiary::VERSION | ||
spec.authors = ["TADA Tadashi", "SHIBATA Hiroshi", "MATSUOKA Kohei"] | ||
spec.email = ["support@tdiary.org"] | ||
spec.summary = %q{a TSUKKOMI-able Web-log} | ||
spec.description = %q{tDiary is so called Weblog.} | ||
spec.homepage = "http://www.tdiary.org/" | ||
spec.license = "GPL-2" | ||
|
||
spec.files = `git ls-files`.split($/) | ||
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } | ||
spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) | ||
spec.require_paths = ["."] | ||
|
||
spec.add_runtime_dependency 'thor' | ||
|
||
spec.add_development_dependency "bundler", "~> 1.3" | ||
spec.add_development_dependency "rake" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# coding: utf-8 | ||
require 'thor' | ||
require 'tdiary' | ||
|
||
module TDiary | ||
class CLI < Thor | ||
include Thor::Actions | ||
|
||
def self.source_root | ||
TDiary.root | ||
end | ||
|
||
desc "new DIR_NAME", "Create a new tDiary directory" | ||
def new(name) | ||
target = File.join(Dir.pwd, name) | ||
empty_directory(target) | ||
empty_directory(File.join(target, 'public')) | ||
%w(README.md Gemfile config.ru tdiary.conf.beginner | ||
tdiary.conf.sample tdiary.conf.sample-en).each do |file| | ||
copy_file(file, File.join(target, file)) | ||
end | ||
copy_file('tdiary.conf.beginner', File.join(target, 'tdiary.conf')) | ||
directory('doc', File.join(target, 'doc')) | ||
inside(target) do | ||
run('bundle install --without test development') | ||
run('tdiary htpasswd') | ||
end | ||
say 'install finished', :green | ||
say 'run `bundle exec rackup` to start server', :green | ||
end | ||
|
||
desc "htpasswd", "Create a .htpasswd file" | ||
def htpasswd | ||
require 'webrick/httpauth/htpasswd' | ||
say "Input your username/password" | ||
print 'Username: ' | ||
ARGV.replace([]) | ||
username = gets().chop | ||
print 'New password: ' | ||
system "stty -echo" | ||
password = $stdin.gets.chop | ||
puts | ||
print 'Re-type new password: ' | ||
password2 = $stdin.gets.chop | ||
puts | ||
system "stty echo" | ||
if password != password2 | ||
raise StandardError, 'password verification error' | ||
end | ||
htpasswd = WEBrick::HTTPAuth::Htpasswd.new('.htpasswd') | ||
htpasswd.set_passwd(nil, username, password) | ||
htpasswd.flush | ||
end | ||
|
||
desc "version", "Prints the tDiary's version information" | ||
def version | ||
say "tdiary #{TDiary::VERSION}" | ||
end | ||
map %w(-v --version) => :version | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module TDiary | ||
VERSION = '3.2.2.20130502' | ||
end |