mdpreview 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 ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'http://ruby.taobao.org'
2
+
3
+ # Specify your gem's dependencies in mdpreview.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 shiren1118
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Mdpreview
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'mdpreview'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install mdpreview
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,58 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ namespace :mdp do
4
+ desc 'setup devise example migrating db and creating a default user'
5
+ task :clean do
6
+ ['d.txt'].each{|x|
7
+ File.delete(x);
8
+ }
9
+ end
10
+
11
+ desc 'setup devise example migrating db and creating a default user'
12
+ task :setup => ['db:drop', 'db:create', 'db:migrate', 'environment'] do
13
+ user = User.create! do |u|
14
+ u.email = 'user@test.com'
15
+ u.password = 'user123'
16
+ u.password_confirmation = 'user123'
17
+ u.ensure_authentication_token!
18
+ end
19
+ user.confirm!
20
+ puts 'New user created!'
21
+ puts 'Email : ' << user.email
22
+ puts 'Password: ' << user.password
23
+
24
+ admin = Admin.create! do |u|
25
+ u.email = 'admin@test.com'
26
+ u.password = 'admin123'
27
+ u.password_confirmation = 'admin123'
28
+ end
29
+ #admin.confirm!
30
+ puts 'New admin created!'
31
+ puts 'Email : ' << admin.email
32
+ puts 'Password: ' << admin.password
33
+ end
34
+
35
+ # desc "Test lib source"
36
+ # Rake::TestTask.new(:lib) do |t|
37
+ # t.libs << "test"
38
+ # t.pattern = 'test/lib/**/*_test.rb'
39
+ # t.verbose = true
40
+ # end
41
+ end
42
+
43
+
44
+ # namespace :test do
45
+ # desc "Test lib source"
46
+ # Rake::TestTask.new(:lib) do |t|
47
+ # t.libs << "test"
48
+ # t.pattern = 'test/lib/**/*_test.rb'
49
+ # t.verbose = true
50
+ # end
51
+ #
52
+ # end
53
+
54
+ # lib_task = Rake::Task["test:lib"]
55
+ # test_task = Rake::Task[:test]
56
+ # test_task.enhance { lib_task.invoke }
57
+
58
+
data/bin/mdpreview ADDED
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'mdpreview'
4
+ # p ARGV
5
+ # puts Mdpreview.hi(ARGV)
6
+
7
+ require 'optparse'
8
+
9
+ options = {}
10
+ option_parser = OptionParser.new do |opts|
11
+ # 这里是这个命令行工具的帮助信息
12
+ opts.banner = 'open and modify markdown file of the command line tool.'
13
+
14
+ # # Option 作为switch,不带argument,用于将switch设置成true或false
15
+ # options[:switch] = false
16
+ # # 下面第一项是Short option(没有可以直接在引号间留空),第二项是Long option,第三项是对Option的描述
17
+ # opts.on('-s', '--switch', 'Set options as switch') do
18
+ # # 这个部分就是使用这个Option后执行的代码
19
+ # options[:switch] = true
20
+ # end
21
+
22
+
23
+ # Option 作为flag,带argument,用于将argument作为数值解析,比如"name"信息
24
+ #下面的“value”就是用户使用时输入的argument
25
+ opts.on('-f FileNAME', '--name Name', 'Pass-in file name') do |value|
26
+ # options[:fname] = value
27
+ Mdpreview.hi(value)
28
+ end
29
+
30
+ # Option 作为flag,带一组用逗号分割的arguments,用于将arguments作为数组解析
31
+ opts.on('-a A,B', '--array A,B', Array, 'List of arguments') do |value|
32
+ options[:array] = value
33
+ end
34
+ end.parse!
35
+
36
+ # puts options.inspect
@@ -0,0 +1,9 @@
1
+ class Mdpreview::Translator
2
+ def initialize(language)
3
+ @language = language
4
+ end
5
+
6
+ def hi
7
+ p "hello world #{@language}"
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ module Mdpreview
2
+ VERSION = "0.0.2"
3
+ end
data/lib/mdpreview.rb ADDED
@@ -0,0 +1,19 @@
1
+ require "mdpreview/version"
2
+ require 'mdpreview/translator'
3
+ require 'pathname'
4
+
5
+ module Mdpreview
6
+ # Your code goes here...
7
+ def self.hi(a)
8
+ translator = Translator.new(a)
9
+ translator.hi
10
+
11
+ a=File.expand_path('../../', __FILE__)
12
+ p a
13
+ #获得当前执行文件的完整路径
14
+ # puts Pathname.new(__FILE__).realpath
15
+ #获得当前执行文件的目录完整路径
16
+ path = Pathname.new(File.expand_path('../../vendor/ed/mdp.html', __FILE__)).realpath
17
+ `open #{path}`
18
+ end
19
+ end
data/mdpreview.gemspec ADDED
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'mdpreview/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "mdpreview"
8
+ gem.version = Mdpreview::VERSION
9
+ gem.authors = ["shiren1118"]
10
+ gem.email = ["shiren1118@126.com"]
11
+ gem.description = %q{dsdfn}
12
+ gem.summary = %q{dsfsdf}
13
+ gem.homepage = ""
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+ end
metadata ADDED
@@ -0,0 +1,56 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mdpreview
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - shiren1118
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-01-12 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: dsdfn
15
+ email:
16
+ - shiren1118@126.com
17
+ executables:
18
+ - mdpreview
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - .gitignore
23
+ - Gemfile
24
+ - LICENSE.txt
25
+ - README.md
26
+ - Rakefile
27
+ - bin/mdpreview
28
+ - lib/mdpreview.rb
29
+ - lib/mdpreview/translator.rb
30
+ - lib/mdpreview/version.rb
31
+ - mdpreview.gemspec
32
+ homepage: ''
33
+ licenses: []
34
+ post_install_message:
35
+ rdoc_options: []
36
+ require_paths:
37
+ - lib
38
+ required_ruby_version: !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ required_rubygems_version: !ruby/object:Gem::Requirement
45
+ none: false
46
+ requirements:
47
+ - - ! '>='
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ requirements: []
51
+ rubyforge_project:
52
+ rubygems_version: 1.8.23
53
+ signing_key:
54
+ specification_version: 3
55
+ summary: dsfsdf
56
+ test_files: []