gast 0.0.9 → 0.0.10

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1661d5544fa9ea31a8f10ecedfff23a98e42ca82
4
- data.tar.gz: 7e0d04f8b903c95dbda3a30031522538ae450f98
3
+ metadata.gz: eeec572eb871ef31ca23050fea49e461ede8ada4
4
+ data.tar.gz: 49b8eef7b16e2eca899312247849e9eb75a38dad
5
5
  SHA512:
6
- metadata.gz: 0a21c35331f827585c016f08fcd03762bb03111f6e9f6481190166dc43a900c3d3b9be12c99f8e496da7af7e38356944bfa3159eab634e88cabdf63b373e1611
7
- data.tar.gz: cd7ed0038dd1349c7ef6c5397957d22a53e561f70d08911de49276329ab166944fcf009226bf3383a3198c68e1f4dd3fb7cd047854abfda1c34227a3519dac05
6
+ metadata.gz: bd55502f4bcebddb356eac5e5e83bf8264885df993af1307d7b28cc2834fe60656272e29d0682b6d384f68f0f848923d63caa578f1d651bf65a43a4156792998
7
+ data.tar.gz: b59aae1a8a878bdc00d823a5e961bf00d488f55c469fdbced068fa95f190394841005ab8129873a8e718d4bcef4f0c799a962f833356b47f32a93f4886c9fabc
data/Gemfile.lock ADDED
@@ -0,0 +1,172 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ gast (0.0.9)
5
+ bundler (~> 1.6)
6
+ git
7
+ haml
8
+ puma
9
+ rake
10
+ sass
11
+ sequel
12
+ sinatra
13
+ sinatra-contrib
14
+ sprockets
15
+ sprockets-helpers
16
+
17
+ GEM
18
+ remote: https://rubygems.org/
19
+ specs:
20
+ addressable (2.3.6)
21
+ ast (2.0.0)
22
+ astrolabe (1.3.0)
23
+ parser (>= 2.2.0.pre.3, < 3.0)
24
+ backports (3.6.4)
25
+ capybara (2.4.4)
26
+ mime-types (>= 1.16)
27
+ nokogiri (>= 1.3.3)
28
+ rack (>= 1.0.0)
29
+ rack-test (>= 0.5.4)
30
+ xpath (~> 2.0)
31
+ celluloid (0.16.0)
32
+ timers (~> 4.0.0)
33
+ childprocess (0.5.5)
34
+ ffi (~> 1.0, >= 1.0.11)
35
+ coderay (1.1.0)
36
+ crack (0.4.2)
37
+ safe_yaml (~> 1.0.0)
38
+ diff-lcs (1.2.5)
39
+ ffi (1.9.6)
40
+ formatador (0.2.5)
41
+ git (1.2.9.1)
42
+ guard (2.11.1)
43
+ formatador (>= 0.2.4)
44
+ listen (~> 2.7)
45
+ lumberjack (~> 1.0)
46
+ nenv (~> 0.1)
47
+ notiffany (~> 0.0)
48
+ pry (>= 0.9.12)
49
+ shellany (~> 0.0)
50
+ thor (>= 0.18.1)
51
+ guard-compat (1.2.1)
52
+ guard-rspec (4.5.0)
53
+ guard (~> 2.1)
54
+ guard-compat (~> 1.1)
55
+ rspec (>= 2.99.0, < 4.0)
56
+ guard-spork (2.1.0)
57
+ childprocess (>= 0.2.3)
58
+ guard (~> 2.0)
59
+ guard-compat (~> 1.0)
60
+ spork (>= 0.8.4)
61
+ haml (4.0.6)
62
+ tilt
63
+ hike (1.2.3)
64
+ hitimes (1.2.2)
65
+ listen (2.8.5)
66
+ celluloid (>= 0.15.2)
67
+ rb-fsevent (>= 0.9.3)
68
+ rb-inotify (>= 0.9)
69
+ lumberjack (1.0.9)
70
+ method_source (0.8.2)
71
+ mime-types (2.4.3)
72
+ mini_portile (0.6.2)
73
+ multi_json (1.10.1)
74
+ nenv (0.2.0)
75
+ nokogiri (1.6.6.2)
76
+ mini_portile (~> 0.6.0)
77
+ notiffany (0.0.3)
78
+ nenv (~> 0.1)
79
+ shellany (~> 0.0)
80
+ parser (2.2.0.2)
81
+ ast (>= 1.1, < 3.0)
82
+ powerpack (0.0.9)
83
+ pry (0.10.1)
84
+ coderay (~> 1.1.0)
85
+ method_source (~> 0.8.1)
86
+ slop (~> 3.4)
87
+ pry-remote (0.1.8)
88
+ pry (~> 0.9)
89
+ slop (~> 3.0)
90
+ puma (2.11.0)
91
+ rack (>= 1.1, < 2.0)
92
+ rack (1.6.0)
93
+ rack-protection (1.5.3)
94
+ rack
95
+ rack-test (0.6.3)
96
+ rack (>= 1.0)
97
+ rainbow (2.0.0)
98
+ rake (10.4.2)
99
+ rb-fsevent (0.9.4)
100
+ rb-inotify (0.9.5)
101
+ ffi (>= 0.5.0)
102
+ rspec (3.1.0)
103
+ rspec-core (~> 3.1.0)
104
+ rspec-expectations (~> 3.1.0)
105
+ rspec-mocks (~> 3.1.0)
106
+ rspec-core (3.1.7)
107
+ rspec-support (~> 3.1.0)
108
+ rspec-expectations (3.1.2)
109
+ diff-lcs (>= 1.2.0, < 2.0)
110
+ rspec-support (~> 3.1.0)
111
+ rspec-mocks (3.1.3)
112
+ rspec-support (~> 3.1.0)
113
+ rspec-support (3.1.2)
114
+ rubocop (0.28.0)
115
+ astrolabe (~> 1.3)
116
+ parser (>= 2.2.0.pre.7, < 3.0)
117
+ powerpack (~> 0.0.6)
118
+ rainbow (>= 1.99.1, < 3.0)
119
+ ruby-progressbar (~> 1.4)
120
+ ruby-progressbar (1.7.1)
121
+ safe_yaml (1.0.4)
122
+ sass (3.4.10)
123
+ sequel (4.18.0)
124
+ shellany (0.0.1)
125
+ sinatra (1.4.5)
126
+ rack (~> 1.4)
127
+ rack-protection (~> 1.4)
128
+ tilt (~> 1.3, >= 1.3.4)
129
+ sinatra-contrib (1.4.2)
130
+ backports (>= 2.0)
131
+ multi_json
132
+ rack-protection
133
+ rack-test
134
+ sinatra (~> 1.4.0)
135
+ tilt (~> 1.3)
136
+ slop (3.6.0)
137
+ spork (0.9.2)
138
+ sprockets (2.12.3)
139
+ hike (~> 1.2)
140
+ multi_json (~> 1.0)
141
+ rack (~> 1.0)
142
+ tilt (~> 1.1, != 1.3.0)
143
+ sprockets-helpers (1.1.0)
144
+ sprockets (~> 2.0)
145
+ thor (0.19.1)
146
+ tilt (1.4.1)
147
+ timecop (0.7.1)
148
+ timers (4.0.1)
149
+ hitimes
150
+ webmock (1.20.4)
151
+ addressable (>= 2.3.6)
152
+ crack (>= 0.3.2)
153
+ xpath (2.0.0)
154
+ nokogiri (~> 1.3)
155
+
156
+ PLATFORMS
157
+ ruby
158
+
159
+ DEPENDENCIES
160
+ capybara
161
+ gast!
162
+ guard
163
+ guard-rspec
164
+ guard-spork
165
+ pry
166
+ pry-remote
167
+ rack-test
168
+ rspec
169
+ rubocop
170
+ spork
171
+ timecop
172
+ webmock
data/README.md CHANGED
@@ -7,6 +7,7 @@
7
7
  memo application of using git.
8
8
 
9
9
  ![screen shot v0.0.4](https://cloud.githubusercontent.com/assets/72997/3080641/a04ba064-e4b3-11e3-9e8c-8adecc8873e4.png)
10
+ ![screen shot v0.0.9](https://cloud.githubusercontent.com/assets/72997/3209098/96545276-ee5a-11e3-947e-b13e5fde8c8a.png)
10
11
 
11
12
  ## Installation
12
13
 
data/lib/gast/app.rb CHANGED
@@ -15,6 +15,10 @@ module Gast
15
15
  haml :view
16
16
  end
17
17
 
18
+ get '/log/:content_id' do
19
+ haml :log
20
+ end
21
+
18
22
  get '/edit/:content_id' do
19
23
  haml :edit
20
24
  end
data/lib/gast/base.rb CHANGED
@@ -71,7 +71,7 @@ module Gast
71
71
  end
72
72
 
73
73
  before '/*/:content_id' do
74
- if %w[view edit update].include? request.path_info.split('/')[2]
74
+ if %w[view log edit update].include? request.path_info.split('/')[2]
75
75
  @content_id = params[:content_id].to_s
76
76
  @content = params[:content].to_s
77
77
  @language = params[:language].to_s
@@ -83,6 +83,10 @@ module Gast
83
83
  @language = Gast::Memo.language(@content_id)
84
84
  end
85
85
 
86
+ before '/log/:content_id' do
87
+ @log = Gast::Memo.log(@content_id)
88
+ end
89
+
86
90
  before '/edit/:content_id' do
87
91
  @item = Gast::Memo.item(@content_id)
88
92
  end
data/lib/gast/helper.rb CHANGED
@@ -13,6 +13,10 @@ module Gast
13
13
  def get_content(id)
14
14
  File.read(File.expand_path(Gast::PATH + "/#{id}/content"))
15
15
  end
16
+
17
+ def get_content_dir(id)
18
+ File.expand_path(Gast::PATH + "/#{id}")
19
+ end
16
20
 
17
21
  def get_language(id)
18
22
  File.read(File.expand_path(Gast::PATH + "/#{id}/language"))
data/lib/gast/memo.rb CHANGED
@@ -83,6 +83,12 @@ module Gast
83
83
  end
84
84
  module_function :item
85
85
 
86
+ def log(id)
87
+ repo = Repository.new
88
+ repo.dir_name = id
89
+ repo.log
90
+ end
91
+
86
92
  def language(id)
87
93
  escape_html { get_language(id) }
88
94
  end
@@ -20,6 +20,12 @@ module Gast
20
20
  write_language
21
21
  end
22
22
 
23
+ def log
24
+ path_of_repository
25
+ open_reposigory
26
+ commit_log
27
+ end
28
+
23
29
  def remove!
24
30
  FileUtils.remove_entry_secure(@path)
25
31
  end
@@ -72,6 +78,16 @@ module Gast
72
78
  @git = Git.init(@path)
73
79
  end
74
80
 
81
+ def open_reposigory
82
+ @git = Git.open(@path)
83
+ end
84
+
85
+ def commit_log
86
+ @git.log.map do |g|
87
+ { sha: g.sha, time: g.date.to_s }
88
+ end
89
+ end
90
+
75
91
  def changed_of_contents?
76
92
  return false if @git.ls_files.length == 0
77
93
  return false if @git.status.changed.length != 0
@@ -0,0 +1,18 @@
1
+ %h1
2
+ Logs >
3
+ %a{ href: url("/posts/view/#{@content_id}") }
4
+ = @content_id
5
+ %table{ class: "table table-striped" }
6
+ %thead
7
+ %tr
8
+ %th
9
+ SHA-1
10
+ %th
11
+ Created At
12
+ %tbody
13
+ - @log.each do |l|
14
+ %tr
15
+ %td
16
+ = l[:sha]
17
+ %td
18
+ = l[:time]
data/lib/gast/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Gast
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
@@ -56,6 +56,15 @@ describe Gast::App do
56
56
  expect(latest_content).to eq hello_world
57
57
  end
58
58
 
59
+ it 'should be log of item' do
60
+ post('/posts/new', content: hello_world)
61
+
62
+ get "/posts/log/#{dir_name_of_latest_repository}"
63
+
64
+ expect(last_response).to be_ok
65
+ expect(latest_content).to eq hello_world
66
+ end
67
+
59
68
  it 'should be can update of item' do
60
69
  post('/posts/new', content: hello_world)
61
70
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gast
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - futoase
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-07 00:00:00.000000000 Z
11
+ date: 2015-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -232,6 +232,7 @@ files:
232
232
  - ".rspec"
233
233
  - ".travis.yml"
234
234
  - Gemfile
235
+ - Gemfile.lock
235
236
  - Guardfile
236
237
  - LICENSE.txt
237
238
  - README.md
@@ -256,6 +257,7 @@ files:
256
257
  - lib/gast/templates/languages.haml
257
258
  - lib/gast/templates/layout.haml
258
259
  - lib/gast/templates/list.haml
260
+ - lib/gast/templates/log.haml
259
261
  - lib/gast/templates/navbar.haml
260
262
  - lib/gast/templates/not_found.haml
261
263
  - lib/gast/templates/save.haml
@@ -287,7 +289,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
287
289
  version: '0'
288
290
  requirements: []
289
291
  rubyforge_project:
290
- rubygems_version: 2.2.2
292
+ rubygems_version: 2.4.5
291
293
  signing_key:
292
294
  specification_version: 4
293
295
  summary: memo application of using git