areipiece 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c5c13b285da03a766c7963578944ecc9af71963b
4
+ data.tar.gz: 078983e177d622c5c207255d1c8772833eda0fce
5
+ SHA512:
6
+ metadata.gz: 940e918258665790cbb4c667e676784773da5f43c95f7473b24707ee02d096bcc18e6e1eb41c263996ea1dd58b27b3645bc03198408167bc4a0763109118bdb8
7
+ data.tar.gz: a3f09ce43357d20e5275995d0b3be1f4b2f64ab23e8e471030e2f94bb2847b66d2b7d2b181edc4d9a9480acc1422d77acc01da52f66adb23b54f797ce55467b4
@@ -0,0 +1,22 @@
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
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in areipiece.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 cobachie
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.
@@ -0,0 +1,29 @@
1
+ # Areipiece
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'areipiece'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install areipiece
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it ( https://github.com/[my-github-username]/areipiece/fork )
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 a new Pull Request
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
7
+
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'areipiece/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "areipiece"
8
+ spec.version = Areipiece::VERSION
9
+ spec.authors = ["cobachie"]
10
+ spec.email = ["chie.kobayashi@avasys.jp"]
11
+ spec.summary = %q{Write a short summary. Required.}
12
+ spec.description = %q{Write a longer description. Optional.}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.6"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "rspec"
24
+
25
+ spec.add_runtime_dependency 'thor'
26
+ spec.add_runtime_dependency 'activerecord'
27
+ spec.add_runtime_dependency 'mysql2'
28
+ end
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'areipiece'
4
+
5
+ Areipiece::SP.start
6
+
@@ -0,0 +1,58 @@
1
+ require "areipiece/version"
2
+ require "thor"
3
+ require "rubygems"
4
+ require "active_record"
5
+ require "yaml"
6
+
7
+ module Areipiece
8
+ class SP < Thor
9
+
10
+ desc "", ""
11
+ def set
12
+ begin
13
+ @app_root = Dir.getwd
14
+ @gem_root = File.expand_path("../../templates", __FILE__)
15
+
16
+ establish_database
17
+
18
+ Dir.glob("#{@gem_root}/**/*").each do |file|
19
+ if File::ftype(file) == "file" && File.extname(file) == ".yml"
20
+ set_data(file)
21
+ end
22
+ end
23
+ return true
24
+ rescue => e
25
+ puts "ERROR: " + e.message
26
+ false
27
+ end
28
+ end
29
+
30
+ private
31
+ def establish_database
32
+ config = YAML.load_file("#{@app_root}/config/database.yml")
33
+ ActiveRecord::Base.establish_connection(config["production"])
34
+ end
35
+
36
+ def set_data(file)
37
+ filename = File.basename(file, ".*")
38
+
39
+ data = YAML.load_file(file)
40
+ data["concept_id"] ||= 1
41
+ data["site_id"] ||= 1
42
+ data["state"] ||= "public"
43
+ data["model"] ||= "Cms::Free"
44
+ data["name"] ||= filename
45
+ data["title"] ||= filename
46
+ data["view_title"] ||= filename
47
+
48
+ if CmsPiece.new.save_piece(data)
49
+ puts "---> create #{filename}"
50
+ else
51
+ puts "---> skip #{filename}"
52
+ end
53
+
54
+ end
55
+ end
56
+
57
+ require "areipiece/cms_piece"
58
+ end
@@ -0,0 +1,26 @@
1
+ module Areipiece
2
+
3
+ class CmsPiece < ActiveRecord::Base
4
+
5
+ def save_piece(data)
6
+
7
+ return false if data.blank?
8
+
9
+ return false unless CmsPiece.where(title: data["title"]).blank?
10
+
11
+ @piece = CmsPiece.new
12
+ @piece.concept_id = data["concept_id"]
13
+ @piece.site_id = data["site_id"]
14
+ @piece.state = data["state"]
15
+ @piece.model = data["model"]
16
+ @piece.name = data["name"]
17
+ @piece.title = data["title"]
18
+ @piece.view_title = data["view_title"]
19
+ @piece.body = data["body"]
20
+ @piece.save!
21
+
22
+ end
23
+
24
+ end
25
+
26
+ end
@@ -0,0 +1,3 @@
1
+ module Areipiece
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+
3
+ describe Areipiece do
4
+
5
+ before do
6
+
7
+ end
8
+
9
+ it 'has a version number' do
10
+ expect(Areipiece::VERSION).not_to be nil
11
+ end
12
+
13
+ it 'has error if database.yml is not found' do
14
+ Dir.chdir("/var/share/")
15
+ ret = Areipiece::SP.new.set
16
+ expect(ret).to eq(false)
17
+ end
18
+
19
+ it 'is successfully registered piece' do
20
+ Dir.chdir("/var/share/zomeki")
21
+ ret1 = Areipiece::SP.new.set
22
+ expect(ret1).to eq(true)
23
+
24
+ ret2 = Areipiece::SP.new.set
25
+ expect(ret2).to eq(true)
26
+ end
27
+ end
@@ -0,0 +1,2 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'areipiece'
@@ -0,0 +1,55 @@
1
+ body: |
2
+ <!-- skip reading -->
3
+ <div id="accessibilityTool" class="piece">
4
+ <div class="pieceContainer">
5
+ <div class="pieceBody">
6
+
7
+ <p id="nocssread"><a href="#main">本文へ移動</a></p>
8
+
9
+ <script src="/_common/js/jquery.cookie.js"></script>
10
+ <script src="/_common/js/navigation.js"></script>
11
+ <script>
12
+ $(function() {
13
+ Navigation.initialize({
14
+ theme : { '#themeBlack' : 'black', '#themeBlue': 'blue', '#themeWhite' : 'white' },
15
+ fontSize: { '#fontSmall' : '80%', '#fontMiddle': '87.5%', '#fontLarge' : '100%' },
16
+ notice : '#headerBody',
17
+ ruby : '#navigationRuby',
18
+ talk : '#navigationTalk',
19
+ player : '#navigationTalkPlayer'
20
+ });
21
+
22
+ $('a.rubyOn').text('ふりがなをはずす');
23
+ $('#navigationTalk').toggle(function(){
24
+ $(this).text('よみあげ中');
25
+ return false;
26
+ }, function(){
27
+ $(this).text('よみあげる');
28
+ return false;
29
+ });
30
+ });
31
+ </script>
32
+
33
+ <ul>
34
+ <li>文字の大きさ:
35
+ <ul class="fontSize">
36
+ <li><a href="#fontSmall" id="fontSmall" title="文字のサイズを小さくする">小</a></li>
37
+ <li><a href="#fontMiddle" id="fontMiddle" title="標準の文字サイズに戻す">中</a></li>
38
+ <li><a href="#fontLarge" id="fontLarge" title="文字のサイズを大きくする">大</a></li>
39
+ </ul>
40
+ </li>
41
+ <li>背景色:
42
+ <ul class="themeColor">
43
+ <li><a href="#themeBlack" id="themeBlack" title="背景色を黒にする" class="black">黒</a></li>
44
+ <li><a href="#themeBlue" id="themeBlue" title="背景色を青にする" class="blue">青</a></li>
45
+ <li><a href="#themeWhite" id="themeWhite" title="背景色を白にする" class="white">白</a></li>
46
+ </ul>
47
+ </li>
48
+ <li><a href="#navigationRuby" id="navigationRuby">ふりがなをつける</a></li>
49
+ <li><a href="#navigationTalk" id="navigationTalk">よみあげる</a><span id="navigationTalkPlayer"></span></li>
50
+ </ul>
51
+
52
+ </div>
53
+ </div>
54
+ </div>
55
+ <!-- /skip reading -->
@@ -0,0 +1,2 @@
1
+ model: Cms::BreadCrumb
2
+ view_title: パンくずリスト
@@ -0,0 +1,16 @@
1
+ body: |
2
+ <footer>
3
+ <div class="container_12">
4
+ <div class="grid_12">
5
+ <div class="socials">
6
+ <a href="#"></a>
7
+ <a href="#"></a>
8
+ <a href="#"></a>
9
+ <a href="#"></a>
10
+ </div>
11
+ <div class="copy">
12
+ WebDesign (C) 2013 | <a href="#">Privacy Policy</a> | Website Template designed by <a href="http://www.templatemonster.com/" rel="nofollow">TemplateMonster.com</a>
13
+ </div>
14
+ </div>
15
+ </div>
16
+ </footer>
@@ -0,0 +1,20 @@
1
+ body: |
2
+ <div class="container_12">
3
+ <div class="grid_12">
4
+ <h1><a href="index.html"><img src="/_themes/webstudio/images/logo.png" alt="Boo House"></a> </h1>
5
+ <div class="menu_block">
6
+ <nav class="" >
7
+ <ul class="sf-menu">
8
+ <li class="current"><a href="index.html">Home</a></li>
9
+ <li><a href="index-1.html">about</a></li>
10
+ <li><a href="index-2.html">Portfolio</a></li>
11
+ <li><a href="index-3.html">Clients</a></li>
12
+ <li><a href="index-4.html">Contacts</a></li>
13
+ </ul>
14
+ </nav>
15
+ <div class="clear"></div>
16
+ </div>
17
+ <div class="clear"></div>
18
+ </div>
19
+ </div>
20
+
@@ -0,0 +1,2 @@
1
+ model: Cms::PageTitle
2
+ view_title: ページタイトル
metadata ADDED
@@ -0,0 +1,150 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: areipiece
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - cobachie
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-05-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: thor
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: activerecord
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: mysql2
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: Write a longer description. Optional.
98
+ email:
99
+ - chie.kobayashi@avasys.jp
100
+ executables:
101
+ - areipiece
102
+ extensions: []
103
+ extra_rdoc_files: []
104
+ files:
105
+ - .gitignore
106
+ - .rspec
107
+ - .travis.yml
108
+ - Gemfile
109
+ - LICENSE.txt
110
+ - README.md
111
+ - Rakefile
112
+ - areipiece.gemspec
113
+ - bin/areipiece
114
+ - lib/areipiece.rb
115
+ - lib/areipiece/cms_piece.rb
116
+ - lib/areipiece/version.rb
117
+ - spec/areipiece_spec.rb
118
+ - spec/spec_helper.rb
119
+ - templates/accessibility-tool.yml
120
+ - templates/breadcrumb.yml
121
+ - templates/footer.yml
122
+ - templates/header.yml
123
+ - templates/title.yml
124
+ homepage: ''
125
+ licenses:
126
+ - MIT
127
+ metadata: {}
128
+ post_install_message:
129
+ rdoc_options: []
130
+ require_paths:
131
+ - lib
132
+ required_ruby_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - '>='
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ required_rubygems_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ requirements: []
143
+ rubyforge_project:
144
+ rubygems_version: 2.0.14
145
+ signing_key:
146
+ specification_version: 4
147
+ summary: Write a short summary. Required.
148
+ test_files:
149
+ - spec/areipiece_spec.rb
150
+ - spec/spec_helper.rb