Skip to content

Commit

Permalink
Merge 8288c5d into b9360ea
Browse files Browse the repository at this point in the history
  • Loading branch information
machu committed May 1, 2013
2 parents b9360ea + 8288c5d commit 6c14348
Show file tree
Hide file tree
Showing 9 changed files with 103 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ coverage.*
data/*
!data/.htaccess
log
pkg
tmp
rdoc
index.rdf
Expand Down
2 changes: 2 additions & 0 deletions Gemfile
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'
Expand Down
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ require File.expand_path('../tdiary/environment', __FILE__)

require 'rake'
require 'rake/clean'
require 'bundler/gem_tasks'

CLEAN.include(
"tmp",
Expand Down
7 changes: 7 additions & 0 deletions bin/tdiary
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
2 changes: 1 addition & 1 deletion config.ru
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ end

map "#{base_dir}/assets" do
environment = Sprockets::Environment.new
%w(js theme).each {|path| environment.append_path path }
%w(js theme).each {|path| environment.append_path File.join(TDiary.root, path) }

# if you need to auto compilation for CoffeeScript
# require 'tdiary/rack/assets/precompile'
Expand Down
25 changes: 25 additions & 0 deletions tdiary.gemspec
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
3 changes: 2 additions & 1 deletion tdiary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
You can redistribute it and/or modify it under GPL2.
=end

TDIARY_VERSION = '3.2.2'
require 'tdiary/version'
TDIARY_VERSION = TDiary::VERSION

$:.unshift File.join(File::dirname(__FILE__), '/misc/lib').untaint
Dir["#{File::dirname(__FILE__) + '/vendor/*/lib'}"].each {|dir| $:.unshift dir.untaint }
Expand Down
61 changes: 61 additions & 0 deletions tdiary/cli.rb
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
3 changes: 3 additions & 0 deletions tdiary/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module TDiary
VERSION = '3.2.2.20130502'
end

0 comments on commit 6c14348

Please sign in to comment.